diff options
Diffstat (limited to 'WebCore')
745 files changed, 28686 insertions, 7025 deletions
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index 2cc01d9..5dd03df 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -179,6 +179,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/fileapi/%.cpp : $(intermediates)/ # HTML GEN := \ $(intermediates)/html/JSDOMFormData.h \ + $(intermediates)/html/JSDOMTokenList.h \ $(intermediates)/html/JSDataGridColumn.h \ $(intermediates)/html/JSDataGridColumnList.h \ $(intermediates)/html/JSHTMLAllCollection.h \ diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index 12e12d2..efdf73e 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -146,6 +146,12 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates) GEN := \ $(intermediates)/bindings/V8Blob.h \ $(intermediates)/bindings/V8BlobBuilder.h \ +<<<<<<< HEAD +======= + $(intermediates)/bindings/V8DOMTokenList.h \ + $(intermediates)/bindings/V8DataGridColumn.h \ + $(intermediates)/bindings/V8DataGridColumnList.h \ +>>>>>>> webkit.org at r68651 $(intermediates)/bindings/V8File.h \ $(intermediates)/bindings/V8FileError.h \ $(intermediates)/bindings/V8FileList.h \ diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk index e87ca3d..bfa4d1d 100644 --- a/WebCore/Android.jscbindings.mk +++ b/WebCore/Android.jscbindings.mk @@ -86,10 +86,14 @@ LOCAL_SRC_FILES += \ bindings/js/JSDOMBinding.cpp \ bindings/js/JSDOMFormDataCustom.cpp \ bindings/js/JSDOMGlobalObject.cpp \ +<<<<<<< HEAD bindings/js/JSDOMMimeTypeArrayCustom.cpp \ bindings/js/JSDOMPluginArrayCustom.cpp \ bindings/js/JSDOMPluginCustom.cpp \ bindings/js/JSDOMStringMapCustom.cpp \ +======= + bindings/js/JSDOMTokenList.cpp \ +>>>>>>> webkit.org at r68651 bindings/js/JSDOMWindowBase.cpp \ bindings/js/JSDOMWindowCustom.cpp \ bindings/js/JSDOMWindowShell.cpp \ diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 6ef73e9..e148dcb 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -275,10 +275,22 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ history/android/HistoryItemAndroid.cpp \ \ html/AsyncImageResizer.cpp \ + html/BaseTextInputType.cpp \ + html/ButtonInputType.cpp \ + html/CheckboxInputType.cpp \ html/CollectionCache.cpp \ html/parser/CSSPreloadScanner.cpp \ + html/ColorInputType.cpp \ html/DOMFormData.cpp \ +<<<<<<< HEAD html/DateComponents.cpp \ +======= + html/DateInputType.cpp \ + html/DateTimeInputType.cpp \ + html/DateTimeLocalInputType.cpp \ + html/EmailInputType.cpp \ + html/FileInputType.cpp \ +>>>>>>> webkit.org at r68651 html/FormDataList.cpp \ html/HTMLAllCollection.cpp \ html/HTMLCollection.cpp \ @@ -292,16 +304,37 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/HTMLParserErrorCodes.cpp \ html/HTMLTableRowsCollection.cpp \ html/HTMLViewSourceDocument.cpp \ + html/HiddenInputType.cpp \ html/ImageData.cpp \ html/ImageDocument.cpp \ - html/MediaDocument.cpp \ + html/ImageInputType.cpp \ html/ImageResizerThread.cpp \ +<<<<<<< HEAD html/LabelsNodeList.cpp \ html/StepRange.cpp \ +======= + html/InputType.cpp \ + html/IsIndexInputType.cpp \ + html/MediaDocument.cpp \ + html/MonthInputType.cpp \ + html/NumberInputType.cpp \ + html/PasswordInputType.cpp \ +>>>>>>> webkit.org at r68651 html/PluginDocument.cpp \ + html/RadioInputType.cpp \ + html/RangeInputType.cpp \ + html/ResetInputType.cpp \ + html/SearchInputType.cpp \ + html/SubmitInputType.cpp \ + html/TelephoneInputType.cpp \ html/TextDocument.cpp \ + html/TextFieldInputType.cpp \ + html/TextInputType.cpp \ + html/TimeInputType.cpp \ html/TimeRanges.cpp \ + html/URLInputType.cpp \ html/ValidityState.cpp \ + html/WeekInputType.cpp \ \ html/canvas/CanvasGradient.cpp \ html/canvas/WebGLObject.cpp \ @@ -553,7 +586,18 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/filters/FEBlend.cpp \ platform/graphics/filters/FEColorMatrix.cpp \ platform/graphics/filters/FEComponentTransfer.cpp \ - platform/graphics/filters/FEComposite.cpp + platform/graphics/filters/FEComposite.cpp \ + platform/graphics/filters/FEConvolveMatrix.cpp \ + platform/graphics/filters/FEDiffuseLighting.cpp \ + platform/graphics/filters/FEDisplacementMap.cpp \ + platform/graphics/filters/FEFlood.cpp \ + platform/graphics/filters/FEMerge.cpp \ + platform/graphics/filters/FEMorphology.cpp \ + platform/graphics/filters/FEOffset.cpp \ + platform/graphics/filters/FESpecularLighting.cpp \ + platform/graphics/filters/FETile.cpp \ + platform/graphics/filters/FETurbulence.cpp \ + platform/graphics/filters/LightSource.cpp endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ @@ -1028,20 +1072,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ svg/graphics/SVGImage.cpp \ \ - svg/graphics/filters/SVGFEConvolveMatrix.cpp \ - svg/graphics/filters/SVGFEDiffuseLighting.cpp \ - svg/graphics/filters/SVGFEDisplacementMap.cpp \ - svg/graphics/filters/SVGFEFlood.cpp \ svg/graphics/filters/SVGFEImage.cpp \ - svg/graphics/filters/SVGFEMerge.cpp \ - svg/graphics/filters/SVGFEMorphology.cpp \ - svg/graphics/filters/SVGFEOffset.cpp \ - svg/graphics/filters/SVGFESpecularLighting.cpp \ - svg/graphics/filters/SVGFETile.cpp \ - svg/graphics/filters/SVGFETurbulence.cpp \ svg/graphics/filters/SVGFilter.cpp \ - svg/graphics/filters/SVGFilterBuilder.cpp \ - svg/graphics/filters/SVGLightSource.cpp + svg/graphics/filters/SVGFilterBuilder.cpp endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt index eeb88b1..210244e 100644 --- a/WebCore/CMakeLists.txt +++ b/WebCore/CMakeLists.txt @@ -205,6 +205,7 @@ SET(WebCore_IDL_FILES html/DataGridColumn.idl html/DataGridColumnList.idl html/DOMFormData.idl + html/DOMTokenList.idl html/HTMLAllCollection.idl html/HTMLAnchorElement.idl html/HTMLAppletElement.idl @@ -535,6 +536,10 @@ IF (ENABLE_SVG) ENDIF() SET(WebCore_SOURCES + ${DERIVED_SOURCES_DIR}/DocTypeStrings.cpp + ${DERIVED_SOURCES_DIR}/CSSValueKeywords.cpp + ${DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp + ${DERIVED_SOURCES_DIR}/ColorData.cpp ${DERIVED_SOURCES_DIR}/HTMLEntityTable.cpp ${DERIVED_SOURCES_DIR}/UserAgentStyleSheetsData.cpp ${DERIVED_SOURCES_DIR}/InspectorBackendDispatcher.cpp @@ -939,13 +944,23 @@ SET(WebCore_SOURCES history/PageCache.cpp html/AsyncImageResizer.cpp + html/BaseTextInputType.cpp + html/ButtonInputType.cpp + html/CheckboxInputType.cpp html/CollectionCache.cpp + html/ColorInputType.cpp html/DOMDataGridDataSource.cpp html/DOMFormData.cpp + html/DOMTokenList.cpp html/DataGridColumn.cpp html/DataGridColumnList.cpp html/DateComponents.cpp + html/DateInputType.cpp + html/DateTimeInputType.cpp + html/DateTimeLocalInputType.cpp + html/EmailInputType.cpp html/FTPDirectoryDocument.cpp + html/FileInputType.cpp html/FormDataList.cpp html/HTMLAllCollection.cpp html/HTMLAnchorElement.cpp @@ -1028,15 +1043,33 @@ SET(WebCore_SOURCES html/HTMLTitleElement.cpp html/HTMLUListElement.cpp html/HTMLViewSourceDocument.cpp + html/HiddenInputType.cpp html/ImageData.cpp html/ImageDocument.cpp + html/ImageInputType.cpp html/ImageResizerThread.cpp + html/InputType.cpp + html/IsIndexInputType.cpp html/LabelsNodeList.cpp html/MediaDocument.cpp + html/MonthInputType.cpp + html/NumberInputType.cpp + html/PasswordInputType.cpp html/PluginDocument.cpp + html/RadioInputType.cpp + html/RangeInputType.cpp + html/ResetInputType.cpp + html/SearchInputType.cpp html/StepRange.cpp + html/SubmitInputType.cpp + html/TelephoneInputType.cpp html/TextDocument.cpp + html/TextFieldInputType.cpp + html/TextInputType.cpp + html/TimeInputType.cpp + html/URLInputType.cpp html/ValidityState.cpp + html/WeekInputType.cpp html/canvas/CanvasGradient.cpp html/canvas/CanvasPattern.cpp html/canvas/CanvasPixelArray.cpp @@ -1257,9 +1290,21 @@ SET(WebCore_SOURCES platform/graphics/filters/FEColorMatrix.cpp platform/graphics/filters/FEComponentTransfer.cpp platform/graphics/filters/FEComposite.cpp + platform/graphics/filters/FEConvolveMatrix.cpp + platform/graphics/filters/FEDiffuseLighting.cpp + platform/graphics/filters/FEDisplacementMap.cpp + platform/graphics/filters/FEFlood.cpp platform/graphics/filters/FEGaussianBlur.cpp + platform/graphics/filters/FELighting.cpp + platform/graphics/filters/FEMerge.cpp + platform/graphics/filters/FEMorphology.cpp + platform/graphics/filters/FEOffset.cpp + platform/graphics/filters/FESpecularLighting.cpp + platform/graphics/filters/FETile.cpp + platform/graphics/filters/FETurbulence.cpp platform/graphics/filters/FilterEffect.cpp platform/graphics/filters/ImageBufferFilter.cpp + platform/graphics/filters/LightSource.cpp platform/graphics/filters/SourceAlpha.cpp platform/graphics/filters/SourceGraphic.cpp @@ -1812,21 +1857,9 @@ IF (ENABLE_SVG) svg/animation/SMILTimeContainer.cpp svg/animation/SVGSMILElement.cpp svg/graphics/SVGImage.cpp - svg/graphics/filters/SVGFEConvolveMatrix.cpp - svg/graphics/filters/SVGFEDiffuseLighting.cpp - svg/graphics/filters/SVGFEDisplacementMap.cpp - svg/graphics/filters/SVGFEFlood.cpp svg/graphics/filters/SVGFEImage.cpp - svg/graphics/filters/SVGFELighting.cpp - svg/graphics/filters/SVGFEMerge.cpp - svg/graphics/filters/SVGFEMorphology.cpp - svg/graphics/filters/SVGFEOffset.cpp - svg/graphics/filters/SVGFESpecularLighting.cpp - svg/graphics/filters/SVGFETile.cpp - svg/graphics/filters/SVGFETurbulence.cpp svg/graphics/filters/SVGFilter.cpp svg/graphics/filters/SVGFilterBuilder.cpp - svg/graphics/filters/SVGLightSource.cpp ) ENDIF() @@ -1887,6 +1920,12 @@ IF (ENABLE_WML) ) ENDIF() +IF (ENABLE_PROGRESS_TAG) + LIST(APPEND WebCore_SOURCES + accessibility/AccessibilityProgressIndicator.cpp + ) +ENDIF () + SET(IDL_INCLUDES "") FOREACH (_include ${WebCore_IDL_INCLUDES}) LIST(APPEND IDL_INCLUDES --include=${WEBCORE_DIR}/${_include}) @@ -1907,12 +1946,10 @@ LIST(APPEND WebCore_SOURCES ${JS_IDL_FILES} ${Inspector_IDL_FILES}) GENERATE_ENTITIES(${WEBCORE_DIR}/html/parser/HTMLEntityNames.in ${DERIVED_SOURCES_DIR}/HTMLEntityTable.cpp ${WEBCORE_DIR}/html/parser/create-html-entity-table) - -GENERATE_GPERF(${WEBCORE_DIR}/platform/ColorData.gperf ${DERIVED_SOURCES_DIR}/ColorData.cpp findColor "") +MAKE_HASH_TOOLS(${WEBCORE_DIR}/platform/ColorData) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/platform/graphics/Color.cpp ColorData.cpp) - -GENERATE_GPERF(${WEBCORE_DIR}/html/DocTypeStrings.gperf ${DERIVED_SOURCES_DIR}/DocTypeStrings.cpp findDoctypeEntry "-F,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards") +MAKE_HASH_TOOLS(${WEBCORE_DIR}/html/DocTypeStrings) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/HTMLDocument.cpp DocTypeStrings.cpp) @@ -1932,6 +1969,7 @@ GENERATE_CSS_PROPERTY_NAMES() GENERATE_CSS_VALUE_KEYWORDS() +ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/HashTools.h DocTypeStrings.cpp CSSValueKeywords.cpp CSSPropertyNames.cpp ColorData.cpp) ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSValueKeywords.h) ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSPropertyNames.h) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSPrimitiveValueMappings.h CSSValueKeywords.h) diff --git a/WebCore/CMakeListsEfl.txt b/WebCore/CMakeListsEfl.txt index c892cf4..a4d4a60 100644 --- a/WebCore/CMakeListsEfl.txt +++ b/WebCore/CMakeListsEfl.txt @@ -67,6 +67,7 @@ IF (WTF_PLATFORM_CAIRO) "${WEBCORE_DIR}/platform/graphics/cairo" ) LIST(APPEND WebCore_SOURCES + platform/graphics/cairo/CairoUtilities.cpp platform/graphics/cairo/FontCacheFreeType.cpp platform/graphics/cairo/FontCairo.cpp platform/graphics/cairo/FontCustomPlatformData.cpp diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 1f755a4..c660e9d 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,6938 @@ +2010-09-29 Philippe Normand <pnormand@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + build still broken since r68521 + https://bugs.webkit.org/show_bug.cgi?id=46795 + + Call make-values.pl once only. It seems calling it multiple times + in the same build produces a wrong CSSValueKeywordsHash.h which + has a duplicate declaration of its valueList variable. The double + call is triggered by the double targets in the Makefile rules and + makevalues.pl generates one of them, which screws up the build. A + more proper fix should be done with the advices on + http://www.cmcrossroads.com/cm-basics/12905-rules-with-multiple-outputs-in-gnu-make + + * GNUmakefile.am: + +2010-09-29 João Paulo Rechi Vita <jprvita@profusion.mobi> + + Unreviewed build fix. + + Fix CMake build for ENABLE_PROGRESS_TAG. + https://bugs.webkit.org/show_bug.cgi?id=46808 + + No new tests since it's a build fix. + + * CMakeLists.txt: + +2010-09-29 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Use generic mechanism to report exceptions in V8CustomVoidCallback + https://bugs.webkit.org/show_bug.cgi?id=46803 + + No new tests. It's covered by existing tests under LayoutTests/storage + + * bindings/v8/custom/V8CustomVoidCallback.cpp: + (WebCore::invokeCallback): + +2010-09-29 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Rename the input element's @speech attribute to @webkitspeech since it is still experimental. + https://bugs.webkit.org/show_bug.cgi?id=46799 + + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::webkitspeechEnabled): Rename the runtime feature flag getter. + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSValueKeywords.in: Rename the css style name. + * css/html.css: Rename the css style name. + (input::-webkit-input-speech-button): + * html/HTMLAttributeNames.in: Rename the @speech attribute. + * html/HTMLInputElement.cpp: Update code using the attribute. + (WebCore::HTMLInputElement::parseMappedAttribute): + (WebCore::HTMLInputElement::isSpeechEnabled): + * html/HTMLInputElement.idl: Rename the @speech attribute. + +2010-09-29 MORITA Hajime <morrita@google.com> + + [Chromium] failed to build without ACCELERATED_COMPOSITING + https://bugs.webkit.org/show_bug.cgi?id=46793 + + Moved constant definitions from inside ACCELERATED_COMPOSITING to + outside of the condition. + + * WebCore.gypi: + * platform/graphics/chromium/VideoFrameChromium.cpp: Added just for defining constants. + * platform/graphics/chromium/VideoLayerChromium.cpp: + +2010-09-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: [Resources panel] Need more visible "at a glance". + https://bugs.webkit.org/show_bug.cgi?id=45657 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/DataGrid.js: + (WebInspector.DataGrid): + (WebInspector.DataGrid.prototype.updateWidths): + (WebInspector.DataGrid.prototype.sortNodes): + (WebInspector.DataGrid.prototype._resizerDragging): + (WebInspector.DataGrid.prototype._endResizerDragging): + (WebInspector.DataGridNode.prototype.selectable.true.get element): + (WebInspector.DataGridNode.prototype.createCells): + (WebInspector.DataGridNode.prototype.refresh): + * inspector/front-end/Images/networkIcon.png: Copied from WebCore/inspector/front-end/Images/resourcesIcon.png. + * inspector/front-end/NetworkPanel.js: Added. + * inspector/front-end/Settings.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: + (.toolbar-item.network .toolbar-icon): + (.data-grid .data-container): + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector._createPanels): + (WebInspector.updateResource): + * inspector/front-end/networkPanel.css: Added. + +2010-09-28 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: move pauseOnExceptionState under control of InspectorState + It is Inspector Protocol cleanup activity. + The actual state of this flag can be obtained as a return value of setPauseOnExceptionState command + or as a value in InspectorState object. + + https://bugs.webkit.org/show_bug.cgi?id=46724 + + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::getInspectorState): + (WebCore::InspectorController::populateScriptObjects): + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::setPauseOnExceptionsState): + (WebCore::InspectorDebuggerAgent::pauseOnExceptionsState): + * inspector/InspectorDebuggerAgent.h: + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions): + * inspector/front-end/inspector.js: + (WebInspector.doLoadedDone.populateInspectorState): + (WebInspector.doLoadedDone): + (WebInspector.reportProtocolError): + +2010-09-28 Philippe Normand <pnormand@igalia.com> + + Reviewed by Martin Robinson. + + check USE(GSTREAMER) instead of ENABLE(VIDEO) in gstreamer/ files + https://bugs.webkit.org/show_bug.cgi?id=46717 + + Guard the gstreamer/ files with USE(GSTREAMER), which is more + explicit than ENABLE(VIDEO). + + * GNUmakefile.am: Define WTF_USE_GSTREAMER only if GStreamer + support is enabled. + * platform/graphics/gstreamer/DataSourceGStreamer.cpp: + * platform/graphics/gstreamer/DataSourceGStreamer.h: + * platform/graphics/gstreamer/GOwnPtrGStreamer.cpp: + * platform/graphics/gstreamer/GOwnPtrGStreamer.h: + * platform/graphics/gstreamer/GStreamerGWorld.cpp: + * platform/graphics/gstreamer/GStreamerGWorld.h: + * platform/graphics/gstreamer/ImageGStreamer.h: + * platform/graphics/gstreamer/ImageGStreamerCG.mm: + * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: + * platform/graphics/gstreamer/PlatformVideoWindow.h: + * platform/graphics/gstreamer/PlatformVideoWindowEfl.cpp: + * platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp: + * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: + * platform/graphics/gstreamer/VideoSinkGStreamer.h: + * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: + * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: + +2010-09-28 Kent Tamura <tkent@chromium.org> + + Unreviewed, windows build fix for r68629. + + * WebCore.vcproj/WebCore.vcproj: Add TimeInputType.{cpp,h} + +2010-09-28 Johnny Ding <jnd@chromium.org> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=41292 + Pass the right popupAllowed flag to current execution frame, + so WebKit can get right gesture status for popups initiated + from plugins. + This also makes v8 binding's ScriptController::processingUserGesture + match what jsc version. + + Test: plugins/plugin-initiate-popup-window.html + + * bindings/v8/NPV8Object.cpp: + (_NPN_EvaluateHelper): + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + (WebCore::ScriptController::processingUserGesture): + * bindings/v8/ScriptController.h: + (WebCore::ScriptController::setAllowPopupsFromPlugin): + (WebCore::ScriptController::allowPopupsFromPlugin): + +2010-09-28 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Refactor HTMLInputElement: Introducing InputType class and classes + for each input element types. + https://bugs.webkit.org/show_bug.cgi?id=45872 + + No new tests because this doesn't change any behavior. + + * Android.mk: Add new files. + * CMakeLists.txt: ditto. + * GNUmakefile.am: ditto. + * WebCore.gypi: ditto. + * WebCore.pro: ditto. + * WebCore.vcproj/WebCore.vcproj: ditto. + * WebCore.xcodeproj/project.pbxproj: ditto. + * html/BaseTextInputType.cpp: Added. + (WebCore::BaseTextInputType::isTextType): + (WebCore::BaseTextInputType::patternMismatch): + * html/BaseTextInputType.h: Added. + (WebCore::BaseTextInputType::BaseTextInputType): + * html/ButtonInputType.cpp: Added. + (WebCore::ButtonInputType::create): + (WebCore::ButtonInputType::formControlType): + * html/ButtonInputType.h: Added. + (WebCore::ButtonInputType::ButtonInputType): + * html/CheckboxInputType.cpp: Added. + (WebCore::CheckboxInputType::create): + (WebCore::CheckboxInputType::formControlType): + * html/CheckboxInputType.h: Added. + (WebCore::CheckboxInputType::CheckboxInputType): + * html/ColorInputType.cpp: Added. + (WebCore::ColorInputType::create): + (WebCore::ColorInputType::formControlType): + * html/ColorInputType.h: Added. + (WebCore::ColorInputType::ColorInputType): + * html/DateInputType.cpp: Added. + (WebCore::DateInputType::create): + (WebCore::DateInputType::formControlType): + * html/DateInputType.h: Added. + (WebCore::DateInputType::DateInputType): + * html/DateTimeInputType.cpp: Added. + (WebCore::DateTimeInputType::create): + (WebCore::DateTimeInputType::formControlType): + * html/DateTimeInputType.h: Added. + (WebCore::DateTimeInputType::DateTimeInputType): + * html/DateTimeLocalInputType.cpp: Added. + (WebCore::DateTimeLocalInputType::create): + (WebCore::DateTimeLocalInputType::formControlType): + * html/DateTimeLocalInputType.h: Added. + (WebCore::DateTimeLocalInputType::DateTimeLocalInputType): + * html/EmailInputType.cpp: Added. + (WebCore::EmailInputType::create): + (WebCore::EmailInputType::formControlType): + * html/EmailInputType.h: Added. + (WebCore::EmailInputType::EmailInputType): + * html/FileInputType.cpp: Added. + (WebCore::FileInputType::create): + (WebCore::FileInputType::formControlType): + * html/FileInputType.h: Added. + (WebCore::FileInputType::FileInputType): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::HTMLInputElement): Initialize m_inputType. + (WebCore::HTMLInputElement::patternMismatch): Delegate to InputType. + (WebCore::HTMLInputElement::updateType): Update m_inputType with new type. + (WebCore::HTMLInputElement::formControlType): Delegate to InputType. + (WebCore::HTMLInputElement::isTextField): ditto. + (WebCore::HTMLInputElement::isTextType): ditto. + * html/HTMLInputElement.h: + * html/HiddenInputType.cpp: Added. + (WebCore::HiddenInputType::create): + (WebCore::HiddenInputType::formControlType): + * html/HiddenInputType.h: Added. + (WebCore::HiddenInputType::HiddenInputType): + * html/ImageInputType.cpp: Added. + (WebCore::ImageInputType::create): + (WebCore::ImageInputType::formControlType): + * html/ImageInputType.h: Added. + (WebCore::ImageInputType::ImageInputType): + * html/InputType.cpp: Added. + (WebCore::createInputTypeFactoryMap): + (WebCore::InputType::create): + (WebCore::InputType::createText): + (WebCore::InputType::~InputType): + (WebCore::InputType::isTextField): + (WebCore::InputType::isTextType): + (WebCore::InputType::patternMismatch): + (WebCore::InputTypeNames::button): + (WebCore::InputTypeNames::checkbox): + (WebCore::InputTypeNames::color): + (WebCore::InputTypeNames::date): + (WebCore::InputTypeNames::datetime): + (WebCore::InputTypeNames::datetimelocal): + (WebCore::InputTypeNames::email): + (WebCore::InputTypeNames::file): + (WebCore::InputTypeNames::hidden): + (WebCore::InputTypeNames::image): + (WebCore::InputTypeNames::isindex): + (WebCore::InputTypeNames::month): + (WebCore::InputTypeNames::number): + (WebCore::InputTypeNames::password): + (WebCore::InputTypeNames::radio): + (WebCore::InputTypeNames::range): + (WebCore::InputTypeNames::reset): + (WebCore::InputTypeNames::search): + (WebCore::InputTypeNames::submit): + (WebCore::InputTypeNames::telephone): + (WebCore::InputTypeNames::text): + (WebCore::InputTypeNames::time): + (WebCore::InputTypeNames::url): + (WebCore::InputTypeNames::week): + * html/InputType.h: Added. + (WebCore::InputType::InputType): + (WebCore::InputType::element): + * html/IsIndexInputType.cpp: Added. + (WebCore::IsIndexInputType::create): + (WebCore::IsIndexInputType::formControlType): + * html/IsIndexInputType.h: Added. + (WebCore::IsIndexInputType::IsIndexInputType): + * html/MonthInputType.cpp: Added. + (WebCore::MonthInputType::create): + (WebCore::MonthInputType::formControlType): + * html/MonthInputType.h: Added. + (WebCore::MonthInputType::MonthInputType): + * html/NumberInputType.cpp: Added. + (WebCore::NumberInputType::create): + (WebCore::NumberInputType::formControlType): + * html/NumberInputType.h: Added. + (WebCore::NumberInputType::NumberInputType): + * html/PasswordInputType.cpp: Added. + (WebCore::PasswordInputType::create): + (WebCore::PasswordInputType::formControlType): + * html/PasswordInputType.h: Added. + (WebCore::PasswordInputType::PasswordInputType): + * html/RadioInputType.cpp: Added. + (WebCore::RadioInputType::create): + (WebCore::RadioInputType::formControlType): + * html/RadioInputType.h: Added. + (WebCore::RadioInputType::RadioInputType): + * html/RangeInputType.cpp: Added. + (WebCore::RangeInputType::create): + (WebCore::RangeInputType::formControlType): + * html/RangeInputType.h: Added. + (WebCore::RangeInputType::RangeInputType): + * html/ResetInputType.cpp: Added. + (WebCore::ResetInputType::create): + (WebCore::ResetInputType::formControlType): + * html/ResetInputType.h: Added. + (WebCore::ResetInputType::ResetInputType): + * html/SearchInputType.cpp: Added. + (WebCore::SearchInputType::create): + (WebCore::SearchInputType::formControlType): + * html/SearchInputType.h: Added. + (WebCore::SearchInputType::SearchInputType): + * html/SubmitInputType.cpp: Added. + (WebCore::SubmitInputType::create): + (WebCore::SubmitInputType::formControlType): + * html/SubmitInputType.h: Added. + (WebCore::SubmitInputType::SubmitInputType): + * html/TelephoneInputType.cpp: Added. + (WebCore::TelephoneInputType::create): + (WebCore::TelephoneInputType::formControlType): + * html/TelephoneInputType.h: Added. + (WebCore::TelephoneInputType::TelephoneInputType): + * html/TextFieldInputType.cpp: Added. + (WebCore::TextFieldInputType::isTextField): + * html/TextFieldInputType.h: Added. + (WebCore::TextFieldInputType::TextFieldInputType): + * html/TextInputType.cpp: Added. + (WebCore::TextInputType::create): + (WebCore::TextInputType::formControlType): + * html/TextInputType.h: Added. + (WebCore::TextInputType::TextInputType): + * html/TimeInputType.cpp: Added. + (WebCore::TimeInputType::create): + (WebCore::TimeInputType::formControlType): + * html/TimeInputType.h: Added. + (WebCore::TimeInputType::TimeInputType): + * html/URLInputType.cpp: Added. + (WebCore::URLInputType::create): + (WebCore::URLInputType::formControlType): + * html/URLInputType.h: Added. + (WebCore::URLInputType::URLInputType): + * html/WeekInputType.cpp: Added. + (WebCore::WeekInputType::create): + (WebCore::WeekInputType::formControlType): + * html/WeekInputType.h: Added. + (WebCore::WeekInputType::WeekInputType): + +2010-09-28 David Hyatt <hyatt@apple.com> + + Reviewed by Maciej Stachowiak. + + https://bugs.webkit.org/show_bug.cgi?id=46782, rename the top and bottom margin quirk getters/setters. + + Also do a bit of cleanup for block flow roots. Make sure they don't try to propagate overhanging floats out + to ancestors. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlock): + (WebCore::RenderBlock::collapseMargins): + (WebCore::RenderBlock::setCollapsedBottomMargin): + (WebCore::RenderBlock::addOverhangingFloats): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::RenderObject): + * rendering/RenderObject.h: + (WebCore::RenderObject::isMarginBeforeQuirk): + (WebCore::RenderObject::isMarginAfterQuirk): + (WebCore::RenderObject::setMarginBeforeQuirk): + (WebCore::RenderObject::setMarginAfterQuirk): + +2010-09-28 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46780 + + Rename the pos/neg/collapsed margin methods. Rename all the members of the RenderBlockRareData struct. + No logical changes. Just renames. + + * editing/TextIterator.cpp: + (WebCore::shouldEmitExtraNewlineForNode): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::MarginInfo::MarginInfo): + (WebCore::RenderBlock::layoutBlock): + (WebCore::RenderBlock::collapseMargins): + (WebCore::RenderBlock::clearFloatsIfNeeded): + (WebCore::RenderBlock::estimateVerticalPosition): + (WebCore::RenderBlock::setCollapsedBottomMargin): + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::paintChildren): + (WebCore::RenderBlock::lowestPosition): + (WebCore::RenderBlock::setMaxMarginBeforeValues): + (WebCore::RenderBlock::setMaxMarginAfterValues): + (WebCore::RenderBlock::absoluteRects): + (WebCore::RenderBlock::absoluteQuads): + (WebCore::RenderBlock::rectWithOutlineForRepaint): + (WebCore::RenderBlock::addFocusRingRects): + * rendering/RenderBlock.h: + (WebCore::RenderBlock::maxPosMarginBefore): + (WebCore::RenderBlock::maxNegMarginBefore): + (WebCore::RenderBlock::maxPosMarginAfter): + (WebCore::RenderBlock::maxNegMarginAfter): + (WebCore::RenderBlock::initMaxMarginValues): + (WebCore::RenderBlock::maxMarginBefore): + (WebCore::RenderBlock::maxMarginAfter): + (WebCore::RenderBlock::RenderBlockRareData::RenderBlockRareData): + (WebCore::RenderBlock::RenderBlockRareData::beforePosDefault): + (WebCore::RenderBlock::RenderBlockRareData::beforeNegDefault): + (WebCore::RenderBlock::RenderBlockRareData::afterPosDefault): + (WebCore::RenderBlock::RenderBlockRareData::afterNegDefault): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeLogicalHeight): + * rendering/RenderBox.h: + (WebCore::RenderBox::collapsedMarginBefore): + (WebCore::RenderBox::collapsedMarginAfter): + (WebCore::RenderBox::maxMarginBefore): + (WebCore::RenderBox::maxMarginAfter): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutBlock): + +2010-09-28 Kevin Ollivier <kevino@theolliviers.com> + + [wx] wxMSW build fix. Don't use multiple inheritance in PopupMenuWx to avoid debug build + compiler error about ambiguity over which new override (wx's or FastAllocBase's) to use. + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuEventHandler::PopupMenuEventHandler): + (WebCore::PopupMenuEventHandler::OnMenuItemSelected): + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::show): + * platform/wx/PopupMenuWx.h: + +2010-09-28 Xiaomei Ji <xji@chromium.org> + + Reviewed by NOBODY (revert unsquashed git commits) + + Revert change sets 68583 to 68590, which are un-squashed git-commits: Performance improvement for FontLinux regarding issue 46374. + https://bugs.webkit.org/show_bug.cgi?id=46374 + +2010-09-28 Marc-Antoine Ruel <maruel@chromium.org> + + Reviewed by Tony Chang. + + Split webcore_html off webcore_remaining. + + webcore_remaining is still too large for certain 32 bits toolsets. + https://bugs.webkit.org/show_bug.cgi?id=46445 + + * WebCore.gyp/WebCore.gyp: + +2010-09-28 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Delete and forward delete shouldn't start autocorrection panel timer. + https://bugs.webkit.org/show_bug.cgi?id=46679 + <rdar://problem/8463917> + + * editing/TypingCommand.cpp: + (WebCore::TypingCommand::markMisspellingsAfterTyping): Only start correction panel timer + when the editing command is InsertText. + (WebCore::TypingCommand::typingAddedToOpenCommand): Add an argument to pass in command type. + + * editing/TypingCommand.h: Add an argument to typingAddedToOpenCommand(). + +2010-09-28 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Dimitri Glazkov. + + No back/forward list entry added when submitting a form via an onclick handler inside a frame + https://bugs.webkit.org/show_bug.cgi?id=44140 + + Lock the back/forward list for JavaScript form submissions inside frames + only if they're not in response to user gestures. + + Tests: fast/history/form-submit-in-frame-via-onclick.html + fast/history/form-submit-in-frame.html + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleFormSubmission): + +2010-09-28 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + Fix typo in previous checkin. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::MarginInfo::MarginInfo): + +2010-09-28 Nat Duca <nduca@chromium.org> + + Reviewed by James Robinson. + + [chromium] invalidateRootLayerRect needs to schedule compositor + https://bugs.webkit.org/show_bug.cgi?id=46219 + + Update comments on LayerChromium commit/display functions to clarify + their limitations. Remove unused dirtying logic from + LayerRendererChromium. + + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::setNeedsCommit): + (WebCore::LayerChromium::setNeedsDisplay): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::LayerRendererChromium): + (WebCore::LayerRendererChromium::present): + * platform/graphics/chromium/LayerRendererChromium.h: + +2010-09-28 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Added oldPage param to FrameLoaderClient::didTransferChildFrameToNewDocument. + https://bugs.webkit.org/show_bug.cgi?id=46663 + + No new tests. API addition only. Will be used in separate patch. + + * loader/EmptyClients.h: + (WebCore::EmptyFrameLoaderClient::didTransferChildFrameToNewDocument): + * loader/FrameLoaderClient.h: + * page/Frame.cpp: + (WebCore::Frame::transferChildFrameToNewDocument): + Pass former page to didTransferChildFrameToNewDocument. + +2010-09-28 W. James MacLean <wjmaclean@chromium.org> + + Reviewed by James Robinson. + + Scaled Resized images are blurred when sent to Skia + https://bugs.webkit.org/show_bug.cgi?id=42370 + + This patch modifies ImageSkia.cpp to fix the calculation of resampled + bitmap sizes so as to include the transform matrix of the canvas. + + Test: svg/custom/image-rescale.svg + + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::computeResamplingMode): + (WebCore::drawResampledBitmap): + +2010-09-28 James Robinson <jamesr@chromium.org> + + [chromium] Decrease warning level on chromium linux temporarily. This is causing failures on some bots + + * WebCore.gyp/WebCore.gyp: + +2010-09-27 James Robinson <jamesr@chromium.org> + + Reviewed by Tony Chang. + + [chromium] Increase warning level for chromium linux build + https://bugs.webkit.org/show_bug.cgi?id=46687 + + This sets the chromium_code gyp variable to 1 for the chromium + linux WebCore build and fixes the warnings that exposes. This + matches the chromium mac build's compiler settings more closely + and should cut down on the number of patches that break mac but + compile cleaning on linux. + + * WebCore.gyp/WebCore.gyp: + * platform/chromium/ScrollbarThemeChromiumLinux.cpp: + (WebCore::ScrollbarThemeChromiumLinux::paintButton): + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::TextRunWalker::nextScriptRun): + (WebCore::TextRunWalker::getTextRun): + (WebCore::TextRunWalker::getNormalizedTextRun): + (WebCore::TextRunWalker::setGlyphXPositions): + (WebCore::glyphIndexForXPositionInScriptRun): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/chromium/HarfbuzzSkia.cpp: + (WebCore::getOutlinePoint): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::updateRootLayerTextureRect): + * platform/graphics/gpu/Texture.cpp: + (WebCore::copySubRect): + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::readbackHardwareToSoftware): + * platform/image-decoders/gif/GIFImageDecoder.cpp: + (WebCore::GIFImageDecoder::setSize): + * platform/image-decoders/gif/GIFImageDecoder.h: + +2010-09-28 Stephen White <senorblanco@chromium.org> + + Reviewed by Csaba Osztrogonác. + + Fix for r68521 to build on VS2008/Release. + + * html/DocTypeStrings.gperf: + Don't emit "#include <string.h>" here, since we're inside a namespace. + * make-hash-tools.pl: + Emit #include <string.h> manually where required. + * platform/ColorData.gperf: + Don't emit "#include <string.h>" here, since we're inside a namespace. + +2010-09-28 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + Right now we have two properties named margin-top-collapse and margin-after-collapse. They are proprietary and only used by Safari RSS. + + I am adding margin-before-collapse and margin-after-collapse and just aliasing the old properties to the new ones. + This way we have some names that are directionally independent. + + Note that these properties aren't like other directional properties. They are about what to do with the before side and after side of + your block's margins when collapsing with adjacent blocks. The meaning of before/after depend on the block-flow directionality + of the containing block. + + Computed style tests all changed and the remove-shorthand.html test covers manipulation of the shorthand. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + * css/CSSPropertyLonghand.cpp: + (WebCore::initShorthandMap): + * css/CSSPropertyNames.in: + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::MarginInfo::MarginInfo): + (WebCore::RenderBlock::isSelfCollapsingBlock): + (WebCore::RenderBlock::collapseMargins): + (WebCore::RenderBlock::layoutBlockChild): + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::diff): + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::marginBeforeCollapse): + (WebCore::InheritedFlags::marginAfterCollapse): + (WebCore::InheritedFlags::setMarginBeforeCollapse): + (WebCore::InheritedFlags::setMarginAfterCollapse): + (WebCore::InheritedFlags::initialMarginBeforeCollapse): + (WebCore::InheritedFlags::initialMarginAfterCollapse): + * rendering/style/StyleRareNonInheritedData.cpp: + (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): + (WebCore::StyleRareNonInheritedData::operator==): + * rendering/style/StyleRareNonInheritedData.h: + +2010-09-28 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [Cairo] FreeType fonts should obey FontConfig hinting/anti-aliasing settings + https://bugs.webkit.org/show_bug.cgi?id=46740 + + When creating a font from a FontConfig pattern, use the FontConfig pattern's + hinting and anti-aliasing settings. This follows the Chromium Linux approach + of having FontConfig settings take precedence over GTK+ settings, as GTK+ + settings cannot be configured per-font and per-font-size. + + Test: platform/gtk/fonts/fontconfig-aliasing-settings.html + + * platform/graphics/cairo/FontPlatformDataFreeType.cpp: + (WebCore::convertFontConfigSubpixelOrder): Added this helper which converts + the FontConfig subpixel order into the cairo equivalent. + (WebCore::convertFontConfigHintStyle): Added this helper which converts the + FontConfig hint style into the cairo equivalent. + (WebCore::setCairoFontOptionsFromFontConfigPattern): Added this helper which + reads the font rendering settings from a pattern and translates them into the + appropriate cairo_font_options_t settings. + (WebCore::FontPlatformData::FontPlatformData): When creating a font from a + FontConfig pattern use setCairoFontOptionsFromFontConfigPattern to get the + appropriate rendering options for the font. + +2010-09-28 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler and Dave Hyatt. + + Vertical scroll bar on apple.com is too short with WebKit2 + <rdar://problem/8379230> + https://bugs.webkit.org/show_bug.cgi?id=46739 + + Adds a function to recalculate the scrollbars to take advantage of + a changed window re-sizer rect. + + * WebCore.exp.in: + * platform/ScrollView.cpp: + (WebCore::ScrollView::windowResizerRectChanged): + * platform/ScrollView.h: + +2010-09-28 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46750 + + Rename the MarginInfo members and functions to be block-flow independent. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::MarginInfo::MarginInfo): + (WebCore::RenderBlock::adjustPositionedBlock): + (WebCore::RenderBlock::adjustFloatingBlock): + (WebCore::RenderBlock::collapseMargins): + (WebCore::RenderBlock::clearFloatsIfNeeded): + (WebCore::RenderBlock::estimateVerticalPosition): + (WebCore::RenderBlock::setCollapsedBottomMargin): + (WebCore::RenderBlock::handleBottomOfBlock): + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::applyAfterBreak): + * rendering/RenderBlock.h: + (WebCore::RenderBlock::MarginInfo::setAtBeforeSideOfBlock): + (WebCore::RenderBlock::MarginInfo::setAtAfterSideOfBlock): + (WebCore::RenderBlock::MarginInfo::setMarginBeforeQuirk): + (WebCore::RenderBlock::MarginInfo::setMarginAfterQuirk): + (WebCore::RenderBlock::MarginInfo::setDeterminedMarginBeforeQuirk): + (WebCore::RenderBlock::MarginInfo::atBeforeSideOfBlock): + (WebCore::RenderBlock::MarginInfo::canCollapseWithMarginBefore): + (WebCore::RenderBlock::MarginInfo::canCollapseWithMarginAfter): + (WebCore::RenderBlock::MarginInfo::canCollapseMarginBeforeWithChildren): + (WebCore::RenderBlock::MarginInfo::canCollapseMarginAfterWithChildren): + (WebCore::RenderBlock::MarginInfo::determinedMarginBeforeQuirk): + (WebCore::RenderBlock::MarginInfo::marginBeforeQuirk): + (WebCore::RenderBlock::MarginInfo::marginAfterQuirk): + +2010-09-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + Improved the handling of soft hyphens in Copy and Find operations, addressing the following + bugs: + + <rdar://problem/7938878> Soft hyphenation and the clipboard + https://bugs.webkit.org/show_bug.cgi?id=11154 + + window.getSelection().toString() breaks soft hyphen ­ + https://bugs.webkit.org/show_bug.cgi?id=26774 + + <rdar://problem/5640505> soft hyphen breaks search function + https://bugs.webkit.org/show_bug.cgi?id=16675 + + Test: fast/text/find-soft-hyphen.html + + Changed line layout code to not skip over soft hyphens but rather include them in the text + boxes. Changed font code to render the soft hyphen character as a zero width space, so that + the former change will not affect rendering of soft hyphens in the middle of the line. Also + changed line layout code to mark text boxes where hyphenation occurred due to a soft hyphen + as hyphenated, so that the hyphen string specified in CSS will be appended to them. + + Not omitting the soft hyphens from the text boxes makes the text iterator emit them, which + solves the Copy and plain-text conversion issues. Previously, the iterator would emit a space + to account for non-rendered characters between adjacent boxes, which was wrong in this case. + + To make Find work, soft hyphens are folded into 0, which is ignorable in the collation used + for Find. + + * editing/TextIterator.cpp: + (WebCore::foldQuoteMarkOrSoftHyphen): Renamed foldQuoteMark() to this and added folding of + soft hyphen to 0. + (WebCore::foldQuoteMarksAndSoftHyphens): Renamed foldQuoteMarks() to thid and added folding + of soft hyphen to 0. + (WebCore::SearchBuffer::SearchBuffer): Updated for renames. + (WebCore::SearchBuffer::append): Ditto. + * platform/graphics/Font.h: + (WebCore::Font::treatAsSpace): Replaced number literal with name. + (WebCore::Font::treatAsZeroWidthSpace): Added softHyphen. + * platform/graphics/GlyphPageTreeNode.cpp: + (WebCore::GlyphPageTreeNode::initializePage): Get the zero width space glyph for soft hyphen. + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::collectComplexTextRuns): Removed special handling that made + a trailing soft hyphen render as hyphen-minus. All soft hyphens are now rendered as zero width + spaces, and where a line break actually occurs at a soft hyphen, rendering code appends the + CSS-specified hyphenate character to the text run that is passed to us here. + * rendering/RenderBlockLineLayout.cpp: + (WebCore::chopMidpointsAt): Removed this function, which was only used for skipping over soft + hyphens. + (WebCore::checkMidpoints): Removed code related to skipping over soft hyphens. + (WebCore::RenderBlock::findNextLineBreak): Removed code to skip over soft hyphens. Ignore + a line break opportunity at a soft hyphen if the style specifies 'hyphens: none'. Set + 'hyphenated' to true if a line break occurs at a soft hyphen. + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::hyphenString): Changed the assertion to allow querying for the hyphen + string for 'hyphens: manual'. + +2010-09-28 Martin Robinson <mrobinson@igalia.com> + + More GTK+ build fixes after r68521. + + * GNUmakefile.am: Added proper dependency tracking for some + new autogenerated files. + +2010-09-28 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Text drawing taints GraphicsContext's QPainter::pen() + https://bugs.webkit.org/show_bug.cgi?id=46744 + + Test: fast/canvas/canvas-style-intact-after-text.html + + * platform/graphics/qt/FontQt.cpp: + (WebCore::drawTextCommon): Make sure the QPainter's pen is + restored after filling and/or stroking text. + +2010-09-28 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Autocorrection panel is shown at incorrect location when WebView is scrolled. + https://bugs.webkit.org/show_bug.cgi?id=46531 + <rdar://problem/8455376> + + * dom/Range.h: Make getBorderAndTextQuads() public so that it can be used by Editor. + * editing/Editor.cpp: + (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Replaced call to textQuads() + with getBorderAndTextQuads(). + +2010-09-28 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + IDBRequest should not have a method called abort. + https://bugs.webkit.org/show_bug.cgi?id=46720 + + IDBRequest::abort() was dropped from the spec following discussion in + http://www.w3.org/Bugs/Public/show_bug.cgi?id=10165 + + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::IDBRequest): + (WebCore::IDBRequest::~IDBRequest): + (WebCore::IDBRequest::resetReadyState): + (WebCore::IDBRequest::timerFired): + (WebCore::IDBRequest::scheduleEvent): + * storage/IDBRequest.h: + * storage/IDBRequest.idl: + +2010-09-28 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + CrashTracer: 1,382 crashes in Safari at com.apple.WebCore: WebCore::VisiblePosition::canonicalPosition + 78 + https://bugs.webkit.org/show_bug.cgi?id=45927 + + AXTextMarkers store pointers to Nodes without any retain or reference. If a Node is deallocated and then + a client tries to use a text marker that references that node, it leads to this crash. + + The AXObjectCache instance now keeps a HashSet of Node's being used. When a node becomes deallocated, it removes itself + from the HashSet. When creating a VisiblePosition from an AXTextMarker, the cache can then check if the node is valid + before proceeding. + + Test: platform/mac/accessibility/crash-invalid-text-marker-node.html + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::visiblePositionForTextMarkerData): + (WebCore::AXObjectCache::textMarkerDataForVisiblePosition): + Modify to check whether a node is valid before proceeeding. + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::setNodeInUse): + (WebCore::AXObjectCache::removeNodeForUse): + (WebCore::AXObjectCache::isNodeInUse): + Methods for managing whether a node is in use by text markers. + * accessibility/mac/AccessibilityObjectWrapper.mm: + (textMarkerForVisiblePosition): + (-[AccessibilityObjectWrapper textMarkerForVisiblePosition:]): + (visiblePositionForTextMarker): + (-[AccessibilityObjectWrapper visiblePositionForTextMarker:]): + (visiblePositionForStartOfTextMarkerRange): + (visiblePositionForEndOfTextMarkerRange): + (-[AccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): + (textMarkerRangeFromVisiblePositions): + (-[AccessibilityObjectWrapper textMarkerRangeFromVisiblePositions:endPosition:]): + (-[AccessibilityObjectWrapper visiblePositionRangeForTextMarkerRange:]): + (-[AccessibilityObjectWrapper textMarkerRangeForSelection]): + (-[AccessibilityObjectWrapper accessibilityAttributeValue:]): + (-[AccessibilityObjectWrapper doAXAttributedStringForRange:]): + (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): + Change these calls so that the axObjectCache() can be passed in to create the visible position. + * dom/Document.cpp: + (WebCore::Document::axObjectCacheExists): + * dom/Document.h: + * dom/Node.cpp: + (WebCore::Node::~Node): + If accessibility is enabled, inform the axObjectCache() that this node is disappearing. + +2010-09-28 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Add AudioDestinationNode files + https://bugs.webkit.org/show_bug.cgi?id=45009 + + No new tests since audio API is not yet implemented. + + * webaudio/AudioDestinationNode.cpp: Added. + (WebCore::AudioDestinationNode::AudioDestinationNode): + (WebCore::AudioDestinationNode::~AudioDestinationNode): + (WebCore::AudioDestinationNode::initialize): + (WebCore::AudioDestinationNode::uninitialize): + (WebCore::AudioDestinationNode::provideInput): + * webaudio/AudioDestinationNode.h: Added. + (WebCore::AudioDestinationNode::create): + (WebCore::AudioDestinationNode::process): + (WebCore::AudioDestinationNode::reset): + (WebCore::AudioDestinationNode::currentTime): + (WebCore::AudioDestinationNode::sampleRate): + (WebCore::AudioDestinationNode::numberOfChannels): + * webaudio/AudioDestinationNode.idl: Added. + +2010-09-28 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + audio engine: audio output classes + https://bugs.webkit.org/show_bug.cgi?id=34716 + + No new tests since audio API is not yet implemented. + + * platform/audio/AudioDestination.h: Added. + (WebCore::AudioDestination::~AudioDestination): + * platform/audio/mac/AudioDestinationMac.cpp: Added. + (WebCore::AudioDestination::create): + (WebCore::AudioDestination::hardwareSampleRate): + (WebCore::AudioDestinationMac::AudioDestinationMac): + (WebCore::AudioDestinationMac::~AudioDestinationMac): + (WebCore::AudioDestinationMac::configure): + (WebCore::AudioDestinationMac::start): + (WebCore::AudioDestinationMac::stop): + (WebCore::AudioDestinationMac::render): + (WebCore::AudioDestinationMac::inputProc): + * platform/audio/mac/AudioDestinationMac.h: Added. + (WebCore::AudioDestinationMac::isPlaying): + (WebCore::AudioDestinationMac::sampleRate): + +2010-09-28 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Add AudioGain files + https://bugs.webkit.org/show_bug.cgi?id=46285 + + No new tests since audio API is not yet implemented. + + * webaudio/AudioGain.h: Added. + (WebCore::AudioGain::create): + (WebCore::AudioGain::AudioGain): + * webaudio/AudioGain.idl: Added. + +2010-09-28 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Fix possible illegal float values in AudioParam + https://bugs.webkit.org/show_bug.cgi?id=46681 + + No new tests since audio API is not yet implemented. + + * webaudio/AudioParam.h: + (WebCore::AudioParam::setValue): + +2010-09-28 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Rename member variable in MediaPlayerPrivateQt + + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + * platform/graphics/qt/MediaPlayerPrivateQt.h: + +2010-09-28 Andras Becsi <abecsi@webkit.org> + + [Gtk] Build fix. Remove leftover trailing backslash. + + * GNUmakefile.am: + +2010-09-28 Andras Becsi <abecsi@webkit.org> + + Unreviewed. + + [Gtk] Build fix after r68521 + + No new tests needed. + + * GNUmakefile.am: + +2010-09-28 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Rename MediaPlayerPrivate to MediaPlayerPrivateQt/Phonon + + https://bugs.webkit.org/show_bug.cgi?id=36663 + + * platform/graphics/MediaPlayer.cpp: + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + * platform/graphics/qt/MediaPlayerPrivateQt.h: + * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp: + * platform/graphics/qt/MediaPlayerPrivatePhonon.h: + +2010-09-28 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + Undefined reference errors when linking due to gperf and inlining. + webkit.org/b/29244 + + EFL CMake changes by Leandro Pereira <leandro@profusion.mobi> + + Refactor gperf code generation and usage to fix the debug build with gcc>4.4. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore + to access the functionality provided. This resulted in debug build failure with newer gcc versions + because of a behaviour change of gcc, which disables C style inlining in debug mode. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled + in their own compilation unit. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need + for multiple inclusions of generated C files to access these functions. + + No new tests needed. + + * CMakeLists.txt: + * WebCore.gyp/WebCore.gyp: + * WebCore.pri: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSParser.cpp: + * css/makeprop.pl: + * css/makevalues.pl: + * html/DocTypeStrings.gperf: + * html/HTMLDocument.cpp: + * make-hash-tools.pl: + * platform/ColorData.gperf: + * platform/graphics/Color.cpp: + +2010-09-28 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Canvas: Crash when setting a font with size in 'ex' units + https://bugs.webkit.org/show_bug.cgi?id=46538 + + update() the style's font after setting the style's font description. + Needed because CSSPrimitiveValue::computeLengthDouble() later assumes + that the style's font is properly initialized (for xHeight().) + + Fixes crash on IE test center's canvas-text-font-002 test. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setFont): + +2010-09-28 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove support for Qt 4.5 + https://bugs.webkit.org/show_bug.cgi?id=46718 + + Remove the code for versions of Qt prior to 4.6. + + * WebCore.pro: + * features.pri: + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::start): + * platform/network/qt/ResourceRequestQt.cpp: + (WebCore::ResourceRequest::toNetworkRequest): + * platform/qt/QWebPageClient.h: + +2010-09-28 Kent Tamura <tkent@chromium.org> + + Unreviewed, run sort-Xcode-project-file + + * WebCore.xcodeproj/project.pbxproj: + +2010-09-28 Huahui Wu <mediadependent@gmail.com> + + Reviewed by Steve Block. + + Add multi-touch for Android. + https://bugs.webkit.org/show_bug.cgi?id=45221 + + The Android touch event used to take one point as the touch point, + it's now changed to a vector of points to support multi-touch. + + Tests: fast/events/touch/basic-multi-touch-events-limited.html + fast/events/touch/touch-target-limited.html + + * platform/PlatformTouchEvent.h: + * platform/PlatformTouchPoint.h: + * platform/android/PlatformTouchEventAndroid.cpp: + (WebCore::PlatformTouchEvent::PlatformTouchEvent): + * platform/android/PlatformTouchPointAndroid.cpp: + (WebCore::PlatformTouchPoint::PlatformTouchPoint): + +2010-09-27 Kent Tamura <tkent@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Fix assertion failure in a case that the dirty flag of a textarea element is changed + https://bugs.webkit.org/show_bug.cgi?id=45681 + + We need to call setNeedsValidityCheck() after updating m_isDirty. + + Test: fast/forms/textarea-checkValidity-crash.html + + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::setValue): + (WebCore::HTMLTextAreaElement::setNonDirtyValue): + (WebCore::HTMLTextAreaElement::setValueCommon): + * html/HTMLTextAreaElement.h: + +2010-09-27 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dan Bernstein. + + When the block RunIn is destroyed, its line box tree is not deleted. As a result, it + gets later used during dirtying of inline text boxes step where this deleted parent is + accessed. The fix is to delete the line box tree before destroying the runin block. + + https://bugs.webkit.org/show_bug.cgi?id=46376 + + Test: fast/text/dirty-inline-textbox-crash.html + + * rendering/RenderText.cpp: + (WebCore::RenderText::dirtyLineBoxes): + +2010-09-27 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Fix event sequencing in FileWriter + https://bugs.webkit.org/show_bug.cgi?id=46544 + + Only set readyState to DONE when we're about to send the last progress + event associated with an operation. Make sure all progress events come + from backend calls, and aren't ever fired synchronously in response to + user JS method calls. + + No new tests, as none of this is fully implemented yet. + + * fileapi/FileWriter.cpp: + (WebCore::FileWriter::write): + (WebCore::FileWriter::truncate): + (WebCore::FileWriter::abort): + (WebCore::FileWriter::didWrite): + (WebCore::FileWriter::didTruncate): + (WebCore::FileWriter::didFail): + +2010-09-27 Chris Rogers <crogers@google.com> + + Reviewed by James Robinson. + + Add HRTFDatabase files + https://bugs.webkit.org/show_bug.cgi?id=46233 + + No new tests since audio API is not yet implemented. + + * platform/audio/HRTFDatabase.cpp: Added. + (WebCore::HRTFDatabase::create): + (WebCore::HRTFDatabase::HRTFDatabase): + (WebCore::HRTFDatabase::getKernelsFromAzimuthElevation): + (WebCore::HRTFDatabase::indexFromElevationAngle): + * platform/audio/HRTFDatabase.h: Added. + (WebCore::HRTFDatabase::numberOfAzimuths): + (WebCore::HRTFDatabase::sampleRate): + +2010-09-27 Alpha Lam <hclam@chromium.org> + + Build fix. Not reviewed. + + Move constant definitions to VideoLayerChromium.cpp. + A proper fix should come later. + + * platform/graphics/chromium/VideoLayerChromium.cpp: + +2010-09-23 Antonio Gomes <agomes@rim.com> + + Reviewed by Kenneth Rohde Christiansen. + + Make Document::nodesFromRect more flexible + https://bugs.webkit.org/show_bug.cgi?id=46336 + + The patch changes the API for the Document::nodesFromRect() method as follows: + + from + - RefPtf<NodeList> nodesFromRect(int x, int y, unsigned horizontalPadding, unsigned verticalPadding, bool ignoreClipping) + to + - RefPtf<NodeList> nodesFromRect(int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, + unsigned leftPadding, bool ignoreClipping) + + Previously the method was receiving as parameter horizontal and vertical padding values. + In practice, the horizontal padding was being used to expand a given center point in both + right and left directions, while vertical padding was expanding it to the top and bottom directions. + + Although this design makes it possible to improve the touch experience on mobile devices + (Document::nodesFromRect exposes the rect based hit testing system), empirical experiments + showed that, specially in capacitive touch screens, users tend to tap below elements. So + for even more accurate results (which means here the possibility of pleasant tapping experience), + it makes sense to use a region that is offset more above the touch point, favoring elements + above the touch point. + + The patch basically implements that, increasing the API flexible and power by making it possible + to specify different padding values for each direction in a given orientation. + + Changes were made accordingly to the HitTestResult, RenderLayer, RenderImage and RenderLineBoxList + classes. + + WebCore: + + * WebCore.exp.in: + * dom/Document.h: API adjustment. + * dom/Document.idl: Ditto. + * dom/Document.cpp: API adjustment and method body implementation accordingly. + (WebCore::Document::nodesFromRect): + * page/EventHandler.cpp: + (WebCore::EventHandler::hitTestResultAtPoint): For simplicity, I did not change the signature + but the way the padding value passed in as parameter is being used to construct a HitTestResult. + * rendering/HitTestResult.cpp: Changed the rect-based bits from using IntSize (padding) to separated paddings for each direction. + (WebCore::HitTestResult::HitTestResult): Ditto. + (WebCore::HitTestResult::operator=): Ditto. + (WebCore::HitTestResult::rectFromPoint): Ditto. + * rendering/HitTestResult.h: + (WebCore::HitTestResult::topPadding): getter for the top padding. + (WebCore::HitTestResult::rightPadding): getter for the right padding. + (WebCore::HitTestResult::bottomPadding): getter for the bottom padding. + (WebCore::HitTestResult::leftPadding): getter for the left padding. + (WebCore::HitTestResult::rectFromPoint): Added a static method that given a center point and padding values for each direction, + returns the rect that is going to be used in WebCore's hit testing processing. + * rendering/RenderImage.cpp: Changed the rect-based bits from using IntSize (padding) to separated paddings for each direction. + (WebCore::RenderImage::nodeAtPoint): Ditto. + * rendering/RenderLayer.cpp: Ditto. + (WebCore::RenderLayer::hitTestLayer): Ditto. + (WebCore::RenderLayer::hitTestList): Ditto. + * rendering/RenderLineBoxList.cpp: Ditto. + (WebCore::RenderLineBoxList::hitTest): Ditto. + +2010-09-27 Chris Rogers <crogers@google.com> + + Reviewed by James Robinson. + + Add HRTFDatabaseLoader files + https://bugs.webkit.org/show_bug.cgi?id=46234 + + No new tests since audio API is not yet implemented. + + * platform/audio/HRTFDatabaseLoader.cpp: Added. + (WebCore::HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary): + (WebCore::HRTFDatabaseLoader::HRTFDatabaseLoader): + (WebCore::HRTFDatabaseLoader::~HRTFDatabaseLoader): + (WebCore::databaseLoaderEntry): + (WebCore::HRTFDatabaseLoader::load): + (WebCore::HRTFDatabaseLoader::loadAsynchronously): + (WebCore::HRTFDatabaseLoader::isLoaded): + (WebCore::HRTFDatabaseLoader::defaultHRTFDatabase): + * platform/audio/HRTFDatabaseLoader.h: Added. + (WebCore::HRTFDatabaseLoader::database): + (WebCore::HRTFDatabaseLoader::databaseSampleRate): + +2010-09-27 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Darin Adler. + + queryCommandState with justifyCenter, justifyLeft, and justifyRight always return false + https://bugs.webkit.org/show_bug.cgi?id=45910 + + Implemented queryCommandState for justifyCenter, justifyLeft, and justifyRight commands. + Added getTextAlignment to convert -webkit-center, -webkit-left, and -webkit-right to + center, left, and right respectively because they can be treated equally for editing purposes. + + Test: editing/execCommand/query-text-alignment.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::getTextAlignment): Added. + (WebCore::getPropertiesNotIn): Uses getTextAlignment. + * editing/EditorCommand.cpp: + (WebCore::stateJustifyCenter): Added. + (WebCore::stateJustifyLeft): Added. + (WebCore::stateJustifyRight): Added. + (WebCore::createCommandMap): Refers to stateJustifyCenter, stateJustifyLeft, and stateJustifyRight. + +2010-09-27 Alpha Lam <hclam@chromium.org> + + Unreviewed. Build fix. + + Reorder member declarations and fix other warnings. + + * platform/graphics/chromium/VideoLayerChromium.cpp: + (WebCore::VideoLayerChromium::VideoLayerChromium): + (WebCore::VideoLayerChromium::~VideoLayerChromium): + (WebCore::VideoLayerChromium::updateContents): + (WebCore::VideoLayerChromium::determineTextureFormat): + (WebCore::VideoLayerChromium::allocateTexturesIfNeeded): + * platform/graphics/chromium/VideoLayerChromium.h: + +2010-09-27 Kenneth Russell <kbr@google.com> + + Unreviewed, Qt build fix. Stub out CanvasRenderingContext::checkOrigin(const HTMLVideoElement*) + on platforms that don't support video after r68460. + + * html/canvas/CanvasRenderingContext.cpp: + (WebCore::CanvasRenderingContext::checkOrigin): + +2010-09-27 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + CrashTracer: 1,803 crashes in Safari at com.apple.WebCore: -[AccessibilityObjectWrapper accessibilityIsIgnored] + 56 + https://bugs.webkit.org/show_bug.cgi?id=46662 + + Before calling updateBackingStore(), the wrapper object needs to be retained, lest it be invalidated during + the updateBackingStore call. This consolidates all calls to updateBackingStore(). + + Test: platform/mac/accessibility/removing-textarea-after-edit-crash.html + + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::postPlatformNotification): + Use an ASSERT here to catch the crash because DRT won't cause AppKit to post notifications. + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper prepareAccessibilityMethod]): + (-[AccessibilityObjectWrapper accessibilityActionNames]): + (-[AccessibilityObjectWrapper accessibilityAttributeNames]): + (-[AccessibilityObjectWrapper accessibilityAttributeValue:]): + (-[AccessibilityObjectWrapper accessibilityFocusedUIElement]): + (-[AccessibilityObjectWrapper accessibilityHitTest:]): + (-[AccessibilityObjectWrapper accessibilityIsAttributeSettable:]): + (-[AccessibilityObjectWrapper accessibilityIsIgnored]): + (-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): + (-[AccessibilityObjectWrapper accessibilityPerformPressAction]): + (-[AccessibilityObjectWrapper accessibilityPerformIncrementAction]): + (-[AccessibilityObjectWrapper accessibilityPerformDecrementAction]): + (-[AccessibilityObjectWrapper accessibilityPerformAction:]): + (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]): + (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): + (-[AccessibilityObjectWrapper accessibilityIndexOfChild:]): + (-[AccessibilityObjectWrapper accessibilityArrayAttributeCount:]): + (-[AccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]): + +2010-09-27 Adrienne Walker <enne@google.com> + + Reviewed by Adam Barth. + + WebGL's readPixels doesn't respect origin-clean flag + + Push CanvasRenderingContext2D checkOrigin logic into base class so it can be shared between different kinds of canvas contexts. + https://bugs.webkit.org/show_bug.cgi?id=45718 + + Test: LayoutTests/http/tests/canvas/webgl/origin-clean-conformance.html + + * html/canvas/CanvasRenderingContext.cpp: + (WebCore::CanvasRenderingContext::checkOrigin): + * html/canvas/CanvasRenderingContext.h: + (WebCore::CanvasRenderingContext::~CanvasRenderingContext): + (WebCore::CanvasRenderingContext::canvas): + (WebCore::CanvasRenderingContext::is2d): + (WebCore::CanvasRenderingContext::is3d): + (WebCore::CanvasRenderingContext::isAccelerated): + (WebCore::CanvasRenderingContext::paintRenderingResultsToCanvas): + (WebCore::CanvasRenderingContext::paintsIntoCanvasBuffer): + (WebCore::CanvasRenderingContext::platformLayer): + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setStrokeStyle): + (WebCore::CanvasRenderingContext2D::setFillStyle): + (WebCore::CanvasRenderingContext2D::drawImage): + (WebCore::CanvasRenderingContext2D::drawImageFromRect): + * html/canvas/CanvasRenderingContext2D.h: + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::readPixels): + (WebCore::WebGLRenderingContext::texImage2D): + (WebCore::WebGLRenderingContext::videoFrameToImage): + (WebCore::WebGLRenderingContext::texSubImage2D): + * html/canvas/WebGLRenderingContext.h: + * html/canvas/WebGLRenderingContext.idl: + +2010-09-27 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + REGRESSION (r68054): Buttons no longer render at correct sizes + https://bugs.webkit.org/show_bug.cgi?id=46513 + + Test: fast/forms/input-button-sizes.html + + The setUpButtonCell function was running only once, but needed to run every time + through the button function. + + * platform/mac/ThemeMac.mm: + (WebCore::leakButtonCell): Added. Separate one-time initialization code. + (WebCore::setUpButtonCell): Removed the first-time initialization part of this function. + (WebCore::button): Merged the three functions back into one. + +2010-09-27 Victoria Kirst <vrk@google.com> + + Reviewed by James Robinson. + + Modifies VideoLayerChromium to do YUV to RGB color conversion in the + GPU. Also adds support for RGBA video frame formats, though this code + path is currently never run because the video frames are in YV12 + format. + https://bugs.webkit.org/show_bug.cgi?id=45069 + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::initializeSharedObjects): + (WebCore::LayerRendererChromium::cleanupSharedObjects): + * platform/graphics/chromium/LayerRendererChromium.h: + (WebCore::LayerRendererChromium::videoLayerSharedValues): + * platform/graphics/chromium/VideoLayerChromium.cpp: + (WebCore::VideoLayerChromium::SharedValues::SharedValues): + (WebCore::VideoLayerChromium::SharedValues::~SharedValues): + (WebCore::VideoLayerChromium::VideoLayerChromium): + (WebCore::VideoLayerChromium::~VideoLayerChromium): + (WebCore::VideoLayerChromium::updateContents): + (WebCore::VideoLayerChromium::updateYUVContents): + (WebCore::VideoLayerChromium::allocateYUVTextures): + (WebCore::VideoLayerChromium::updateYUVTextures): + (WebCore::VideoLayerChromium::updateRGBAContents): + (WebCore::VideoLayerChromium::allocateTexture): + (WebCore::VideoLayerChromium::updateTexture): + (WebCore::VideoLayerChromium::updateContentsCompleted): + (WebCore::VideoLayerChromium::draw): + (WebCore::VideoLayerChromium::drawYUV): + (WebCore::VideoLayerChromium::drawRGBA): + * platform/graphics/chromium/VideoLayerChromium.h: + (WebCore::VideoLayerChromium::drawsContent): + (WebCore::VideoLayerChromium::SharedValues::yuvShaderProgram): + (WebCore::VideoLayerChromium::SharedValues::rgbaShaderProgram): + (WebCore::VideoLayerChromium::SharedValues::yuvShaderMatrixLocation): + (WebCore::VideoLayerChromium::SharedValues::rgbaShaderMatrixLocation): + (WebCore::VideoLayerChromium::SharedValues::yuvWidthScaleFactorLocation): + (WebCore::VideoLayerChromium::SharedValues::rgbaWidthScaleFactorLocation): + (WebCore::VideoLayerChromium::SharedValues::yTextureLocation): + (WebCore::VideoLayerChromium::SharedValues::uTextureLocation): + (WebCore::VideoLayerChromium::SharedValues::vTextureLocation): + (WebCore::VideoLayerChromium::SharedValues::yuvAlphaLocation): + (WebCore::VideoLayerChromium::SharedValues::rgbaTextureLocation): + (WebCore::VideoLayerChromium::SharedValues::ccMatrixLocation): + (WebCore::VideoLayerChromium::SharedValues::initialized): + +2010-09-27 Peter Kasting <pkasting@google.com> + + Reviewed by James Robinson. + + ImageDecoderSkia.cpp needs to check for allocator failure when copying + bitmaps. + https://bugs.webkit.org/show_bug.cgi?id=46437 + + * manual-tests/large-size-image-crash.html: Added. + * manual-tests/resources/large-size-image-crash.gif: Added. + * platform/image-decoders/ImageDecoder.cpp: + (WebCore::RGBA32Buffer::copyBitmapData): + * platform/image-decoders/ImageDecoder.h: + * platform/image-decoders/gif/GIFImageDecoder.cpp: + (WebCore::GIFImageDecoder::initFrameBuffer): + * platform/image-decoders/qt/RGBA32BufferQt.cpp: + (WebCore::RGBA32Buffer::copyBitmapData): + * platform/image-decoders/skia/ImageDecoderSkia.cpp: + (WebCore::RGBA32Buffer::copyBitmapData): + +2010-09-27 James Robinson <jamesr@chromium.org> + + Reviewed by Simon Fraser. + + Revert r63307, it broke repainting dynamically changed SVG content + https://bugs.webkit.org/show_bug.cgi?id=46499 + + This patch reverts r63307 and adds a regression test for what broke. + + Test: fast/repaint/repaint-svg-after-style-change.html + + * rendering/RenderForeignObject.cpp: + (WebCore::RenderForeignObject::layout): + * rendering/RenderPath.cpp: + (WebCore::RenderPath::layout): + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::layout): + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::layout): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::layout): + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::layout): + +2010-09-27 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by James Robinson. + + [chromium] Making LayerChromium's destructor virtual so that the appropriate + derived class destructors get called when the layer tree is taken down. + ContentLayerChromium and its derived types (ImageLayerChromium for now) will + free up the texture allocated for their contents upon destruction. To avoid + having the LayerRendererChromium destructor getting called before the layers + are destroyed and thus leaving their textures orphaned, the layers now hold + a ref counted pointer to the renderer that uses them. + https://bugs.webkit.org/show_bug.cgi?id=46139 + + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::~ContentLayerChromium): + (WebCore::ContentLayerChromium::setLayerRenderer): + (WebCore::ContentLayerChromium::cleanupResources): + * platform/graphics/chromium/ContentLayerChromium.h: + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::setLayerRenderer): + * platform/graphics/chromium/LayerChromium.h: + (WebCore::LayerChromium::layerRenderer): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::create): + (WebCore::LayerRendererChromium::deleteLayerTexture): + (WebCore::LayerRendererChromium::cleanupSharedObjects): + * platform/graphics/chromium/LayerRendererChromium.h: + +2010-09-27 Erik Arvidsson <arv@chromium.org> + + Reviewed by Darin Adler. + + Implement HTML 5's HTMLElement.classList property + https://bugs.webkit.org/show_bug.cgi?id=20709 + + This adds a DOMTokenList class that is used for the classList property. DOMTokenList uses a SpaceSplitString for fast + contains check. In standards mode the existing classNames is used but in quirks mode we use an internal SpaceSplitString + because classList is always case sensitive. + + Tests: fast/dom/HTMLElement/class-list-gc.html + fast/dom/HTMLElement/class-list-quirks.html + fast/dom/HTMLElement/class-list.html + perf/class-list-remove.html + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.jscbindings.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/gobject/GNUmakefile.am: + * bindings/js/JSElementCustom.cpp: + (WebCore::JSElement::markChildren): Make sure that we keep the wrapper while the element is alive. + * bindings/scripts/CodeGeneratorJS.pm: DOMTokenList has a string indexed getter. + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/custom/V8DOMTokenListCustom.cpp: Added. + (WebCore::toV8): + * dom/Element.cpp: + (WebCore::Element::classList): + (WebCore::Element::optionalClassList): + * dom/Element.h: + * dom/ElementRareData.h: This now has an OwnPtr to a ClassList if the Element::classList is ever called. + * dom/SpaceSplitString.h: + (WebCore::SpaceSplitString::isNull): + * dom/StyledElement.cpp: + (WebCore::StyledElement::classAttributeChanged): Update the classList if it exists. + * dom/StyledElement.h: + * html/DOMTokenList.cpp: Added. + (WebCore::validateToken): + (WebCore::DOMTokenList::DOMTokenList): + (WebCore::DOMTokenList::ref): + (WebCore::DOMTokenList::deref): + (WebCore::DOMTokenList::length): + (WebCore::DOMTokenList::item): + (WebCore::DOMTokenList::contains): + (WebCore::DOMTokenList::containsInternal): The internal methods do no validation of the token. + (WebCore::DOMTokenList::add): + (WebCore::DOMTokenList::addInternal): + (WebCore::DOMTokenList::remove): + (WebCore::DOMTokenList::removeInternal): + (WebCore::DOMTokenList::toggle): + (WebCore::DOMTokenList::toString): + (WebCore::DOMTokenList::reset): + (WebCore::DOMTokenList::classNames): + * html/DOMTokenList.h: Added. + (WebCore::DOMTokenList::create): + (WebCore::DOMTokenList::element): + * html/DOMTokenList.idl: Added. + * html/HTMLElement.idl: + * page/DOMWindow.cpp: + * page/DOMWindow.idl: + +2010-09-27 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + Add local triangulation of cubic curve control points + https://bugs.webkit.org/show_bug.cgi?id=45252 + + (Re-landing; I neglected to actually add the new files in + http://trac.webkit.org/changeset/68045 .) + + Adding a localized triangulation algorithm which takes as input + the four control points of a cubic curve segment and provides both + triangles as well as the ability to walk the interior edges. The + latter will be used later to fill the interior of shapes bounded + by these cubic curves, quadratic curves and line segments. + + * platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp: Added. + (WebCore::LoopBlinnLocalTriangulator::Triangle::contains): + (WebCore::LoopBlinnLocalTriangulator::Triangle::nextVertex): + (WebCore::LoopBlinnLocalTriangulator::Triangle::indexForVertex): + (WebCore::LoopBlinnLocalTriangulator::Triangle::makeCounterClockwise): + (WebCore::LoopBlinnLocalTriangulator::LoopBlinnLocalTriangulator): + (WebCore::LoopBlinnLocalTriangulator::reset): + (WebCore::LoopBlinnLocalTriangulator::triangulate): + (WebCore::LoopBlinnLocalTriangulator::triangulateHelper): + (WebCore::LoopBlinnLocalTriangulator::addTriangle): + (WebCore::LoopBlinnLocalTriangulator::addInteriorVertex): + (WebCore::LoopBlinnLocalTriangulator::isSharedEdge): + * platform/graphics/gpu/LoopBlinnLocalTriangulator.h: Added. + (WebCore::LoopBlinnLocalTriangulator::Vertex::Vertex): + (WebCore::LoopBlinnLocalTriangulator::Vertex::xyCoordinates): + (WebCore::LoopBlinnLocalTriangulator::Vertex::klmCoordinates): + (WebCore::LoopBlinnLocalTriangulator::Vertex::set): + (WebCore::LoopBlinnLocalTriangulator::Vertex::end): + (WebCore::LoopBlinnLocalTriangulator::Vertex::setEnd): + (WebCore::LoopBlinnLocalTriangulator::Vertex::marked): + (WebCore::LoopBlinnLocalTriangulator::Vertex::setMarked): + (WebCore::LoopBlinnLocalTriangulator::Vertex::interior): + (WebCore::LoopBlinnLocalTriangulator::Vertex::setInterior): + (WebCore::LoopBlinnLocalTriangulator::Vertex::resetFlags): + (WebCore::LoopBlinnLocalTriangulator::Triangle::Triangle): + (WebCore::LoopBlinnLocalTriangulator::Triangle::getVertex): + (WebCore::LoopBlinnLocalTriangulator::Triangle::setVertices): + (WebCore::LoopBlinnLocalTriangulator::getVertex): + (WebCore::LoopBlinnLocalTriangulator::numberOfTriangles): + (WebCore::LoopBlinnLocalTriangulator::getTriangle): + (WebCore::LoopBlinnLocalTriangulator::numberOfInteriorVertices): + (WebCore::LoopBlinnLocalTriangulator::getInteriorVertex): + +2010-09-27 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Add AudioNode files + https://bugs.webkit.org/show_bug.cgi?id=45571 + + No new tests since audio API is not yet implemented. + + * webaudio/AudioNode.cpp: Added. + (WebCore::AudioNode::AudioNode): + (WebCore::AudioNode::~AudioNode): + (WebCore::AudioNode::setType): + (WebCore::AudioNode::lazyInitialize): + (WebCore::AudioNode::addInput): + (WebCore::AudioNode::addOutput): + (WebCore::AudioNode::input): + (WebCore::AudioNode::output): + (WebCore::AudioNode::connect): + (WebCore::AudioNode::disconnect): + (WebCore::AudioNode::processIfNecessary): + (WebCore::AudioNode::pullInputs): + (WebCore::AudioNode::ref): + (WebCore::AudioNode::deref): + (WebCore::AudioNode::finishDeref): + (WebCore::AudioNode::printNodeCounts): + * webaudio/AudioNode.h: Added. + (WebCore::AudioNode::context): + (WebCore::AudioNode::type): + (WebCore::AudioNode::isInitialized): + (WebCore::AudioNode::numberOfInputs): + (WebCore::AudioNode::numberOfOutputs): + (WebCore::AudioNode::sampleRate): + (WebCore::AudioNode::checkNumberOfChannelsForInput): + * webaudio/AudioNode.idl: Added. + +2010-09-27 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46665 + + Patch RenderView's layout and computeLogicalWidth/Height methods to be block-flow-aware. + + Added fast/root-lr-basic.html + + * rendering/RenderView.cpp: + (WebCore::RenderView::computeLogicalHeight): + (WebCore::RenderView::computeLogicalWidth): + (WebCore::RenderView::layout): + * rendering/RenderView.h: + (WebCore::RenderView::viewLogicalWidth): + (WebCore::RenderView::viewLogicalHeight): + +2010-09-24 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + Hook up ANGLE with chromium --in-process-webgl port + https://bugs.webkit.org/show_bug.cgi?id=44309 + + * platform/graphics/GraphicsContext3D.h: Move Angle stuff inside MAC only section. + +2010-09-27 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46659 + + Patch the width/height/x/y calls in layoutBlock() to be their logical equivalents instead. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlock): + +2010-09-27 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46649, fix failing layout tests. + + The implementation of setting the before/after margins was wrong and poking the wrong margin values. + + Once I made them set the correct values, it revealed that one of the new block flow tests wasn't + actually working. In order to fix it, I had to make the block direction margin computation actually + use the containing block's block-flow in order to return the right answer. This involved cleaning + up computeBlockDirectionMargins to be more like computeInlineDirectionMargins. + + fast/css/logical-property-resolution.html also caught the bug. Its results are now correct. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::adjustPositionedBlock): + (WebCore::RenderBlock::determineHorizontalPosition): + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::insertFloatingObject): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::setMarginBeforeUsing): + (WebCore::RenderBox::setMarginAfterUsing): + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeInlineDirectionMargins): + (WebCore::RenderBox::computeLogicalHeight): + (WebCore::RenderBox::computeBlockDirectionMargins): + * rendering/RenderBox.h: + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutHorizontalBox): + (WebCore::RenderFlexibleBox::layoutVerticalBox): + * rendering/RenderObject.h: + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + * rendering/RenderTableRow.cpp: + (WebCore::RenderTableRow::layout): + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::marginBeforeUsing): + (WebCore::RenderStyle::marginAfterUsing): + * rendering/style/RenderStyle.h: + +2010-09-14 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + Textures and renderbuffers should be detached first before deletion if they are attached to framebuffers + https://bugs.webkit.org/show_bug.cgi?id=43942 + + Test: fast/canvas/webgl/object-deletion-behaviour.html + + * html/canvas/WebGLBuffer.cpp: + (WebCore::WebGLBuffer::deleteObjectImpl): Delete the object only once. + * html/canvas/WebGLFramebuffer.cpp: Use RefPtr for attachment WebGLObjects. + (WebCore::WebGLFramebuffer::WebGLFramebuffer): + (WebCore::WebGLFramebuffer::removeAttachment): Remove an attachment data ref. + (WebCore::WebGLFramebuffer::onAttachedObjectChange): + (WebCore::WebGLFramebuffer::getColorBufferFormat): + (WebCore::WebGLFramebuffer::deleteObjectImpl): + (WebCore::WebGLFramebuffer::initializeRenderbuffers): + * html/canvas/WebGLFramebuffer.h: Declare removeAttachment(). + * html/canvas/WebGLObject.cpp: + (WebCore::WebGLObject::setObject): Make it protected and can only be called when initializing. + * html/canvas/WebGLObject.h: + (WebCore::WebGLObject::onDetached): Fix a bug. + (WebCore::WebGLObject::isDeleted): Expose the delete flag. + * html/canvas/WebGLProgram.cpp: + (WebCore::WebGLProgram::deleteObjectImpl): Detach shaders when deleting a program. + * html/canvas/WebGLRenderbuffer.cpp: + (WebCore::WebGLRenderbuffer::deleteObjectImpl): Delete the object only once. + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::deleteFramebuffer): Bind to internal fbo when deleting the currently-bound fbo. + (WebCore::WebGLRenderingContext::deleteRenderbuffer): Remove renderbuffer from currently-bound fbo upon deletion. + (WebCore::WebGLRenderingContext::deleteTexture): Remove texture from currently-bound fbo upon deletion. + (WebCore::WebGLRenderingContext::useProgram): Fix a condition. + * html/canvas/WebGLShader.cpp: + (WebCore::WebGLShader::deleteObjectImpl): Delete the object only once. + * html/canvas/WebGLTexture.cpp: + (WebCore::WebGLTexture::deleteObjectImpl): Ditto. + +2010-09-27 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Antonio Gomes. + + stateStyle (@EditorCommand.cpp) should ask EditingBehavior for platform specific behavior + https://bugs.webkit.org/show_bug.cgi?id=41989 + + queryCommandState returns true even when in the mixed state + https://bugs.webkit.org/show_bug.cgi?id=46382 + + Fixed stateStyle so that it calls selectionStartHasStyle when shouldToggleStyleBasedOnStartOfSelection + is true (Mac platforms) and calls selectionHasStyle otherwise (non-Mac platforms). + + Also fixed queryCommandState so that it only returns true when the state is TrueTriState + as supposed to returning true whenever the state is not FalseTriState. New behavior matches that of + other browsers such as Firefox and Internet Explorer. + + * dom/Document.cpp: + (WebCore::Document::queryCommandState): + * editing/EditorCommand.cpp: + (WebCore::executeToggleStyle): + (WebCore::stateStyle): + +2010-09-27 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46647, add getters/setters for the logical position of a box. + + Also made all of the logicalWidth/Height getters/setters inline for performance. + + * rendering/RenderBox.cpp: + * rendering/RenderBox.h: + (WebCore::RenderBox::logicalLeft): + (WebCore::RenderBox::logicalTop): + (WebCore::RenderBox::logicalWidth): + (WebCore::RenderBox::logicalHeight): + (WebCore::RenderBox::setLogicalLeft): + (WebCore::RenderBox::setLogicalTop): + (WebCore::RenderBox::setLogicalWidth): + (WebCore::RenderBox::setLogicalHeight): + (WebCore::RenderBox::setLogicalLocation): + +2010-09-27 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46639, make computeLogicalHeight block-flow-aware. + + This patch does the following: + (1) Makes computeLogicalHeight block-flow-aware (patching all helper functions as needed to make this work). + (2) Makes block flow roots (blocks whose parent has a different block-flow directionality) establish new block formatting contexts. + (This causes them to not collapse their margins with their children and to avoid floats). + (3) Patch all occurrences of setHeight in block and line layout to setLogicalHeight so that height doesn't get incorrectly + overwritten for lr/rl block-flow. This is necessary to write tests that examine the width/height of the blocks. + + Added multiple new tests in fast/blockflow. + fast/css/logical-property-resolution gives the correct results now. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::MarginInfo::MarginInfo): + (WebCore::RenderBlock::layoutBlock): + (WebCore::RenderBlock::expandsToEncloseOverhangingFloats): + (WebCore::RenderBlock::adjustFloatingBlock): + (WebCore::RenderBlock::collapseMargins): + (WebCore::RenderBlock::clearFloatsIfNeeded): + (WebCore::RenderBlock::determineHorizontalPosition): + (WebCore::RenderBlock::handleBottomOfBlock): + (WebCore::RenderBlock::layoutBlockChildren): + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::positionNewFloatOnLine): + (WebCore::RenderBlock::newLine): + (WebCore::RenderBlock::logicalLeftOffsetForLine): + (WebCore::RenderBlock::logicalRightOffsetForContent): + (WebCore::RenderBlock::logicalRightOffsetForLine): + (WebCore::RenderBlock::getClearDelta): + (WebCore::RenderBlock::layoutColumns): + * rendering/RenderBlock.h: + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeBlockDirectionPositionsForLine): + (WebCore::RenderBlock::layoutInlineChildren): + (WebCore::RenderBlock::determineStartPosition): + (WebCore::RenderBlock::fitBelowFloats): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::marginBefore): + (WebCore::RenderBox::marginBeforeUsing): + (WebCore::RenderBox::marginAfter): + (WebCore::RenderBox::marginAfterUsing): + (WebCore::RenderBox::setMarginBefore): + (WebCore::RenderBox::setMarginAfter): + (WebCore::RenderBox::setMarginBeforeUsing): + (WebCore::RenderBox::setMarginAfterUsing): + (WebCore::RenderBox::computeLogicalHeight): + (WebCore::RenderBox::computeLogicalHeightUsing): + (WebCore::RenderBox::computePercentageLogicalHeight): + (WebCore::RenderBox::computeReplacedHeightUsing): + (WebCore::RenderBox::availableLogicalHeight): + (WebCore::RenderBox::availableLogicalHeightUsing): + (WebCore::RenderBox::computeBlockDirectionMargins): + (WebCore::RenderBox::avoidsFloats): + * rendering/RenderBox.h: + (WebCore::RenderBox::contentLogicalWidth): + (WebCore::RenderBox::contentLogicalHeight): + (WebCore::RenderBox::stretchesToViewHeight): + (WebCore::RenderBox::availableLogicalWidth): + (WebCore::RenderBox::availableWidth): + (WebCore::RenderBox::availableHeight): + (WebCore::RenderBox::isBlockFlowRoot): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + +2010-09-27 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [Gtk] Adjust atk_text_get_text_at_offset to account for bullets/numbers in list items + https://bugs.webkit.org/show_bug.cgi?id=45381 + + Ensure list markers are consistently used in the Atk wrapper. + + This patch does two things (both needed to fix the bug): It + improves the way list items markers are exposed through the Atk + Wrapper (by exposing the exact text in the marker, including the + marker suffix, if any) and makes sure the marker is consistently + considered and treated in those methods of the AtkText interface + that would need it (like atk_text_get_character_count or + atk_text_get_run_attributes, for instance). + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (textForObject): + Append/prepend list marker when needed. + (webkit_accessible_text_get_text): + Use the new function markerTextWithSuffix() to expose a more + accurate value. + (accessibilityObjectLength): + Consider list items marker to return the length of an object, + if needed. Also, added some extra checks. + (webkit_accessible_text_get_character_count): + Just delegate on accessibilityObjectLength, to make it + cleaner and more consistent. + + * rendering/RenderListItem.cpp: + (WebCore::RenderListItem::markerTextWithSuffix): + New public function to return a single string with the + marker associated to the item and its suffix, considering + text direction (LTR or RTL). + * rendering/RenderListItem.h: + * rendering/RenderListMarker.cpp: + (WebCore::RenderListMarker::suffix): + New public function to return a String with the suffix + associated to the marker. + * rendering/RenderListMarker.h: + +2010-09-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r68389. + http://trac.webkit.org/changeset/68389 + https://bugs.webkit.org/show_bug.cgi?id=46637 + + test_shell is crashing on chromium Win (Requested by loislo on + #webkit). + + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): + (WebCore::InspectorTimelineAgent::pushGCEventRecords): + (WebCore::InspectorTimelineAgent::didGC): + (WebCore::InspectorTimelineAgent::~InspectorTimelineAgent): + (WebCore::InspectorTimelineAgent::willCallFunction): + (WebCore::InspectorTimelineAgent::didCallFunction): + (WebCore::InspectorTimelineAgent::willDispatchEvent): + (WebCore::InspectorTimelineAgent::didDispatchEvent): + (WebCore::InspectorTimelineAgent::willLayout): + (WebCore::InspectorTimelineAgent::didLayout): + (WebCore::InspectorTimelineAgent::willRecalculateStyle): + (WebCore::InspectorTimelineAgent::didRecalculateStyle): + (WebCore::InspectorTimelineAgent::willPaint): + (WebCore::InspectorTimelineAgent::didPaint): + (WebCore::InspectorTimelineAgent::willWriteHTML): + (WebCore::InspectorTimelineAgent::didWriteHTML): + (WebCore::InspectorTimelineAgent::didInstallTimer): + (WebCore::InspectorTimelineAgent::didRemoveTimer): + (WebCore::InspectorTimelineAgent::willFireTimer): + (WebCore::InspectorTimelineAgent::didFireTimer): + (WebCore::InspectorTimelineAgent::willChangeXHRReadyState): + (WebCore::InspectorTimelineAgent::didChangeXHRReadyState): + (WebCore::InspectorTimelineAgent::willLoadXHR): + (WebCore::InspectorTimelineAgent::didLoadXHR): + (WebCore::InspectorTimelineAgent::willEvaluateScript): + (WebCore::InspectorTimelineAgent::didEvaluateScript): + (WebCore::InspectorTimelineAgent::didScheduleResourceRequest): + (WebCore::InspectorTimelineAgent::willSendResourceRequest): + (WebCore::InspectorTimelineAgent::willReceiveResourceData): + (WebCore::InspectorTimelineAgent::didReceiveResourceData): + (WebCore::InspectorTimelineAgent::willReceiveResourceResponse): + (WebCore::InspectorTimelineAgent::didReceiveResourceResponse): + (WebCore::InspectorTimelineAgent::didFinishLoadingResource): + (WebCore::InspectorTimelineAgent::didMarkTimeline): + (WebCore::InspectorTimelineAgent::didMarkDOMContentEvent): + (WebCore::InspectorTimelineAgent::didMarkLoadEvent): + (WebCore::InspectorTimelineAgent::reset): + (WebCore::InspectorTimelineAgent::resetFrontendProxyObject): + (WebCore::InspectorTimelineAgent::addRecordToTimeline): + (WebCore::InspectorTimelineAgent::setHeapSizeStatistic): + (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): + (WebCore::InspectorTimelineAgent::pushCurrentRecord): + * inspector/InspectorTimelineAgent.h: + (WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry): + (WebCore::InspectorTimelineAgent::GCEvent::GCEvent): + +2010-09-27 Kinuko Yasuda <kinuko@google.com> + + Reviewed by Adam Barth. + + [Cleanup] Add create method to FileSystemCallbacks to get rid of naked new's + https://bugs.webkit.org/show_bug.cgi?id=46561 + + Also cleanup the callbacks layering to pass AsyncFileSystemCallbacks + object to LocalFileSystem::requestFileSystem (rather than + FileSystemCallback and ErrorCallback) so that all the callbacks class + we pass from WebCore to WebKit/chromium/src will be + AsyncFileSystemCallbacks. + + No new tests; this patch is only for cleanup and there should be no functionality changes. + + * fileapi/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::getMetadata): + (WebCore::DOMFileSystem::move): + (WebCore::DOMFileSystem::copy): + (WebCore::DOMFileSystem::remove): + (WebCore::DOMFileSystem::getParent): + (WebCore::DOMFileSystem::getFile): + (WebCore::DOMFileSystem::getDirectory): + (WebCore::DOMFileSystem::createWriter): + (WebCore::DOMFileSystem::readDirectory): + * fileapi/FileSystemCallbacks.cpp: + (WebCore::EntryCallbacks::create): Added. + (WebCore::EntriesCallbacks::create): Added. + (WebCore::FileSystemCallbacks::create): Added. + (WebCore::MetadataCallbacks::create): Added. + (WebCore::FileWriterCallbacks::create): Added. + (WebCore::VoidCallbacks::create): Added. + * fileapi/FileSystemCallbacks.h: + * fileapi/LocalFileSystem.cpp: + (WebCore::openFileSystem): + (WebCore::LocalFileSystem::requestFileSystem): Changed to take + AsyncFileSystemCallbacks as (a) callback argument(s). + * fileapi/LocalFileSystem.h: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::requestFileSystem): Made a corresponding change + to LocalFileSystem::requestFileSystem. + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::requestFileSystem): Made a corresponding change + to LocalFileSystem::requestFileSystem. + +2010-09-27 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dave Hyatt. + + Fix memory safety issue during positioning list marker as a result of assuming + that list item's parent can always be casted to a RenderBox. The display of the parent + can be manipluated using css as Inline which causes a bad cast. + + https://bugs.webkit.org/show_bug.cgi?id=46384 + + Test: fast/lists/parent-box-not-box-crash.html + + * rendering/RenderListItem.cpp: + (WebCore::RenderListItem::positionListMarker): + * rendering/RenderListMarker.cpp: + (WebCore::RenderListMarker::layout): + +2010-09-19 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Wrong font instantiated from an unknown font family + https://bugs.webkit.org/show_bug.cgi?id=36548 + + When FontConfig returns a match for a particular family name, ensure that + the family name matches the configured alias for the original pattern. This + should prevent selecting FontConfig fallbacks in situations where the next + font on the CSS fallback list should be used. This requires moving all FontConfig + matching logic into FontCacheFreeType and out of FontPlatformDataFreeType. + It should be there anyway. + + Test: platform/gtk/fonts/font-family-fallback.html + + * platform/graphics/cairo/FontCacheFreeType.cpp: + (WebCore::FontCache::platformInit): Simply call FcInit here instead of + deferring to FontPlatformData. + (WebCore::FontCache::getLastResortFallbackFont): The last resort font should + be a fallback font or else the new FontConfig logic may result in null font data + if it cannot find an appropriate match. + (WebCore::getFamilyNameStringFromFontDescriptionAndFamily): Added. Helper function + which converts WebCore fallback names into ones that FontConfig understands. + (WebCore::isFallbackFontAllowed): Added. Helper function that allows FontConfig + fallbacks to be used when generic family names are specified. + (WebCore::FontCache::createFontPlatformData): Move all FontConfig matching logic here + and prevent against the situation where FontConfig returns a different family name + than we asked for. + * platform/graphics/cairo/FontCustomPlatformData.cpp: Updated FontPlatformData constructor. + * platform/graphics/cairo/FontPlatformDataFreeType.cpp: Update the constructor to + take the FcPattern returned and the original FontDescription. We no longer need the other + arguments, because the selection is now done by FontCacheFreeType. + (WebCore::FontPlatformData::FontPlatformData): Remove the FontConfig selection logic from + this code. + * platform/graphics/cairo/FontPlatformDataFreeType.h: Updated method definitions. + * platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp: Fixed includes. + * platform/graphics/cairo/PlatformRefPtrCairo.cpp: Added a PlatformRefPtr specialization + for cairo_font_face_t. + (WTF::refPlatformPtr): Added. + (WTF::derefPlatformPtr): Added. + * platform/graphics/cairo/PlatformRefPtrCairo.h: Updated method definitons. + * platform/graphics/cairo/SimpleFontDataCairo.cpp: + (WebCore::SimpleFontData::smallCapsFontData): Fixed FontPlatformData constructor. + +2010-09-27 Philippe Normand <pnormand@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Doesn't build with gtk+ 2.14 + https://bugs.webkit.org/show_bug.cgi?id=46565 + + Fixed the build for GTK+ 2.14 by adding backward compatible + a backward-compatible function for gtk_menu_item_get_label and a + utility function to create a blank mouse cursor. Those functions + are used in the fullscreen video controller and in the DRT + EventSender. + + * platform/gtk/GtkVersioning.c: + (gdk_window_get_root_coords): + (blankCursor): + (gtk_menu_item_get_label): + * platform/gtk/GtkVersioning.h: + +2010-09-23 Stephen White <senorblanco@chromium.org> + + Reviewed by James Robinson. + + [CHROMIUM] Fix for canvas clearRect() with clipping active, when + --enable-accelerated-2d-canvas is on. + https://bugs.webkit.org/show_bug.cgi?id=46412 + + Covered by layout test http://philip.html5.org/tests/canvas/suite/tests/2d.clearRect.clip.html. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::clearRect): + Check if a clip is active during clipRect(), and force to software + if so. Force a readback in this case, since clearRect() is not + compatible with mixed-mode rendering. + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::canvasClipApplied): + * platform/graphics/skia/PlatformContextSkia.h: + Implement accessor to check if a clip is active. + +2010-09-14 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + drawElements with count=0 and offset = 0 should not generate GL error or crash + https://bugs.webkit.org/show_bug.cgi?id=45769 + + * html/canvas/WebGLRenderingContext.cpp: Deal with count=0 case. + (WebCore::WebGLRenderingContext::validateIndexArrayConservative): + (WebCore::WebGLRenderingContext::validateIndexArrayPrecise): + (WebCore::WebGLRenderingContext::drawElements): + +2010-09-16 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + Fold getString into getParameter and implement new queries + https://bugs.webkit.org/show_bug.cgi?id=40321 + + Test: fast/canvas/webgl/gl-getstring.html + + * html/canvas/WebGLRenderingContext.cpp: Merge getString enums into getParameter. + (WebCore::WebGLRenderingContext::getParameter): + * html/canvas/WebGLRenderingContext.h: Remove getString. + * html/canvas/WebGLRenderingContext.idl: Remove getString. + +2010-09-24 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + gl-teximage fails on chrome mac bot + https://bugs.webkit.org/show_bug.cgi?id=45332 + + Add support for alpha first pixel formats. + + * platform/graphics/GraphicsContext3D.cpp: + (WebCore::doPacking): + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/cg/GraphicsContext3DCG.cpp: + (WebCore::GraphicsContext3D::getImageData): + +2010-09-17 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: implement go-to-line feature + https://bugs.webkit.org/show_bug.cgi?id=45166 + + * English.lproj/localizedStrings.js: + * inspector/front-end/GoToLineDialog.js: Added. + (WebInspector.GoToLineDialog): + (WebInspector.GoToLineDialog.show): + (WebInspector.GoToLineDialog.prototype._hide): + (WebInspector.GoToLineDialog.prototype._onKeyDown): + (WebInspector.GoToLineDialog.prototype._onBlur): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._registerShortcuts): + (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.ScriptsPanel.prototype.showGoToLineDialog): + * inspector/front-end/goToLineDialog.css: Added. + (.go-to-line-dialog): + * inspector/front-end/inspector.html: + +2010-09-24 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: add XHR breakpoints sidebar pane to front-end + https://bugs.webkit.org/show_bug.cgi?id=46483 + + * English.lproj/localizedStrings.js: + * WebCore.gypi: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::instrumentWillSendXMLHttpRequestImpl): + * inspector/InspectorTimelineAgent.h: + * inspector/front-end/BreakpointManager.js: + (WebInspector.BreakpointManager): + (WebInspector.BreakpointManager.prototype._setBreakpointOnBackend): + (WebInspector.BreakpointManager.prototype.createXHRBreakpoint): + (WebInspector.BreakpointManager.prototype._xhrBreakpointRemoved): + (WebInspector.Breakpoint.prototype.compareTo): + (WebInspector.XHRBreakpoint): + (WebInspector.XHRBreakpoint.prototype.get enabled): + (WebInspector.XHRBreakpoint.prototype.set enabled): + (WebInspector.XHRBreakpoint.prototype.get url): + (WebInspector.XHRBreakpoint.prototype.formatLabel): + (WebInspector.XHRBreakpoint.prototype.compareTo): + (WebInspector.XHRBreakpoint.prototype.remove): + (WebInspector.XHRBreakpoint.prototype._setOnBackend.didSet): + (WebInspector.XHRBreakpoint.prototype._setOnBackend): + (WebInspector.XHRBreakpoint.prototype._removeFromBackend): + * inspector/front-end/BreakpointsSidebarPane.js: + (WebInspector.XHRBreakpointsSidebarPane): + (WebInspector.XHRBreakpointsSidebarPane.prototype._showEditBreakpointDialog): + (WebInspector.XHRBreakpointsSidebarPane.prototype._hideEditBreakpointDialog): + (WebInspector.BreakpointItem.prototype.compareTo): + (WebInspector.BreakpointItem.prototype._checkboxClicked): + (WebInspector.BreakpointItem.prototype._enableChanged): + (WebInspector.BreakpointItem.prototype._breakpointClicked): + (WebInspector.XHRBreakpointItem): + * inspector/front-end/CallStackSidebarPane.js: + (WebInspector.CallStackSidebarPane.prototype.updateStatus.formatters.s): + (WebInspector.CallStackSidebarPane.prototype.updateStatus.append): + (WebInspector.CallStackSidebarPane.prototype.updateStatus): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMBreakpoint.prototype.compareTo): + * inspector/front-end/Images/paneAddButtons.png: Added. + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype.reset): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: + (.pane > .title > button.add): + (.pane > .title > button.add:hover): + (.pane > .title > button.add:active): + (.pane > .body .breakpoint-condition): + * inspector/front-end/inspector.js: + (WebInspector.createXHRBreakpointsSidebarPane.breakpointAdded): + (WebInspector.createXHRBreakpointsSidebarPane): + +2010-09-27 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Merge AbstractTimelinePanel into ResourcesPanel. + https://bugs.webkit.org/show_bug.cgi?id=46612 + + I am refactoring resources panel and would like to merge abstract + one back in since it is not use anywhere else. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/AbstractTimelinePanel.js: Removed. + * inspector/front-end/ResourceCategory.js: + (WebInspector.ResourceCategory): + (WebInspector.ResourceCategory.prototype.toString): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.get items): + (WebInspector.ResourcesPanel.prototype.createInterface): + (WebInspector.ResourcesPanel.prototype.createFilterPanel.createFilterElement): + (WebInspector.ResourcesPanel.prototype.createFilterPanel): + (WebInspector.ResourcesPanel.prototype.showCategory): + (WebInspector.ResourcesPanel.prototype.hideCategory): + (WebInspector.ResourcesPanel.prototype.filter): + (WebInspector.ResourcesPanel.prototype._updateFilter): + (WebInspector.ResourcesPanel.prototype._updateDividersLabelBarPosition): + (WebInspector.ResourcesPanel.prototype.get needsRefresh): + (WebInspector.ResourcesPanel.prototype.set needsRefresh): + (WebInspector.ResourcesPanel.prototype.refreshIfNeeded): + (WebInspector.ResourcesPanel.prototype.resize): + (WebInspector.ResourcesPanel.prototype.invalidateAllItems): + (WebInspector.ResourcesPanel.prototype.get calculator): + (WebInspector.ResourcesPanel.prototype.set calculator): + (WebInspector.ResourcesPanel.prototype.addItem): + (WebInspector.ResourcesPanel.prototype.removeItem): + (WebInspector.ResourcesPanel.prototype.refreshItem): + (WebInspector.ResourcesPanel.prototype.revealAndSelectItem): + (WebInspector.ResourcesPanel.prototype.sortItems): + (WebInspector.ResourcesPanel.prototype.adjustScrollPosition): + (WebInspector.ResourcesPanel.prototype.addEventDivider): + (WebInspector.ResourcesPanel.prototype.hideEventDividers): + (WebInspector.ResourcesPanel.prototype.showEventDividers): + (WebInspector.ResourcesPanel.prototype.show): + (WebInspector.ResourcesPanel.prototype.refresh): + (WebInspector.ResourcesPanel.prototype.reset): + (WebInspector.ResourcesPanel.prototype.updateGraphDividersIfNeeded): + (WebInspector.ResourcesPanel.prototype.updateMainViewWidth): + (WebInspector.ResourceBaseCalculator): + (WebInspector.ResourceBaseCalculator.prototype.computeSummaryValues): + (WebInspector.ResourceBaseCalculator.prototype.computeBarGraphPercentages): + (WebInspector.ResourceBaseCalculator.prototype.computeBarGraphLabels): + (WebInspector.ResourceBaseCalculator.prototype.get boundarySpan): + (WebInspector.ResourceBaseCalculator.prototype.updateBoundaries): + (WebInspector.ResourceBaseCalculator.prototype.reset): + (WebInspector.ResourceBaseCalculator.prototype._value): + (WebInspector.ResourceBaseCalculator.prototype.formatValue): + (WebInspector.ResourceTimeCalculator): + (WebInspector.ResourceTransferSizeCalculator): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2010-09-27 Ragner Magalhaes <ragner.magalhaes@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] New input style for Qt Mobile theme + https://bugs.webkit.org/show_bug.cgi?id=46461 + + Rename themeQtMaemo5.css to themeQtMobile.css since it is the theme for all Qt mobile platform. + Adjust new input style. + + * WebCore.pri: + * css/themeQtMobile.css: Renamed from css/themeQtMaemo5.css + (select): + (select:disabled): + (select:active): + (select:active:disabled): + (textarea): + (textarea:disabled): + (textarea:active): + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::extraDefaultStyleSheet): Renamed themeQtMaemo5UserAgentStyleSheet to themeQtMobileUserAgentStyleSheet to match renamed file. + +2010-09-27 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Antonio Gomes. + + [Qt] Enable local rendering of NPAPI plugins on Maemo6. + + https://bugs.webkit.org/show_bug.cgi?id=46618 + + * WebCore.pro: + * bridge/npapi.h: + * plugins/PluginView.cpp: + (WebCore::PluginView::setValue): + (WebCore::PluginView::PluginView): + * plugins/PluginView.h: + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::paint): + (WebCore::PluginView::platformGetValueStatic): + +2010-09-27 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: divide InspectorTimelineAgent into two parts. + + We have an idea to split InspectorTimelineAgent into two parts. + The first part is an instrumentation API which can be used for DOM breakpoints too. + The other is the real Timeline agent which do a transformation of raw data into timeline data. + + https://bugs.webkit.org/show_bug.cgi?id=46611 + + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent2::TimelineRecordEntry::TimelineRecordEntry): + (WebCore::InspectorTimelineAgent2::GCEvent::GCEvent): + (WebCore::InspectorTimelineAgent2::InspectorTimelineAgent2): + (WebCore::InspectorTimelineAgent2::~InspectorTimelineAgent2): + (WebCore::InspectorTimelineAgent2::didGC): + (WebCore::InspectorTimelineAgent2::addRecordToTimeline): + (WebCore::InspectorTimelineAgent2::setHeapSizeStatistic): + (WebCore::InspectorTimelineAgent2::startNewRecord): + (WebCore::InspectorTimelineAgent2::completeCurrentRecord): + (WebCore::InspectorTimelineAgent2::asyncRecord): + (WebCore::InspectorTimelineAgent2::atomicRecord): + (WebCore::InspectorTimelineAgent2::getTopRecordData): + (WebCore::InspectorTimelineAgent2::reset): + (WebCore::InspectorTimelineAgent2::resetFrontendProxyObject): + (WebCore::InspectorTimelineAgent2::pushGCEventRecords): + (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): + (WebCore::InspectorTimelineAgent::~InspectorTimelineAgent): + (WebCore::InspectorTimelineAgent::reset): + (WebCore::InspectorTimelineAgent::willCallFunction): + (WebCore::InspectorTimelineAgent::didCallFunction): + (WebCore::InspectorTimelineAgent::willDispatchEvent): + (WebCore::InspectorTimelineAgent::didDispatchEvent): + (WebCore::InspectorTimelineAgent::willLayout): + (WebCore::InspectorTimelineAgent::didLayout): + (WebCore::InspectorTimelineAgent::willRecalculateStyle): + (WebCore::InspectorTimelineAgent::didRecalculateStyle): + (WebCore::InspectorTimelineAgent::willPaint): + (WebCore::InspectorTimelineAgent::didPaint): + (WebCore::InspectorTimelineAgent::willWriteHTML): + (WebCore::InspectorTimelineAgent::didWriteHTML): + (WebCore::InspectorTimelineAgent::didInstallTimer): + (WebCore::InspectorTimelineAgent::didRemoveTimer): + (WebCore::InspectorTimelineAgent::willFireTimer): + (WebCore::InspectorTimelineAgent::didFireTimer): + (WebCore::InspectorTimelineAgent::willChangeXHRReadyState): + (WebCore::InspectorTimelineAgent::didChangeXHRReadyState): + (WebCore::InspectorTimelineAgent::willLoadXHR): + (WebCore::InspectorTimelineAgent::didLoadXHR): + (WebCore::InspectorTimelineAgent::willEvaluateScript): + (WebCore::InspectorTimelineAgent::didEvaluateScript): + (WebCore::InspectorTimelineAgent::didScheduleResourceRequest): + (WebCore::InspectorTimelineAgent::willSendResourceRequest): + (WebCore::InspectorTimelineAgent::willReceiveResourceData): + (WebCore::InspectorTimelineAgent::didReceiveResourceData): + (WebCore::InspectorTimelineAgent::willReceiveResourceResponse): + (WebCore::InspectorTimelineAgent::didReceiveResourceResponse): + (WebCore::InspectorTimelineAgent::didFinishLoadingResource): + (WebCore::InspectorTimelineAgent::didMarkTimeline): + (WebCore::InspectorTimelineAgent::didMarkDOMContentEvent): + (WebCore::InspectorTimelineAgent::didMarkLoadEvent): + (WebCore::InspectorTimelineAgent::resetFrontendProxyObject): + * inspector/InspectorTimelineAgent.h: + +2010-09-27 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Sam Weinig. + + Implement CSSStyleRule::setSelectorText() + + This involves removing the "selectorText" "setter raises(DOMException)" clause from the IDL files, + since the setter no longer raises the exception, as per http://dev.w3.org/csswg/cssom/#dom-cssstylerule-selectortext + https://bugs.webkit.org/show_bug.cgi?id=46487 + + Test: fast/css/css-set-selector-text.html + + * css/CSSPageRule.idl: + * css/CSSStyleRule.cpp: + (WebCore::CSSStyleRule::setSelectorText): + * css/CSSStyleRule.h: + * css/CSSStyleRule.idl: + +2010-09-27 Zoltan Herczeg <zherczeg@webkit.org> + + Reviewed by Dirk Schulze. + + Filter builder should be able to follow the filter object dependencies + https://bugs.webkit.org/show_bug.cgi?id=45812 + + To propagate the changes of a primitive object, a data structure + is needed which stores the dependent primitive objects. (Those + who use the resulting image.) This data structure is implemented + as a hash map, which contains primitive object and set of primitive + objects <key,value> pairs. The hash map is able to follow the + dynamic topology changes. + + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::buildPrimitives): + * rendering/RenderSVGResourceFilterPrimitive.h: + (WebCore::RenderSVGResourceFilterPrimitive::renderName): + (WebCore::RenderSVGResourceFilterPrimitive::isSVGResourceFilterPrimitive): + * svg/graphics/filters/SVGFilterBuilder.cpp: + (WebCore::SVGFilterBuilder::SVGFilterBuilder): + (WebCore::SVGFilterBuilder::appendEffectToEffectReferences): + (WebCore::SVGFilterBuilder::clearEffects): + * svg/graphics/filters/SVGFilterBuilder.h: + (WebCore::SVGFilterBuilder::getEffectReferences): + (WebCore::SVGFilterBuilder::addBuiltinEffects): + +2010-09-27 Andreas Kling <andreas.kling@nokia.com> + + Rubber-stamped by Kenneth Rohde Christiansen. + + [Qt] 32-bit Flash crashes on repeated SetWindow calls + https://bugs.webkit.org/show_bug.cgi?id=46616 + + Re-enable PluginQuirkDontCallSetWindowMoreThanOnce for Qt on x86 Unix. + + We incorrectly thought this was fixed in Flash 10, but it turns out it + was just never broken on 64-bit. + + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::determineQuirks): + +2010-09-27 İsmail Dönmez <ismail@namtrac.org> + + Reviewed by Andreas Kling. + + Add PluginView::setJavaScriptPaused(bool) stub for WinCE. + + * platform/qt/TemporaryLinkStubsQt.cpp: + (PluginView::setJavaScriptPaused): + +2010-09-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Reviewed by Dirk Schulze. + + Bug 46607 - [WML] Fix a build break when WML is enabled + + Fix a build break when WML is enabled. + + * wml/WMLElement.cpp: Include HTMLParserIdioms.h + (WebCore::WMLElement::parseMappedAttribute): Add additional parameter to invoke parseHTMLInteger() function. + +2010-09-26 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Barth. + + Remove dead code and fix header includes in ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46479 + + Also add missing member varibale from r68167. + + * platform/network/ResourceHandle.h: + * platform/network/ResourceHandleInternal.h: + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandleInternal::~ResourceHandleInternal): + (WebCore::ResourceHandle::~ResourceHandle): + (WebCore::ResourceHandle::onRequestComplete): + * platform/network/win/ResourceHandleWin.h: Removed. + +2010-09-26 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Barth. + + Add WTF::StringHasher::createBlobHash + https://bugs.webkit.org/show_bug.cgi?id=46514 + + Add this function for hashing FormElementKey and QualifiedNameComponents. + + * dom/Document.cpp: + (WebCore::FormElementKeyHash::hash): + * dom/QualifiedName.h: + (WebCore::hashComponents): + (WebCore::QualifiedNameHash::hash): + +2010-09-26 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46519 + + Convert the implementation of computeLogicalWidth to work with block-flow. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::determineHorizontalPosition): + Patched to call the new computeMarginsInContainingBlockInlineDirection. Eventually determineHorizontalPosition will + be placing children along the inline direction of the containing block, and those children may have mismatched + block flows. The new computeMarginsInContainingBlockInlineDirection function is designed to handle that. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::marginStart): + (WebCore::RenderBox::marginStartUsing): + (WebCore::RenderBox::marginEnd): + (WebCore::RenderBox::marginEndUsing): + (WebCore::RenderBox::setMarginStart): + (WebCore::RenderBox::setMarginEnd): + (WebCore::RenderBox::setMarginStartUsing): + (WebCore::RenderBox::setMarginEndUsing): + Helpers that allow for marginStart/End access and that also allow for marginStart/End to be computed based off another + element's block-flow and direction (typically the containing block). + + (WebCore::RenderBox::computeBorderBoxLogicalWidth): + (WebCore::RenderBox::computeBorderBoxLogicalHeight): + (WebCore::RenderBox::computeContentBoxLogicalWidth): + (WebCore::RenderBox::computeContentBoxLogicalHeight): + Patched to use logical border/padding widths and heights. + + (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight): + A function for returning the available logical height of a perpendicular containing block. If a child has vertical + text for example and its block-flow is "lr", its available logical width is determined by the logical + height of the containing block when that containing block is perpendicular, e.g. "tb". + + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeLogicalWidthUsing): + Patched to be block-flow-aware and to use logical width values everywhere. + + (WebCore::RenderBox::sizesToIntrinsicLogicalWidth): + Patched to use logical widths. + + (WebCore::RenderBox::computeMarginsInContainingBlockInlineDirection): + A new function that is directionally abstract and that can handle the computation of margins in the containing + block's inline direction. This function is written such that a perpendicular child block flow can still be + pushed to the center, left or right in the containing block's inline direction. + + (WebCore::RenderBox::computePositionedLogicalWidth): + This function is still largely unpatched. A future patch will address positioend elements. + + * rendering/RenderBox.h: + (WebCore::RenderBox::stretchesToMinIntrinsicLogicalWidth): + * rendering/RenderFieldset.h: + (WebCore::RenderFieldset::stretchesToMinIntrinsicLogicalWidth): + Renames. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + Renames, but not converted yet. Tables will happen in a future patch. + + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::marginStartUsing): + (WebCore::RenderStyle::marginEndUsing): + * rendering/style/RenderStyle.h: + Added helpers for accessing marginStart and End using another style's direction and block flow (typically will + be the containing block's). + + fast/block/basic/016.html changed, since centering now always awards the extra pixel for odd widths to the end margin + instead of the right margin. This is a progression. + + fast/css/logical-property-values.html is now reporting garbage results, which is expected now that some of the core layout + functions have been patched. + + Horizontal block flows are untestable still, since the normal layout process incorrectly blows away any computed height values. + +2010-09-26 Antonio Gomes <agomes@rim.comg> + + Reviewed by Kenneth Rohde Christiansen. + + DRT/Mac nodesFromRect support + + [Mac][DRT] Implement LayoutTestController::nodesFromRect + https://bugs.webkit.org/show_bug.cgi?id=46580 + + Symbol files updated. + + * WebCore.exp.in: Added symbols to Document::nodesFromRect and bits of JSDocument now + needed in WebKit/mac. + * WebCore.xcodeproj/project.pbxproj: Set both JSDocument.h and JSNodeList as private headers + now that they are referred in WebKit/mac. + +2010-09-26 Adam Barth <abarth@webkit.org> + + Reviewed by Dimitri Glazkov. + + Implement location.origin and HTMLAnchorElement.origin + https://bugs.webkit.org/show_bug.cgi?id=46558 + + These attributes are part of my proposed URL API: + https://docs.google.com/document/edit?id=1r_VTFKApVOaNIkocrg0z-t7lZgzisTuGTXkdzAk4gLU&hl=en + + Hixie thought we should implement as much of this API as makes sense on + Location and HTMLAnchorElement as well. I'm starting with the origin + attribute, because that seems like the biggest bang for the buck. + + Tests: fast/dom/anchor-origin.html + http/tests/misc/location-origin.html + + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLAnchorElement.cpp: + (WebCore::HTMLAnchorElement::origin): + * html/HTMLAnchorElement.h: + * html/HTMLAnchorElement.idl: + * page/Location.cpp: + (WebCore::Location::origin): + * page/Location.h: + * page/Location.idl: + +2010-09-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r68343. + http://trac.webkit.org/changeset/68343 + https://bugs.webkit.org/show_bug.cgi?id=46581 + + broke GTK+ (Requested by kling on #webkit). + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setFont): + +2010-09-25 Antonio Gomes <agomes@rim.com> + + Reviewed by Kenneth Christiansen and Andreas Kling. + + document.nodesFromRect() needs to be removed from Document.idl + https://bugs.webkit.org/show_bug.cgi?id=46492 + + As discussed with Sam Weinig on IRC, it was decided to removed + nodesFromRect() from the Document.idl, and that way, not exposing + it to Web content. + + Reason: there is no plan to make it standard at the moment, and at the + very least, the method should had been originally added with the "webkit" + prefix, which was not the case. + + * dom/Document.idl: + +2010-09-26 Renata Hodovan <reni@inf.u-szeged.hu> + + Reviewed by Dirk Schulze. + + SVGFEBlendElement doesn't support dynamic invalidation, when attributes change. + https://bugs.webkit.org/show_bug.cgi?id=46464 + + Tests: svg/dynamic-updates/SVGFEBlendElement-dom-in-attr.html + svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr.html + svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr.html + svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop.html + svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop.html + svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop.html + + * svg/SVGFEBlendElement.cpp: + (WebCore::SVGFEBlendElement::svgAttributeChanged): + * svg/SVGFEBlendElement.h: + +2010-09-26 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Dan Bernstein. + + Canvas: Crash when setting a font with size in 'ex' units + https://bugs.webkit.org/show_bug.cgi?id=46538 + + update() the style's font after setting the style's font description. + Needed because CSSPrimitiveValue::computeLengthDouble() later assumes + that the style's font is properly initialized (for xHeight().) + + Fixes crash on IE test center's canvas-text-font-002 test. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setFont): + +2010-09-26 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Don't pass PassOwnPtr in makeAllDirectories + https://bugs.webkit.org/show_bug.cgi?id=42058 + + Change makeAllDirectories to take a raw FileMgr pointer + because it is not safe to pass PassOwnPtr recursively. + + * platform/brew/FileSystemBrew.cpp: + (WebCore::makeAllDirectories): + +2010-09-26 Robert Hogan <robert@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] fix http/tests/uri/escaped-entity.html + + Replace invalid encodings with the appropriate escaped entity. + + See also http://bugreports.qt.nokia.com/browse/QTBUG-13412 + + https://bugs.webkit.org/show_bug.cgi?id=45245 + + * platform/text/qt/TextCodecQt.cpp: + (WebCore::TextCodecQt::encode): + +2010-09-25 Abhishek Arya <inferno@chromium.org> + + Reviewed by Nikolas Zimmermann. + + Fix the macro to bail out after setting the SVG style to 'initial'. Check that color is + SVGColor before calling colorFromSVGColorCSSValue which makes sure we don't set invalid + color. Also, doing the static cast in the caller and keeping the function + colorFromSVGColorCSSValue clean to accept only take SVGColor objects. + + https://bugs.webkit.org/show_bug.cgi?id=46471 + + Test: svg/css/invalid-color-crash.svg + + * css/SVGCSSStyleSelector.cpp: + (WebCore::colorFromSVGColorCSSValue): + (WebCore::CSSStyleSelector::applySVGProperty): + +2010-09-25 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Tony Chang. + + FormatBlockCommand's modifyRange and doApply should be merged + https://bugs.webkit.org/show_bug.cgi?id=46504 + + Isolated the code in doApply to insert and remove lists for single paragraph into doApplyForSingleParagraph. + Merged the code in modifyRange into doApply and cleaned up. + + No new tests are added since this is a cleanup. + + * editing/FormatBlockCommand.cpp: + (WebCore::FormatBlockCommand::doApply): Merged with modifyRange; calls doApplyForSingleParagraph. + (WebCore::FormatBlockCommand::doApplyForSingleParagraph): Added. + * editing/FormatBlockCommand.h: + +2010-09-25 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + <rdar://problem/8478160> Null deref in InlineBox::height() + https://bugs.webkit.org/show_bug.cgi?id=45344 + + Test: fast/css/first-line-parent-style-different.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::firstLineStyleSlowCase): Set the pseudo style bit on the RenderStyle + which is going to supply the first-line style rather than on this object’s RenderStyle. The + styles may differ. + +2010-09-25 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + <rdar://problem/8478182> Make canHyphenate() return false for unsupported locales + + No change in functionality, hence no new test. + + * platform/text/cf/HyphenationCF.cpp: + (WebCore::::createValueForKey): Return 0 if hyphenation is not available for the locale. + (WebCore::cfLocaleCache): Moved the definition of the cache from lastHyphenLocation() to + this new getter to allow canHyphenate() to share it. + (WebCore::canHyphenate): Now returns true only if hyphenation is available. + (WebCore::lastHyphenLocation): Added an assertion. + +2010-09-25 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] GraphicsContext::setLineDash() should scale dashOffset to penWidth + https://bugs.webkit.org/show_bug.cgi?id=46548 + + Fixes incorrect rendering of <http://www.carto.net/svg/samples/animated_bustrack.shtml> + + This is covered by existing layout tests which need to be rebaselined. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::setLineDash): + +2010-09-24 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Dan Bernstein. + + Fix accidental increase in the size of InlineBox by using a bit + field to indicate that a bool should only take up 1 bit. + + * rendering/InlineBox.h: + +2010-09-24 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Accelerated transitions do not suspend/resume properly. + https://bugs.webkit.org/show_bug.cgi?id=43792 + + (1) Fix regression from r68233, where if an animation affected two + properties, only one would animate. The testcase tests this. + + (2) Fix a flash at the end of an animation or transition that has been + paused and resumed. The flash occurred because we used CAAnimation's + timeOffset when resuming to push the start of the animation into + the past. However, timeOffset does not play nicely with fill modes, + causing a single frame of animation with the element in its unanimated state. + + Fixed this by offsetting the beginTime into the past, rather than setting + timeOffset. Normally we submit animations with beginTime == 0, and rely + on CA assigning a beginTime when the animation is committed. This beginTime + is then passed to AnimationController to sync hardware and software animations. + However, since the code now assigns beginTimes in the past (on resume), + we now have to denote whether we've done this, and send an appropriate + timestamp back to AnimationController. + + (3) Finally, the patch removes PropertyAnimationPair and just uses LayerPropertyAnimation + instead. This is just cleanup. + + Test: animations/opacity-transform-animation.html + + * platform/graphics/mac/GraphicsLayerCA.h: Remove PropertyAnimationPair, + and change AnimationsMap to store a vector of LayerPropertyAnimation. + New method, animationDidStart(), is called from the -animationDidStart: callback. + + * platform/graphics/mac/GraphicsLayerCA.mm: + (-[WebAnimationDelegate animationDidStart:]): Just call m_graphicsLayer->animationDidStart() + now. + (WebCore::animationIdentifier): We need to pass in the property, to fix (1) + (WebCore::GraphicsLayerCA::moveOrCopyAnimationsForProperty): Copy the WebKitAnimationBeginTimeSet + value, if present. + (WebCore::GraphicsLayerCA::animationDidStart): Call notifyAnimationStarted() on the client, + after testing if we set a non-zero beginTime on this particular animation. + (WebCore::GraphicsLayerCA::updateLayerAnimations): Change to use LayerPropertyAnimation. + (WebCore::GraphicsLayerCA::setCAAnimationOnLayer): Set value for WebKitAnimationBeginTimeSetKey + if we have a non-zero timeOffset. Make animationID an NSString, to avoid several conversions. + (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): Make animationID an NSString, to + avoid several conversions. + (WebCore::copyAnimationProperties): Copy WebKitAnimationBeginTimeSetKey if present. + (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): Make animationID an NSString, to avoid + several conversions. + +2010-09-24 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + SVG: Avoid calling pow() in genericParseNumber() unless necessary + https://bugs.webkit.org/show_bug.cgi?id=46537 + + 0.4% speedup on <http://themaninblue.com/experiment/AnimationBenchmark/svg/> + + * svg/SVGParserUtilities.cpp: + (WebCore::genericParseNumber): Only call pow() when we have an exponent. + +2010-09-24 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] opening local files on win32 + https://bugs.webkit.org/show_bug.cgi?id=31066 + + This is tested by changes to the testmimehandling API test. + + * platform/network/soup/ResourceHandleSoup.cpp: Properly convert the GContentType + of a file into a mime type. This is important for non-Unix platforms. + +2010-09-24 Pawel Hajdan <phajdan.jr@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Move the implementation of chromium_vfs to webkit for POSIX. + This allows us to link Chrome with system-provided SQLite on Linux. + See also http://code.google.com/p/chromium/issues/detail?id=22208. + https://bugs.webkit.org/show_bug.cgi?id=45416 + + No new tests. + + * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp: + (sqliteErrorFromPosixError): + (releaseLockInfo): + (releaseOpenInfo): + (findLockInfo): + (chromiumCheckReservedLock): + (rangeLock): + (chromiumLock): + (closePendingFds): + (chromiumUnlock): + (chromiumCloseNoLock): + (chromiumClose): + (chromiumCheckReservedLockNoop): + (chromiumLockNoop): + (chromiumUnlockNoop): + (seekAndRead): + (chromiumRead): + (seekAndWrite): + (chromiumWrite): + (syncWrapper): + (chromiumSync): + (chromiumTruncate): + (chromiumFileSize): + (chromiumFileControl): + (chromiumSectorSize): + (chromiumDeviceCharacteristics): + (fillInChromiumFile): + (findReusableFd): + (chromiumOpen): + (chromiumDelete): + (chromiumAccess): + (chromiumFullPathname): + (chromiumDlOpen): + (chromiumDlError): + (chromiumDlSym): + (chromiumDlClose): + (chromiumRandomness): + (chromiumSleep): + (chromiumCurrentTime): + (chromiumGetLastError): + (WebCore::SQLiteFileSystem::registerSQLiteVFS): + +2010-09-24 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Dirk Schulze. + + SVG: Make SVGLength's stringToLengthType() stricter and faster + https://bugs.webkit.org/show_bug.cgi?id=46066 + + Only accept unit names immediately following the numeric value. + This behavior matches Gecko. + + Also, using String::endsWith("foo") caused a temporary WTF::String to be created. + Avoid this by comparing characters directly. + + 10.5% speedup on <http://data.xeoh.net/svg.benchmark/> + + Test: svg/custom/invalid-length-units.html + + * svg/SVGLength.cpp: + (WebCore::stringToLengthType): + (WebCore::SVGLength::setValueAsString): + +2010-09-24 Luiz Agostini <luiz.agostini@openbossa.org> + Reviewed by Kenneth Rohde Christiansen. + + Keep viewport information in Document + https://bugs.webkit.org/show_bug.cgi?id=46385 + + The viewport meta data (layout viewport, scale) needs to be set again when bringing + back a page from the page cache. As the viewport metadata is only retrieved while parsing + the document, we need to store it in the Document class. + + Test: fast/viewport/viewport-128.html + + * WebCore.xcodeproj/project.pbxproj: + * dom/Document.cpp: + (WebCore::Document::processViewport): + (WebCore::Document::setInPageCache): + * dom/Document.h: + (WebCore::Document::viewportArguments): + +2010-09-24 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46496, rename containingBlockWidthForContent to + containingBlockLogicalWidthForContent. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::localCaretRect): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::containingBlockLogicalWidthForContent): + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeReplacedWidthUsing): + * rendering/RenderBox.h: + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::relativePositionOffsetX): + (WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent): + * rendering/RenderBoxModelObject.h: + +2010-09-24 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46489, rename the lineWidth and left/RightOffset methods + to reflect that they will be logical. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::determineHorizontalPosition): + (WebCore::RenderBlock::leftSelectionOffset): + (WebCore::RenderBlock::rightSelectionOffset): + (WebCore::RenderBlock::positionNewFloats): + (WebCore::RenderBlock::logicalLeftOffsetForContent): + (WebCore::RenderBlock::logicalLeftOffsetForLine): + (WebCore::RenderBlock::logicalRightOffsetForContent): + (WebCore::RenderBlock::logicalRightOffsetForLine): + (WebCore::RenderBlock::availableLogicalWidthForLine): + (WebCore::RenderBlock::getClearDelta): + * rendering/RenderBlock.h: + (WebCore::RenderBlock::logicalRightOffsetForLine): + (WebCore::RenderBlock::logicalLeftOffsetForLine): + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): + (WebCore::RenderBlock::layoutInlineChildren): + (WebCore::RenderBlock::skipTrailingWhitespace): + (WebCore::RenderBlock::skipLeadingWhitespace): + (WebCore::RenderBlock::fitBelowFloats): + (WebCore::RenderBlock::findNextLineBreak): + (WebCore::RenderBlock::checkLinesForTextOverflow): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::containingBlockWidthForContent): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::applyLineClamp): + * rendering/RenderListItem.cpp: + (WebCore::RenderListItem::positionListMarker): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::selectionTop): + +2010-09-24 Abhishek Arya <inferno@chromium.org> + + Reviewed by Simon Fraser. + + Comply with spec by generalizing container on which transforms can be applied. + https://bugs.webkit.org/show_bug.cgi?id=46485 + + Already covered by existing tests. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::getTransformFromContainer): + +2010-09-24 David Hyatt <hyatt@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=46482, rename the various prefWidth functions to use + preferredLogicalWidth. + + * rendering/AutoTableLayout.cpp: + (WebCore::AutoTableLayout::recalcColumn): + (WebCore::AutoTableLayout::computePreferredLogicalWidths): + (WebCore::AutoTableLayout::calcEffectiveWidth): + * rendering/AutoTableLayout.h: + * rendering/FixedTableLayout.cpp: + (WebCore::FixedTableLayout::calcWidthArray): + (WebCore::FixedTableLayout::computePreferredLogicalWidths): + * rendering/FixedTableLayout.h: + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChildren): + (WebCore::RenderBlock::layoutPositionedObjects): + (WebCore::RenderBlock::getClearDelta): + (WebCore::RenderBlock::computePreferredLogicalWidths): + (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): + (WebCore::RenderBlock::computeBlockPreferredLogicalWidths): + * rendering/RenderBlock.h: + * rendering/RenderBlockLineLayout.cpp: + (WebCore::dirtyLineBoxesForRenderer): + (WebCore::RenderBlock::layoutInlineChildren): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::RenderBox): + (WebCore::RenderBox::minPreferredLogicalWidth): + (WebCore::RenderBox::maxPreferredLogicalWidth): + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeLogicalWidthUsing): + (WebCore::RenderBox::computePositionedLogicalWidth): + (WebCore::RenderBox::computePositionedLogicalWidthUsing): + * rendering/RenderBox.h: + (WebCore::RenderBox::computePreferredLogicalWidths): + * rendering/RenderCounter.cpp: + (WebCore::RenderCounter::computePreferredLogicalWidths): + * rendering/RenderCounter.h: + * rendering/RenderDataGrid.cpp: + (WebCore::RenderDataGrid::computePreferredLogicalWidths): + * rendering/RenderDataGrid.h: + * rendering/RenderFieldset.cpp: + (WebCore::RenderFieldset::computePreferredLogicalWidths): + * rendering/RenderFieldset.h: + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::computePreferredLogicalWidths): + * rendering/RenderFileUploadControl.h: + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::calcHorizontalPrefWidths): + (WebCore::RenderFlexibleBox::calcVerticalPrefWidths): + (WebCore::RenderFlexibleBox::computePreferredLogicalWidths): + (WebCore::RenderFlexibleBox::allowedChildFlex): + * rendering/RenderFlexibleBox.h: + * rendering/RenderFrameBase.cpp: + (WebCore::RenderFrameBase::layoutWithFlattening): + * rendering/RenderHTMLCanvas.cpp: + (WebCore::RenderHTMLCanvas::canvasSizeChanged): + * rendering/RenderImage.cpp: + (WebCore::RenderImage::imageChanged): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::computePreferredLogicalWidths): + * rendering/RenderListBox.h: + * rendering/RenderListItem.cpp: + (WebCore::RenderListItem::updateMarkerLocation): + (WebCore::RenderListItem::computePreferredLogicalWidths): + * rendering/RenderListItem.h: + * rendering/RenderListMarker.cpp: + (WebCore::RenderListMarker::layout): + (WebCore::RenderListMarker::computePreferredLogicalWidths): + (WebCore::RenderListMarker::updateMargins): + * rendering/RenderListMarker.h: + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::computePreferredLogicalWidths): + * rendering/RenderMenuList.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::RenderObject): + (WebCore::RenderObject::setPreferredLogicalWidthsDirty): + (WebCore::RenderObject::invalidateContainerPreferredLogicalWidths): + * rendering/RenderObject.h: + (WebCore::RenderObject::preferredLogicalWidthsDirty): + (WebCore::RenderObject::setNeedsLayoutAndPrefWidthsRecalc): + (WebCore::RenderObject::minPreferredLogicalWidth): + (WebCore::RenderObject::maxPreferredLogicalWidth): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computePreferredLogicalWidths): + * rendering/RenderReplaced.h: + * rendering/RenderReplica.cpp: + (WebCore::RenderReplica::computePreferredLogicalWidths): + * rendering/RenderReplica.h: + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::computePreferredLogicalWidths): + * rendering/RenderSVGRoot.h: + * rendering/RenderScrollbarPart.cpp: + (WebCore::RenderScrollbarPart::computePreferredLogicalWidths): + * rendering/RenderScrollbarPart.h: + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::computePreferredLogicalWidths): + * rendering/RenderSlider.h: + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + (WebCore::RenderTable::computePreferredLogicalWidths): + * rendering/RenderTable.h: + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::computePreferredLogicalWidths): + * rendering/RenderTableCell.h: + * rendering/RenderTableCol.cpp: + (WebCore::RenderTableCol::computePreferredLogicalWidths): + * rendering/RenderTableCol.h: + * rendering/RenderText.cpp: + (WebCore::RenderText::trimmedPrefWidths): + (WebCore::RenderText::minPreferredLogicalWidth): + (WebCore::RenderText::maxPreferredLogicalWidth): + (WebCore::RenderText::computePreferredLogicalWidths): + (WebCore::RenderText::width): + * rendering/RenderText.h: + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::computePreferredLogicalWidths): + * rendering/RenderTextControl.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::preferredContentWidth): + (WebCore::RenderTextControlSingleLine::preferredDecorationWidthRight): + * rendering/RenderVideo.cpp: + (WebCore::RenderVideo::updateIntrinsicSize): + * rendering/RenderView.cpp: + (WebCore::RenderView::RenderView): + (WebCore::RenderView::computePreferredLogicalWidths): + (WebCore::RenderView::layout): + * rendering/RenderView.h: + * rendering/TableLayout.h: + +2010-09-24 Jian Li <jianli@chromium.org> + + Reviewed by Alexey Proskuryakov. + + DOMWindow::revokeBlobURL erroneously uses ParsedURLString. + https://bugs.webkit.org/show_bug.cgi?id=46434 + + Test: fast/files/revoke-blob-url.html + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::revokeBlobURL): + +2010-09-24 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46474 + + Patch computeWidthUsing to be block-flow-aware. Rename the WidthType enum to LogicalWidthType. Make computeLogicalWidthUsing + query the style for logical width properties instead of width properties. + + fast/css/logical-property-resolution.html now fails and gives bad results. This is expected. It will become correct + again as more layout code gets patched. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeLogicalWidthUsing): + (WebCore::RenderBox::sizesToIntrinsicWidth): + * rendering/RenderBox.h: + +2010-09-24 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Clicking "Select All" in audits panel has no effect when the checkbox is unchecked + Only add category event listeners to real categories, not to "Select All" + https://bugs.webkit.org/show_bug.cgi?id=46467 + + * inspector/front-end/AuditLauncherView.js: + (WebInspector.AuditLauncherView.prototype._createCategoryElement): + +2010-09-24 Hans Wennborg <hans@chromium.org> + + Reviewed by Steve Block. + + Remove unnecessary casts in DeviceOrientation V8 bindings + https://bugs.webkit.org/show_bug.cgi?id=46466 + + Remove unnecessary casts of v8::Value::NumberValue() to double from + the custom v8 bindings code for DeviceOrientation/Motion. + + No new tests: just cleanup, no new functionality. + + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback): + * bindings/v8/custom/V8DeviceOrientationEventCustom.cpp: + (WebCore::V8DeviceOrientationEvent::initDeviceOrientationEventCallback): + +2010-09-24 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: move searchingForNode flag in InspectorController under control of InspectorCookies. + + Four functions from Inspector IDL go away. + Searching for node feature of Inspector keeps alive even after navigation. + + https://bugs.webkit.org/show_bug.cgi?id=46462 + + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::updateInspectorStateCookie): + (WebCore::InspectorController::restoreInspectorStateFromCookie): + (WebCore::InspectorController::setSearchingForNode): + (WebCore::InspectorController::populateScriptObjects): + * inspector/InspectorController.h: + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.hide): + (WebInspector.ElementsPanel.prototype.updateFocusedNode): + (WebInspector.ElementsPanel.prototype._setSearchingForNode): + (WebInspector.ElementsPanel.prototype.setSearchingForNode): + (WebInspector.ElementsPanel.prototype.toggleSearchingForNode): + * inspector/front-end/inspector.js: + (WebInspector._updateFocusedNode): + +2010-09-24 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + IDBTransactionCoordinator incorrectly assumes that aborted transactions must have been started or running. + https://bugs.webkit.org/show_bug.cgi?id=46459 + + No new tests, storage/indexeddb/transaction-basics.html covers this. + + Also fixes http://code.google.com/p/chromium/issues/detail?id=56732 + + * storage/IDBTransactionCoordinator.cpp: + (WebCore::IDBTransactionCoordinator::didFinishTransaction): + +2010-09-24 Hans Wennborg <hans@chromium.org> + + Reviewed by Steve Block. + + Update DeviceMotionEvent to spec + https://bugs.webkit.org/show_bug.cgi?id=46344 + + The spec has changed: the DeviceMotionEvent attributes accelerationX, + accelerationY, etc. have been baked into an 'acceleration' attribute + which returns an object with x, y, and z values. Likewise for the + rotation rate. The 'accelerationIncludingGravity' attribute is new. + + * WebCore.exp.in: + The DeviceMotionData::create member function has changed. Also export + create functions for DeviceMotionData::Acceleration and RotationRate. + + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::acceleration): + (WebCore::JSDeviceMotionEvent::accelerationIncludingGravity): + (WebCore::JSDeviceMotionEvent::rotationRate): + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + Manually create and return objects with the right attributes for + acceleration, accelerationIncludingGravity, and rotationRate. + When creating the DeviceMotionData object in initDeviceMotionEvent, + accept any input objects that have the right attributes. + + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::accelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter): + (WebCore::V8DeviceMotionEvent::rotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback): + V8 counterpart to the JSC code above. + + * dom/DeviceMotionData.cpp: + (WebCore::DeviceMotionData::Acceleration::create): + (WebCore::DeviceMotionData::Acceleration::Acceleration): + (WebCore::DeviceMotionData::RotationRate::create): + (WebCore::DeviceMotionData::RotationRate::RotationRate): + (WebCore::DeviceMotionData::create): + (WebCore::DeviceMotionData::DeviceMotionData): + * dom/DeviceMotionData.h: + (WebCore::DeviceMotionData::Acceleration::canProvideX): + (WebCore::DeviceMotionData::Acceleration::canProvideY): + (WebCore::DeviceMotionData::Acceleration::canProvideZ): + (WebCore::DeviceMotionData::Acceleration::x): + (WebCore::DeviceMotionData::Acceleration::y): + (WebCore::DeviceMotionData::Acceleration::z): + (WebCore::DeviceMotionData::RotationRate::canProvideAlpha): + (WebCore::DeviceMotionData::RotationRate::canProvideBeta): + (WebCore::DeviceMotionData::RotationRate::canProvideGamma): + (WebCore::DeviceMotionData::RotationRate::alpha): + (WebCore::DeviceMotionData::RotationRate::beta): + (WebCore::DeviceMotionData::RotationRate::gamma): + (WebCore::DeviceMotionData::acceleration): + (WebCore::DeviceMotionData::accelerationIncludingGravity): + (WebCore::DeviceMotionData::rotationRate): + Add member classes Acceleration and RotationRate to DeviceMotionData. + + * dom/DeviceMotionEvent.idl: + Update according to the spec. Acceleration and RotationRate need not + be backed by native classes. + +2010-09-24 Romain Pokrzywka <romain@kdab.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix the Wince build. + + * WebCore.pro: Apply msvc flags to wince, too. + +2010-09-24 Anders Bakken <agbakken@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Enable building Qt/Webkit with debug symbols + + With this patch one can configure with -webkit-debug to build Webkit + with debug symbols without having to manually edit WebCore.pro. + + * WebCore.pro: + +2010-09-24 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Web Sockets are insecure with QtWebKit + https://bugs.webkit.org/show_bug.cgi?id=44769 + + Throw an error when the server certificate is not valid. + DRT currently does not support secure websocket connection, + so no new tests. This was tested with the server at + http://code.google.com/p/pywebsocket instead. + + * platform/network/qt/SocketStreamHandleQt.cpp: + (WebCore::SocketStreamHandlePrivate::socketSslErrors): + +2010-09-24 Jia Pu <jpu@apple.com> + + Reviewed by Shinichiro Hamaji. + + Need to remove autocorrection underlines in current line when newline is entered. + https://bugs.webkit.org/show_bug.cgi?id=45709 + <rdar://problem/8335576> + + This change affects only Mac OSX build. + + * dom/DocumentMarker.h: Added "CorrectionIndicator" to indicate the words on which we need + to draw autocorrection underline. We cannot use existing "Replacement" for this purpose, + since it is not meant to be removed once it is added. But we need to remove all autocorrection + underlines when a line break or paragraph separator is inserted, which is the behavior in + NSTextView. Hence we need a separate marker value for drawing autocorrection underline. + + * editing/Editor.cpp: + (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Add "CorrectionIndicator" when + autocorrection takes place. + (WebCore::Editor::changeSelectionAfterCommand): Remove "CorrectionIndicator" markers if the + command results in inserting paragraph separator. + + * rendering/InlineTextBox.cpp: + (WebCore::textCheckingLineStyleForMarkerType): Use "CorrectionIndicator" marker instead of + "Replacement" to draw autocorrection underline. + (WebCore::InlineTextBox::paintDocumentMarkers): Ditto. + +2010-09-24 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Remove unnecessary parameter from AsyncFileWriterClient::didTruncate + https://bugs.webkit.org/show_bug.cgi?id=46390 + + * fileapi/AsyncFileWriterClient.h: + + Added state to FileWriter to replace the parameter. + * fileapi/FileWriter.h: + * fileapi/FileWriter.cpp: + (WebCore::FileWriter::truncate): + (WebCore::FileWriter::didTruncate): + +2010-09-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r68236. + http://trac.webkit.org/changeset/68236 + https://bugs.webkit.org/show_bug.cgi?id=46449 + + compile fix didn't work (Requested by dino___ on #webkit). + + * WebCore.exp.in: + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::xAcceleration): + (WebCore::JSDeviceMotionEvent::yAcceleration): + (WebCore::JSDeviceMotionEvent::zAcceleration): + (WebCore::JSDeviceMotionEvent::xRotationRate): + (WebCore::JSDeviceMotionEvent::yRotationRate): + (WebCore::JSDeviceMotionEvent::zRotationRate): + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::xAccelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::yAccelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::zAccelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::xRotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::yRotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::zRotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback): + * dom/DeviceMotionData.cpp: + (WebCore::DeviceMotionData::create): + (WebCore::DeviceMotionData::DeviceMotionData): + * dom/DeviceMotionData.h: + (WebCore::DeviceMotionData::xAcceleration): + (WebCore::DeviceMotionData::yAcceleration): + (WebCore::DeviceMotionData::zAcceleration): + (WebCore::DeviceMotionData::xRotationRate): + (WebCore::DeviceMotionData::yRotationRate): + (WebCore::DeviceMotionData::zRotationRate): + (WebCore::DeviceMotionData::canProvideXAcceleration): + (WebCore::DeviceMotionData::canProvideYAcceleration): + (WebCore::DeviceMotionData::canProvideZAcceleration): + (WebCore::DeviceMotionData::canProvideXRotationRate): + (WebCore::DeviceMotionData::canProvideYRotationRate): + (WebCore::DeviceMotionData::canProvideZRotationRate): + * dom/DeviceMotionEvent.idl: + +2010-09-24 Chris Guillory <chris.guillory@google.com> + + Reviewed by Chris Fleizach. + + Send webkit accessibility notifications to Chromium. + https://bugs.webkit.org/show_bug.cgi?id=45156 + + * WebCore.gypi: + * accessibility/chromium/AXObjectCacheChromium.cpp: + (WebCore::AXObjectCache::postPlatformNotification): + (WebCore::AXObjectCache::handleFocusedUIElementChanged): + (WebCore::AXObjectCache::handleScrolledToAnchor): + * dom/Document.cpp: + (WebCore::Document::implicitClose): + (WebCore::Document::setFocusedNode): + * editing/SelectionController.h: + * page/ChromeClient.h: + (WebCore::ChromeClient::postAccessibilityNotification): + * page/FrameView.cpp: + (WebCore::FrameView::layout): + +2010-09-24 David Hyatt <hyatt@apple.com> + + Reviewed by Maciej Stachowiak. + + https://bugs.webkit.org/show_bug.cgi?id=46454, rename a bunch of the width and height calculation methods. + + calcReplacedWidth -> computeReplacedWidth + + calcHorizontalMargins -> computeInlineDirectionMargins + + calcVerticalMargins -> computeBlockDirectionMargins + + calcWidthUsing -> computeLogicalWidthUsing + + calcHeightUsing -> computeLogicalHeightUsing + + calcReplacedHeight/HeightUsing -> computeReplacedHeight/HeightUsing + + calcAbsoluteHorizontalValues -> computePositionedLogicalWidthUsing + + calcAbsoluteVerticalValues -> computePositionedLogicalHeightUsing + + calcAbsoluteHorizontal -> computePositionedLogicalWIdth + + calcAbsoluteVertical -> computePositionedLogicalHeight + + calcAbsoluteHorizontalReplaced -> computePositionedLogicalWidthReplaced + + calcAbsoluteVerticalReplaced -> computePositionedLogicalHeightReplaced + + calcBorderBoxWidth/Height -> computeBorderBoxLogicalWidth/LogicalHeight + + calcContentBoxWidth/Height -> computeContentBoxLogicalWidth/LogicalHeight + + shouldCalculateSizeAsReplaced -> shouldComputeSizeAsReplaced + + calcPercentageHeight -> computePercentageLogicalHeight + + * rendering/AutoTableLayout.cpp: + (WebCore::AutoTableLayout::recalcColumn): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::adjustPositionedBlock): + (WebCore::RenderBlock::determineHorizontalPosition): + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::insertFloatingObject): + (WebCore::RenderBlock::calcPrefWidths): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeBorderBoxLogicalWidth): + (WebCore::RenderBox::computeBorderBoxLogicalHeight): + (WebCore::RenderBox::computeContentBoxLogicalWidth): + (WebCore::RenderBox::computeContentBoxLogicalHeight): + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeLogicalWidthUsing): + (WebCore::RenderBox::computeInlineDirectionMargins): + (WebCore::RenderBox::computeLogicalHeight): + (WebCore::RenderBox::computeLogicalHeightUsing): + (WebCore::RenderBox::computePercentageLogicalHeight): + (WebCore::RenderBox::computeReplacedWidth): + (WebCore::RenderBox::computeReplacedWidthUsing): + (WebCore::RenderBox::computeReplacedHeight): + (WebCore::RenderBox::computeReplacedHeightUsing): + (WebCore::RenderBox::availableHeightUsing): + (WebCore::RenderBox::computeBlockDirectionMargins): + (WebCore::RenderBox::computePositionedLogicalWidth): + (WebCore::RenderBox::computePositionedLogicalWidthUsing): + (WebCore::RenderBox::computePositionedLogicalHeight): + (WebCore::RenderBox::computePositionedLogicalHeightUsing): + (WebCore::RenderBox::computePositionedLogicalWidthReplaced): + (WebCore::RenderBox::computePositionedLogicalHeightReplaced): + * rendering/RenderBox.h: + (WebCore::RenderBox::shouldComputeSizeAsReplaced): + * rendering/RenderDataGrid.cpp: + (WebCore::RenderDataGrid::calcPrefWidths): + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::calcPrefWidths): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::calcPrefWidths): + (WebCore::RenderFlexibleBox::layoutHorizontalBox): + (WebCore::RenderFlexibleBox::layoutVerticalBox): + * rendering/RenderImage.cpp: + (WebCore::RenderImage::computeReplacedWidth): + (WebCore::RenderImage::computeReplacedHeight): + (WebCore::RenderImage::calcAspectRatioWidth): + (WebCore::RenderImage::calcAspectRatioHeight): + * rendering/RenderImage.h: + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::calcPrefWidths): + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::calcPrefWidths): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::container): + * rendering/RenderObject.h: + (WebCore::RenderObject::computeBlockDirectionMargins): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeReplacedWidth): + (WebCore::RenderReplaced::computeReplacedHeight): + (WebCore::RenderReplaced::calcAspectRatioWidth): + (WebCore::RenderReplaced::calcAspectRatioHeight): + (WebCore::RenderReplaced::calcPrefWidths): + * rendering/RenderReplaced.h: + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::calcPrefWidths): + (WebCore::RenderSVGRoot::computeReplacedWidth): + (WebCore::RenderSVGRoot::computeReplacedHeight): + * rendering/RenderSVGRoot.h: + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::calcPrefWidths): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + (WebCore::RenderTable::layout): + * rendering/RenderTableRow.cpp: + (WebCore::RenderTableRow::layout): + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::calcPrefWidths): + * rendering/RenderVideo.cpp: + (WebCore::RenderVideo::computeReplacedWidth): + (WebCore::RenderVideo::computeReplacedHeight): + * rendering/RenderVideo.h: + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46451 + + Rename calcWidth to computeLogicalWidth. Rename calcHeight to computeLogicalHeight. + + * rendering/RenderApplet.cpp: + (WebCore::RenderApplet::layout): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlock): + (WebCore::RenderBlock::insertFloatingObject): + (WebCore::RenderBlock::getClearDelta): + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeLogicalWidth): + (WebCore::RenderBox::computeLogicalHeight): + (WebCore::RenderBox::calcPercentageHeight): + (WebCore::RenderBox::calcReplacedHeightUsing): + (WebCore::RenderBox::availableHeightUsing): + (WebCore::RenderBox::calcAbsoluteHorizontal): + * rendering/RenderBox.h: + (WebCore::RenderBox::tryLayoutDoingPositionedMovementOnly): + * rendering/RenderEmbeddedObject.cpp: + (WebCore::RenderEmbeddedObject::layout): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutBlock): + (WebCore::RenderFlexibleBox::layoutHorizontalBox): + (WebCore::RenderFlexibleBox::layoutVerticalBox): + * rendering/RenderForeignObject.cpp: + (WebCore::RenderForeignObject::computeLogicalWidth): + (WebCore::RenderForeignObject::computeLogicalHeight): + * rendering/RenderForeignObject.h: + * rendering/RenderHTMLCanvas.cpp: + (WebCore::RenderHTMLCanvas::canvasSizeChanged): + * rendering/RenderIFrame.cpp: + (WebCore::RenderIFrame::computeLogicalHeight): + (WebCore::RenderIFrame::computeLogicalWidth): + (WebCore::RenderIFrame::layout): + * rendering/RenderIFrame.h: + * rendering/RenderImage.cpp: + (WebCore::RenderImage::imageChanged): + * rendering/RenderIndicator.cpp: + (WebCore::RenderIndicator::layout): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::computeLogicalHeight): + * rendering/RenderListBox.h: + * rendering/RenderMeter.cpp: + (WebCore::RenderMeter::computeLogicalWidth): + (WebCore::RenderMeter::computeLogicalHeight): + * rendering/RenderMeter.h: + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::layout): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::layout): + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::layout): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::computeLogicalWidth): + (WebCore::RenderTable::layout): + * rendering/RenderTable.h: + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::computeLogicalWidth): + * rendering/RenderTableCell.h: + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::computeLogicalHeight): + * rendering/RenderTextControl.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::layout): + (WebCore::RenderTextControlSingleLine::textBlockWidth): + (WebCore::RenderTextControlSingleLine::decorationWidthRight): + (WebCore::RenderTextControlSingleLine::preferredDecorationWidthRight): + (WebCore::RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight): + * rendering/RenderView.cpp: + (WebCore::RenderView::computeLogicalHeight): + (WebCore::RenderView::computeLogicalWidth): + * rendering/RenderView.h: + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::svgAttributeChanged): + +2010-09-23 Hans Wennborg <hans@chromium.org> + + Reviewed by Simon Fraser. + + Update DeviceMotionEvent to spec + https://bugs.webkit.org/show_bug.cgi?id=46344 + + The spec has changed: the DeviceMotionEvent attributes accelerationX, + accelerationY, etc. have been baked into an 'acceleration' attribute + which returns an object with x, y, and z values. Likewise for the + rotation rate. The 'accelerationIncludingGravity' attribute is new. + + * WebCore.exp.in: + The DeviceMotionData::create member function has changed. Also export + create functions for DeviceMotionData::Acceleration and RotationRate. + + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::acceleration): + (WebCore::JSDeviceMotionEvent::accelerationIncludingGravity): + (WebCore::JSDeviceMotionEvent::rotationRate): + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + Manually create and return objects with the right attributes for + acceleration, accelerationIncludingGravity, and rotationRate. + When creating the DeviceMotionData object in initDeviceMotionEvent, + accept any input objects that have the right attributes. + + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::accelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter): + (WebCore::V8DeviceMotionEvent::rotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback): + V8 counterpart to the JSC code above. + + * dom/DeviceMotionData.cpp: + (WebCore::DeviceMotionData::Acceleration::create): + (WebCore::DeviceMotionData::Acceleration::Acceleration): + (WebCore::DeviceMotionData::RotationRate::create): + (WebCore::DeviceMotionData::RotationRate::RotationRate): + (WebCore::DeviceMotionData::create): + (WebCore::DeviceMotionData::DeviceMotionData): + * dom/DeviceMotionData.h: + (WebCore::DeviceMotionData::Acceleration::canProvideX): + (WebCore::DeviceMotionData::Acceleration::canProvideY): + (WebCore::DeviceMotionData::Acceleration::canProvideZ): + (WebCore::DeviceMotionData::Acceleration::x): + (WebCore::DeviceMotionData::Acceleration::y): + (WebCore::DeviceMotionData::Acceleration::z): + (WebCore::DeviceMotionData::RotationRate::canProvideAlpha): + (WebCore::DeviceMotionData::RotationRate::canProvideBeta): + (WebCore::DeviceMotionData::RotationRate::canProvideGamma): + (WebCore::DeviceMotionData::RotationRate::alpha): + (WebCore::DeviceMotionData::RotationRate::beta): + (WebCore::DeviceMotionData::RotationRate::gamma): + (WebCore::DeviceMotionData::acceleration): + (WebCore::DeviceMotionData::accelerationIncludingGravity): + (WebCore::DeviceMotionData::rotationRate): + Add member classes Acceleration and RotationRate to DeviceMotionData. + + * dom/DeviceMotionEvent.idl: + Update according to the spec. Acceleration and RotationRate need not + be backed by native classes. + +2010-09-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Accelerated transitions do not suspend/resume properly. + https://bugs.webkit.org/show_bug.cgi?id=43792 + + Fix suspending of accelerated transitions. + + GraphicsLayer changes unify the handling of transitions and animations + in GraphicsLayer. Both are now identified by name, so the code + now refers to "animationName" rather than "keyframesName". Transitions + use a dummy name which is not a valid keyframe identifier. + + Tests: animations/suspend-transform-animation.html + transitions/suspend-transform-transition.html + + * page/animation/ImplicitAnimation.h: + * page/animation/ImplicitAnimation.cpp: + (WebCore::ImplicitAnimation::pauseAnimation): Call down to the RenderLayerBacking + to tell it that an accelerated transition was paused. + + * platform/graphics/GraphicsLayer.h: + * platform/graphics/GraphicsLayer.cpp: + (WebCore::GraphicsLayer::animationNameForTransition): Create a name + for the transition of the given property. + (WebCore::GraphicsLayer::addAnimation): Generalize "keyframe" to "animation" in the parameter names. + (WebCore::GraphicsLayer::pauseAnimation): ditto + (WebCore::GraphicsLayer::removeAnimation): ditto + + * platform/graphics/mac/GraphicsLayerCA.h: Parameter renaming, and some method renames for clarity. + (WebCore::GraphicsLayerCA::animationIsRunning): + (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation): struct rename for clarity. + + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::animationIdentifier): the animationName already has the property baked in. + (WebCore::GraphicsLayerCA::moveOrCopyLayerAnimation): just deals with one animation now. + (WebCore::GraphicsLayerCA::moveOrCopyAnimationsForProperty): we have to trawl through + m_runningAnimations to get the identifiers for the animations that need to be copied. + (WebCore::GraphicsLayerCA::addAnimation): rename parameters. + (WebCore::GraphicsLayerCA::pauseAnimation): re-ordered methods here. member var renames. + (WebCore::GraphicsLayerCA::removeAnimation): ditto. + (WebCore::GraphicsLayerCA::updateLayerAnimations): no need to iterate over m_transitionPropertiesToRemove, + and no more divergence between transitions and animations. + (WebCore::GraphicsLayerCA::setCAAnimationOnLayer): renames for clarity. + (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): ditto + (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): ditto + (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): renames + (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): renames + (WebCore::GraphicsLayerCA::suspendAnimations): whitespace. + + * rendering/RenderLayerBacking.h: Group the transition and animation methods together. + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::animationPaused): Re-ordered methods for clarity. + (WebCore::RenderLayerBacking::animationFinished): ditto + (WebCore::RenderLayerBacking::startTransition): Use animationNameForTransition() to generate + the animation identifier. + (WebCore::RenderLayerBacking::transitionPaused): Call pauseAnimation, using animationNameForTransition() + to generate the animation identifier. + (WebCore::RenderLayerBacking::transitionFinished): Call removeAnimation, using animationNameForTransition() + to generate the animation identifier. + (WebCore::RenderLayerBacking::notifyAnimationStarted): Moved. + (WebCore::RenderLayerBacking::notifySyncRequired): Moved. + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46442 + + Disallow the setting of block-flow to anything other than "tb" for all table-related display types + and flexible box display types. By disallowing block-flow on the subclasses of RenderBlock like tables + and flexible boxes, we ensure that alterations to the RenderBlock base class won't result in misrenderings + in tables and flexible boxes that try to specify other block flow values. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::adjustRenderStyle): + +2010-09-23 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by David Levin. + + Add Worker support for FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=45808 + + Exposed requestFileSystem and Flags constructor on worker contexts. + + Also changed how to get the base path for Web file systems (in + non-chromium ports) so that it works for workers too. + This patch assumes each port calls + LocalFileSystem::initializeLocalFileSystem() in its initialization + phase. + + No new tests; tests will be added when we have complete implementation. + + * bindings/generic/RuntimeEnabledFeatures.cpp: + (WebCore::RuntimeEnabledFeatures::fileSystemEnabled): Changed to + reflect AsyncFileSystem::isAvailable + * bindings/generic/RuntimeEnabledFeatures.h: Moved the implementation + of fileSystemEnabled to .cpp. + * fileapi/LocalFileSystem.cpp: + (WebCore::LocalFileSystem::initializeLocalFileSystem): Added. + (WebCore::LocalFileSystem::localFileSystem): Added. + (WebCore::LocalFileSystem::fileSystemBasePath): Added. + * fileapi/LocalFileSystem.h: + (WebCore::LocalFileSystem::~LocalFileSystem): Removed. (As now it's + going to be used as a singleton.) + * page/DOMWindow.cpp: + (WebCore::DOMWindow::requestFileSystem): Changed to use a singleton + instance of LocalFileSystem. + * page/SecurityOrigin.h: + (WebCore::SecurityOrigin::canAccessFileSystem): Added. + * page/Settings.cpp: Removed fileSystemRootPath method. + * page/Settings.h: Removed fileSystemRootPath method. + * platform/AsyncFileSystem.cpp: + (WebCore::AsyncFileSystem::isAvailable): Added. + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::requestFileSystem): Added to expose + requestFileSystem method in worker contexts. + (WebCore::WorkerContext::Observer): Added. + (WebCore::WorkerContext::registerObserver): Added. + (WebCore::WorkerContext::unregisterObserver): Added. + (WebCore::WorkerContext::notifyObserversOfStop): Added. + * workers/WorkerContext.h: + * workers/WorkerContext.idl: + * workers/WorkerThread.cpp: + (WebCore::WorkerThreadShutdownStartTask::performTask): Modified to + call workerContext->notifyObserversOfStop to notify worker observers + of the worker thread termination. + +2010-09-23 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Oliver Hunt. + + Lower the default canvas interpolation quality for platforms that use CG + https://bugs.webkit.org/show_bug.cgi?id=45722 + + Lowered the default image interpolation quality for platforms that + use CG down to low since this is as good as if not better than + other graphics platforms defaults (being bilinear interpolation). + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::createImageBuffer): + * html/HTMLCanvasElement.h: Moved in macros for default canvas interp quality. + * platform/graphics/GraphicsContext.h: Moved out macros for default canvas interp quality. It makes more sense for them to be housed where they're used. + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Adele Peterson. + + https://bugs.webkit.org/show_bug.cgi?id=46414, rename line box methods that refer specifically to + "horizontal" and "vertical." Replace those terms with "inline direction" and "block direction." + + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::placeBoxesInInlineDirection): + (WebCore::InlineFlowBox::placeBoxesInBlockDirection): + (WebCore::InlineFlowBox::computeBlockDirectionOverflow): + * rendering/InlineFlowBox.h: + (WebCore::InlineFlowBox::setInlineDirectionOverflowPositions): + (WebCore::InlineFlowBox::setBlockDirectionOverflowPositions): + * rendering/RenderBlock.h: + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): + (WebCore::RenderBlock::computeBlockDirectionPositionsForLine): + (WebCore::RenderBlock::layoutInlineChildren): + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::alignBoxesInBlockDirection): + * rendering/RootInlineBox.h: + +2010-09-23 Andrew Wilson <atwilson@chromium.org> + + Unreviewed, rolling out r68197. + http://trac.webkit.org/changeset/68197 + https://bugs.webkit.org/show_bug.cgi?id=46344 + + Breaks + + * WebCore.exp.in: + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::xAcceleration): + (WebCore::JSDeviceMotionEvent::yAcceleration): + (WebCore::JSDeviceMotionEvent::zAcceleration): + (WebCore::JSDeviceMotionEvent::xRotationRate): + (WebCore::JSDeviceMotionEvent::yRotationRate): + (WebCore::JSDeviceMotionEvent::zRotationRate): + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::xAccelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::yAccelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::zAccelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::xRotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::yRotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::zRotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback): + * dom/DeviceMotionData.cpp: + (WebCore::DeviceMotionData::create): + (WebCore::DeviceMotionData::DeviceMotionData): + * dom/DeviceMotionData.h: + (WebCore::DeviceMotionData::xAcceleration): + (WebCore::DeviceMotionData::yAcceleration): + (WebCore::DeviceMotionData::zAcceleration): + (WebCore::DeviceMotionData::xRotationRate): + (WebCore::DeviceMotionData::yRotationRate): + (WebCore::DeviceMotionData::zRotationRate): + (WebCore::DeviceMotionData::canProvideXAcceleration): + (WebCore::DeviceMotionData::canProvideYAcceleration): + (WebCore::DeviceMotionData::canProvideZAcceleration): + (WebCore::DeviceMotionData::canProvideXRotationRate): + (WebCore::DeviceMotionData::canProvideYRotationRate): + (WebCore::DeviceMotionData::canProvideZRotationRate): + * dom/DeviceMotionEvent.idl: + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Adele Peterson. + + https://bugs.webkit.org/show_bug.cgi?id=46403, convert the margin/border/padding accessors + to be logical. + + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::getFlowSpacingLogicalWidth): + (WebCore::InlineFlowBox::placeBoxesHorizontally): + (WebCore::InlineFlowBox::paintBoxShadow): + (WebCore::InlineFlowBox::paintBoxDecorations): + (WebCore::InlineFlowBox::paintTextDecorations): + * rendering/InlineFlowBox.h: + (WebCore::InlineFlowBox::InlineFlowBox): + (WebCore::InlineFlowBox::marginBorderPaddingLogicalLeft): + (WebCore::InlineFlowBox::marginBorderPaddingLogicalRight): + (WebCore::InlineFlowBox::marginLogicalLeft): + (WebCore::InlineFlowBox::marginLogicalRight): + (WebCore::InlineFlowBox::borderLogicalLeft): + (WebCore::InlineFlowBox::borderLogicalRight): + (WebCore::InlineFlowBox::paddingLogicalLeft): + (WebCore::InlineFlowBox::paddingLogicalRight): + (WebCore::InlineFlowBox::includeLogicalLeftEdge): + (WebCore::InlineFlowBox::includeLogicalRightEdge): + (WebCore::InlineFlowBox::setEdges): + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeHorizontalPositionsForLine): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::containingBlockWidthForPositioned): + (WebCore::RenderBox::calcAbsoluteHorizontalValues): + (WebCore::RenderBox::calcAbsoluteHorizontalReplaced): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + +2010-09-23 Jeff Schiller <jeffschiller@google.com> + + Reviewed by David Hyatt. + + Ensure that SVG documents included by reference (object, iframe, embed) have transparent + backgrounds (not white). https://bugs.webkit.org/show_bug.cgi?id=10687 + + Test: svg/in-html/by-reference.html + + * dom/Document.cpp: + (WebCore::Document::hasSVGRootNode): + * dom/Document.h: + (WebCore::Document::hasSVGRootNode): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + +2010-09-23 Hans Wennborg <hans@chromium.org> + + Reviewed by Simon Fraser. + + Update DeviceMotionEvent to spec + https://bugs.webkit.org/show_bug.cgi?id=46344 + + The spec has changed: the DeviceMotionEvent attributes accelerationX, + accelerationY, etc. have been baked into an 'acceleration' attribute + which returns an object with x, y, and z values. Likewise for the + rotation rate. The 'accelerationIncludingGravity' attribute is new. + + * WebCore.exp.in: + The DeviceMotionData::create member function has changed. Also export + create functions for DeviceMotionData::Acceleration and RotationRate. + + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::acceleration): + (WebCore::JSDeviceMotionEvent::accelerationIncludingGravity): + (WebCore::JSDeviceMotionEvent::rotationRate): + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + Manually create and return objects with the right attributes for + acceleration, accelerationIncludingGravity, and rotationRate. + When creating the DeviceMotionData object in initDeviceMotionEvent, + accept any input objects that have the right attributes. + + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::accelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter): + (WebCore::V8DeviceMotionEvent::rotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback): + V8 counterpart to the JSC code above. + + * dom/DeviceMotionData.cpp: + (WebCore::DeviceMotionData::Acceleration::create): + (WebCore::DeviceMotionData::Acceleration::Acceleration): + (WebCore::DeviceMotionData::RotationRate::create): + (WebCore::DeviceMotionData::RotationRate::RotationRate): + (WebCore::DeviceMotionData::create): + (WebCore::DeviceMotionData::DeviceMotionData): + * dom/DeviceMotionData.h: + (WebCore::DeviceMotionData::Acceleration::canProvideX): + (WebCore::DeviceMotionData::Acceleration::canProvideY): + (WebCore::DeviceMotionData::Acceleration::canProvideZ): + (WebCore::DeviceMotionData::Acceleration::x): + (WebCore::DeviceMotionData::Acceleration::y): + (WebCore::DeviceMotionData::Acceleration::z): + (WebCore::DeviceMotionData::RotationRate::canProvideAlpha): + (WebCore::DeviceMotionData::RotationRate::canProvideBeta): + (WebCore::DeviceMotionData::RotationRate::canProvideGamma): + (WebCore::DeviceMotionData::RotationRate::alpha): + (WebCore::DeviceMotionData::RotationRate::beta): + (WebCore::DeviceMotionData::RotationRate::gamma): + (WebCore::DeviceMotionData::acceleration): + (WebCore::DeviceMotionData::accelerationIncludingGravity): + (WebCore::DeviceMotionData::rotationRate): + Add member classes Acceleration and RotationRate to DeviceMotionData. + + * dom/DeviceMotionEvent.idl: + Update according to the spec. Acceleration and RotationRate need not + be backed by native classes. + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Set synchronous handle in ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46395 + + When loading synchronous network resources, we need to use a synchronous internet handle. + + * platform/network/ResourceHandle.h: + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::loadResourceSynchronously): + (WebCore::ResourceHandle::setSynchronousInternetHandle): + +2010-09-23 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=46326 + Crash when trying to create a NodeIterator rooted at a document-less DocumentType node + + Test: fast/dom/node-iterator-with-doctype-root.html + + * dom/Document.cpp: (WebCore::Document::detachNodeIterator): Added a comment explaining that + attach/detach may not always be paired. + + * dom/NodeIterator.cpp: + (WebCore::NodeIterator::NodeIterator): Don't try to register with the document if there is none. + (WebCore::NodeIterator::~NodeIterator): Ditto. + (WebCore::NodeIterator::detach): Ditto. + (WebCore::NodeIterator::updateForNodeRemoval): There should be a document if we're getting a + notification. + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Add synchronous loading for local files to ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46392 + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::start): + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Remove (has|set)ReceivedResponse() from public ResourceHandleWin API + https://bugs.webkit.org/show_bug.cgi?id=46391 + + There is no need for this functions to be public, so remove them. + + * platform/network/ResourceHandle.h: + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onRequestComplete): + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Adele Peterson. + + https://bugs.webkit.org/show_bug.cgi?id=46400 + + Add logicalLeft/Top getter/setters to line boxes. + + * rendering/InlineBox.h: + (WebCore::InlineBox::logicalLeft): + (WebCore::InlineBox::setLogicalLeft): + (WebCore::InlineBox::logicalTop): + (WebCore::InlineBox::setLogicalTop): + +2010-09-23 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Reduce minimum DOMTimer interval + https://bugs.webkit.org/show_bug.cgi?id=45362 + + Since the setInterval call is meant to reflect a global change for + all pages' DOMTimers, it's misleading to have it be a method on a + given page's settings' object. Thus, this patch changes the call to be static. + + This simple change to using a static call instead of the page's setting's + method doesn't warrant a test. + + * page/Settings.h: Changed the setInterval call to be static. + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46386, give line boxes a vertical bit so that it's easy to know + the overall direction of the line without having to ask the containing block. + + Also couldn't resist some cleanup. Tightened up the type of the renderobject passed to RootInlineBox's + constructor to be a RenderBlock. Moved all the virtual logical height stuff outside of the SVG ifdef + since TrailingFloatsRootInlineBox uses it and should work without SVG enabled. + + * rendering/EllipsisBox.h: + (WebCore::EllipsisBox::EllipsisBox): + * rendering/InlineBox.h: + (WebCore::InlineBox::InlineBox): + (WebCore::InlineBox::isVertical): + (WebCore::InlineBox::setIsVertical): + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::addToLine): + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::RootInlineBox): + (WebCore::RootInlineBox::placeEllipsis): + * rendering/RootInlineBox.h: + * rendering/SVGRootInlineBox.h: + (WebCore::SVGRootInlineBox::SVGRootInlineBox): + * rendering/TrailingFloatsRootInlineBox.h: + (WebCore::TrailingFloatsRootInlineBox::TrailingFloatsRootInlineBox): + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Check for a valid ResourceHandleClient in ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46389 + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onRequestComplete): Add checks to ensure client() is not 0. + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Fix ResourceHandleWin::cancel() for network resources + https://bugs.webkit.org/show_bug.cgi?id=46383 + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onRequestComplete): Check it requestHandle is not 0. + (WebCore::ResourceHandle::cancel): Set requestHandle to 0. + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Add handling for form data and additional HTTP headers in ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46369 + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::start): + +2010-09-23 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Simon Fraser + + 'seeking' event should always fire + https://bugs.webkit.org/show_bug.cgi?id=45694 + + Update seek algorithm to match current spec. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::setReadyState): Don't need to fire 'seeking' event here. + (WebCore::HTMLMediaElement::seek): Always fire 'seeking'. Update comments. + (WebCore::HTMLMediaElement::finishSeek): Update comments. + (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Ditto. + +2010-09-23 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Rename FileWriterClient to AsyncFileWriterClient. + https://bugs.webkit.org/show_bug.cgi?id=46325 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * fileapi/AsyncFileWriter.h: + * fileapi/AsyncFileWriterClient.h: Copied from WebCore/fileapi/FileWriterClient.h. + * fileapi/FileWriter.h: + * fileapi/FileWriterClient.h: Removed. + * platform/AsyncFileSystem.h: + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46378, rename width/height on line boxes to logicalWidth/logicalHeight. + + * editing/visible_units.cpp: + (WebCore::previousLinePosition): + (WebCore::nextLinePosition): + * rendering/EllipsisBox.cpp: + (WebCore::EllipsisBox::paint): + (WebCore::EllipsisBox::paintSelection): + (WebCore::EllipsisBox::nodeAtPoint): + * rendering/InlineBox.cpp: + (WebCore::InlineBox::logicalHeight): + (WebCore::InlineBox::canAccommodateEllipsis): + * rendering/InlineBox.h: + (WebCore::InlineBox::InlineBox): + (WebCore::InlineBox::hasVirtualLogicalHeight): + (WebCore::InlineBox::setHasVirtualLogicalHeight): + (WebCore::InlineBox::virtualLogicalHeight): + (WebCore::InlineBox::setLogicalWidth): + (WebCore::InlineBox::logicalWidth): + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::placeBoxesHorizontally): + (WebCore::InlineFlowBox::placeBoxesVertically): + (WebCore::InlineFlowBox::computeVerticalOverflow): + (WebCore::InlineFlowBox::nodeAtPoint): + (WebCore::InlineFlowBox::paintFillLayer): + (WebCore::InlineFlowBox::paintBoxDecorations): + (WebCore::InlineFlowBox::paintMask): + (WebCore::InlineFlowBox::paintTextDecorations): + (WebCore::InlineFlowBox::placeEllipsisBox): + * rendering/InlineFlowBox.h: + (WebCore::InlineFlowBox::visibleOverflowRect): + (WebCore::InlineFlowBox::bottomLayoutOverflow): + (WebCore::InlineFlowBox::rightLayoutOverflow): + (WebCore::InlineFlowBox::layoutOverflowRect): + (WebCore::InlineFlowBox::bottomVisualOverflow): + (WebCore::InlineFlowBox::rightVisualOverflow): + (WebCore::InlineFlowBox::visualOverflowRect): + (WebCore::InlineFlowBox::setHorizontalOverflowPositions): + (WebCore::InlineFlowBox::setVerticalOverflowPositions): + * rendering/InlineTextBox.cpp: + (WebCore::InlineTextBox::selectionRect): + (WebCore::InlineTextBox::placeEllipsisBox): + (WebCore::InlineTextBox::nodeAtPoint): + (WebCore::InlineTextBox::paint): + (WebCore::InlineTextBox::paintSelection): + (WebCore::InlineTextBox::paintCustomHighlight): + (WebCore::InlineTextBox::paintDecoration): + (WebCore::InlineTextBox::paintSpellingOrGrammarMarker): + (WebCore::InlineTextBox::paintTextMatchMarker): + (WebCore::InlineTextBox::paintCompositionUnderline): + * rendering/InlineTextBox.h: + (WebCore::InlineTextBox::calculateBoundaries): + (WebCore::InlineTextBox::setSpaceAdd): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintEllipsisBoxes): + (WebCore::RenderBlock::rightmostPosition): + (WebCore::RenderBlock::adjustForBorderFit): + (WebCore::RenderBlock::addFocusRingRects): + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeHorizontalPositionsForLine): + (WebCore::RenderBlock::checkLinesForTextOverflow): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::paintCustomHighlight): + (WebCore::RenderBox::containingBlockWidthForPositioned): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::applyLineClamp): + * rendering/RenderInline.cpp: + (WebCore::RenderInline::absoluteRects): + (WebCore::RenderInline::absoluteQuads): + (WebCore::RenderInline::linesBoundingBox): + (WebCore::RenderInline::addFocusRingRects): + (WebCore::RenderInline::paintOutline): + * rendering/RenderSVGInline.cpp: + (WebCore::RenderSVGInline::createInlineFlowBox): + (WebCore::RenderSVGInline::absoluteQuads): + * rendering/RenderSVGInlineText.cpp: + (WebCore::RenderSVGInlineText::createTextBox): + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::createRootInlineBox): + * rendering/RenderText.cpp: + (WebCore::RenderText::absoluteRects): + (WebCore::RenderText::absoluteRectsForRange): + (WebCore::RenderText::absoluteQuadsForRange): + (WebCore::RenderText::positionForPoint): + (WebCore::RenderText::localCaretRect): + (WebCore::RenderText::linesBoundingBox): + * rendering/RenderTreeAsText.cpp: + (WebCore::writeTextRun): + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::canAccommodateEllipsis): + (WebCore::RootInlineBox::placeEllipsis): + (WebCore::RootInlineBox::addHighlightOverflow): + (WebCore::RootInlineBox::paintCustomHighlight): + (WebCore::RootInlineBox::fillLineSelectionGap): + (WebCore::RootInlineBox::closestLeafChildForXPos): + * rendering/SVGInlineFlowBox.h: + (WebCore::SVGInlineFlowBox::SVGInlineFlowBox): + (WebCore::SVGInlineFlowBox::virtualLogicalHeight): + (WebCore::SVGInlineFlowBox::setLogicalHeight): + * rendering/SVGInlineTextBox.cpp: + (WebCore::SVGInlineTextBox::SVGInlineTextBox): + * rendering/SVGInlineTextBox.h: + (WebCore::SVGInlineTextBox::virtualLogicalHeight): + (WebCore::SVGInlineTextBox::setLogicalHeight): + (WebCore::SVGInlineTextBox::selectionHeight): + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeRenderSVGTextBox): + * rendering/SVGRootInlineBox.cpp: + (WebCore::SVGRootInlineBox::layoutChildBoxes): + (WebCore::SVGRootInlineBox::layoutRootBox): + * rendering/SVGRootInlineBox.h: + (WebCore::SVGRootInlineBox::SVGRootInlineBox): + (WebCore::SVGRootInlineBox::virtualLogicalHeight): + (WebCore::SVGRootInlineBox::setLogicalHeight): + * rendering/TrailingFloatsRootInlineBox.h: + (WebCore::TrailingFloatsRootInlineBox::TrailingFloatsRootInlineBox): + (WebCore::TrailingFloatsRootInlineBox::virtualLogicalHeight): + +2010-09-23 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Oliver Hunt. + + context.drawImage with (source rect's height) = -(input image's native height) draws nothing + https://bugs.webkit.org/show_bug.cgi?id=46243 + + This patch changes canvasrenderingcontext2d's drawImage with an image element to + normalize the source and dest rects to acheive the desired canvas spec behavior + of allowing negative widths and heights that don't cause flipping and fix the + adverse behavior of specifying a source rect height of negative the source image's height + + Tests: canvas/philip/tests/2d.drawImage.negativeSourceHeight.html + canvas/philip/tests/2d.drawImage.negativeSourceHeight2.html + canvas/philip/tests/2d.drawImage.negativeSourceHeightAndWidth.html + + * html/canvas/CanvasRenderingContext2D.cpp: Normalize rects in drawImage before calling + lower level draw calls. + +2010-09-23 Renata Hodovan <reni@inf.u-szeged.hu> + + Reviewed by Dirk Schulze. + + SVGFEMorphologyElement doesn't support dynamic invalidation, when attributes change. + https://bugs.webkit.org/show_bug.cgi?id=46363 + The patch also implements the simple setRadius method. + + Tests: svg/dynamic-updates/SVGFEMorphologyElement-dom-in-attr.html + svg/dynamic-updates/SVGFEMorphologyElement-dom-operator-attr.html + svg/dynamic-updates/SVGFEMorphologyElement-dom-radius-attr.html + svg/dynamic-updates/SVGFEMorphologyElement-svgdom-in-prop.html + svg/dynamic-updates/SVGFEMorphologyElement-svgdom-operator-prop.html + svg/dynamic-updates/SVGFEMorphologyElement-svgdom-radius-call.html + + * svg/SVGFEMorphologyElement.cpp: + (WebCore::SVGFEMorphologyElement::setRadius): + (WebCore::SVGFEMorphologyElement::svgAttributeChanged): + * svg/SVGFEMorphologyElement.h: + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Add synchronous loading for network resources to ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46364 + + Use return value of onRequestComplete() to indicate that an additional + call to it is required for receiving remaining network data. + + * platform/network/ResourceHandle.h: + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onRequestComplete): + (WebCore::ResourceHandle::start): + +2010-09-23 Nate Chapin <japhet@chromium.org> + + Reviewed by Darin Fisher. + + Implement <a ping> (disabled by default). + https://bugs.webkit.org/show_bug.cgi?id=30458 + + Tests: http/tests/navigation/ping-cross-origin-from-https.html + http/tests/navigation/ping-cross-origin.html + http/tests/navigation/ping-same-origin.html + + * html/HTMLAnchorElement.cpp: + (WebCore::HTMLAnchorElement::defaultEventHandler): + (WebCore::HTMLAnchorElement::sendPings): + * html/HTMLAnchorElement.h: + * html/HTMLAttributeNames.in: + * loader/PingLoader.cpp: + (WebCore::PingLoader::sendPing): Set ping-specific headers. + (WebCore::PingLoader::PingLoader): + * loader/PingLoader.h: + (WebCore::PingLoader::timeout): Ensure pings eventually timeout, since + the normal cancel mechanism can't stop them. + * page/Settings.cpp: + * page/Settings.h: Add hyperlinkAuditingEnabled. + +2010-09-23 Steve VanDeBogart <vandebo@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=46312 + + Use Skia's SkSafeRef/SkSafeUnref functions instead of safeRef/safeUnref. + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::Font::drawGlyphs): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::FontPlatformData): + (WebCore::FontPlatformData::~FontPlatformData): + * platform/graphics/skia/GradientSkia.cpp: + (WebCore::Gradient::platformDestroy): + * platform/graphics/skia/PatternSkia.cpp: + (WebCore::Pattern::platformDestroy): + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::State::State): + (WebCore::PlatformContextSkia::State::~State): + (WebCore::PlatformContextSkia::drawRect): + (WebCore::PlatformContextSkia::setStrokeShader): + (WebCore::PlatformContextSkia::setFillShader): + (WebCore::PlatformContextSkia::setDashPathEffect): + * platform/graphics/skia/SkiaFontWin.cpp: + (WebCore::paintSkiaText): + +2010-09-23 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Csaba Osztrogonác. + + Fix warnings regarding print format in 64 bits + https://bugs.webkit.org/show_bug.cgi?id=46357 + + Use inttypes.h in order to have portable print formats across 32 and + 64 bits. + + * platform/sql/SQLiteFileSystem.cpp: + (WebCore::SQLiteFileSystem::getFileNameForNewDatabase): + +2010-09-23 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Add AudioContext files + https://bugs.webkit.org/show_bug.cgi?id=44890 + + No new tests since audio API is not yet implemented. + + * webaudio/AudioContext.cpp: Added. + (WebCore::AudioContext::createAudioRequest): + (WebCore::AudioContext::create): + (WebCore::AudioContext::AudioContext): + (WebCore::AudioContext::~AudioContext): + (WebCore::AudioContext::lazyInitialize): + (WebCore::AudioContext::uninitialize): + (WebCore::AudioContext::isInitialized): + (WebCore::AudioContext::isRunnable): + (WebCore::AudioContext::stop): + (WebCore::AudioContext::document): + (WebCore::AudioContext::hasDocument): + (WebCore::AudioContext::refBuffer): + (WebCore::AudioContext::createBuffer): + (WebCore::AudioContext::createBufferSource): + (WebCore::AudioContext::createJavaScriptNode): + (WebCore::AudioContext::createLowPass2Filter): + (WebCore::AudioContext::createHighPass2Filter): + (WebCore::AudioContext::createPanner): + (WebCore::AudioContext::createConvolver): + (WebCore::AudioContext::createAnalyser): + (WebCore::AudioContext::createGainNode): + (WebCore::AudioContext::createDelayNode): + (WebCore::AudioContext::createChannelSplitter): + (WebCore::AudioContext::createChannelMerger): + (WebCore::AudioContext::notifyNodeFinishedProcessing): + (WebCore::AudioContext::derefFinishedSourceNodes): + (WebCore::AudioContext::refNode): + (WebCore::AudioContext::derefNode): + (WebCore::AudioContext::derefUnfinishedSourceNodes): + (WebCore::AudioContext::lock): + (WebCore::AudioContext::tryLock): + (WebCore::AudioContext::unlock): + (WebCore::AudioContext::isAudioThread): + (WebCore::AudioContext::isGraphOwner): + (WebCore::AudioContext::addDeferredFinishDeref): + (WebCore::AudioContext::handlePostRenderTasks): + (WebCore::AudioContext::handleDeferredFinishDerefs): + (WebCore::AudioContext::markForDeletion): + (WebCore::AudioContext::deleteMarkedNodes): + * webaudio/AudioContext.h: Added. + (WebCore::AudioContext::destination): + (WebCore::AudioContext::currentTime): + (WebCore::AudioContext::sampleRate): + (WebCore::AudioContext::listener): + (WebCore::AudioContext::temporaryMonoBus): + (WebCore::AudioContext::temporaryStereoBus): + (WebCore::AudioContext::incrementConnectionCount): + (WebCore::AudioContext::connectionCount): + (WebCore::AudioContext::setAudioThread): + (WebCore::AudioContext::audioThread): + (WebCore::AudioContext::isAudioThreadFinished): + (WebCore::AudioContext::AutoLocker::AutoLocker): + (WebCore::AudioContext::AutoLocker::~AutoLocker): + (WebCore::AudioContext::RefInfo::RefInfo): + * webaudio/AudioContext.idl: Added. + +2010-09-23 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + IndexedDB shouldn't crash on invalid index names + https://bugs.webkit.org/show_bug.cgi?id=46362 + + For now, return null. In a later patch, we'll do proper exception raising. + + * storage/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::index): + +2010-09-23 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dave Hyatt. + + Fix the memory safety issue by checking containerObject is a RenderBox + before doing the transforms. + https://bugs.webkit.org/show_bug.cgi?id=46365 + + Test: compositing/overflow/get-transform-from-non-box-container.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::getTransformFromContainer): + +2010-09-23 David Hyatt <hyatt@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=46314. + + The RenderView's block-flow should match the root element's block-flow. When we create (or re-create) the style for the document, take + the block-flow from the document element's style and use it if it's available. + + Also patch styleDidChange so that if the block-flow changes dynamically after we have already made the document style, we'll propagate + the change back up to the RenderView and have it do a relayout. + + No tests possible yet, since you can't see the document's style anywhere, and block-flow isn't doing anything to affect layout + yet. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::styleForDocument): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::styleDidChange): + +2010-09-23 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: source frame popups shouldn't disappear when hovered + https://bugs.webkit.org/show_bug.cgi?id=46358 + + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._mouseMove): + +2010-09-23 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [Regression][Gtk] Left and Right Arrows no longer function when caret browsing is enabled + https://bugs.webkit.org/show_bug.cgi?id=45375 + + Consider caret browsing for Move commands. + + Test: platform/gtk/editing/selection/caret-mode-left-right-arrows.html + + * editing/EditorCommand.cpp: + (WebCore::createCommandMap): Use "caret browsing aware functions" + as isEnabled() function for those commands moving the caret + forward and backward across characters, words, lines or paragraphs, + not just left and right, as it was the case so far. + +2010-09-23 Brad Moore <bradm@apple.com> + + Reviewed by Dan Bernstein. + + Address a remaining discrepancy in piecewise text measurement + https://bugs.webkit.org/show_bug.cgi?id=45796 + + Don't include always-integral space widths in the floating point accumulator designed + to minimize precision loss. This brings whole-string measurement in line with piecewise + text measurement when dealing with fonts with fractional advances. + + * platform/graphics/WidthIterator.cpp: + (WebCore::WidthIterator::advance): Change the associativity of width addition to minimize precision loss. + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Cleanup network communication code in ResourceHandleWin + https://bugs.webkit.org/show_bug.cgi?id=46200 + + Add logic for request handling directly into ResourceHandle::start and fix style. + Use Unicode instead of ASCII Windows API functions. + + * platform/network/ResourceHandleInternal.h: + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onRequestComplete): + (WebCore::ResourceHandle::start): + +2010-09-23 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Andreas Kling. + + Invalid assertion in ScriptCallback + https://bugs.webkit.org/show_bug.cgi?id=46348 + + Removing invalid ASSERT from method ScriptCallback::call(). + + * bindings/js/ScriptFunctionCall.cpp: + (WebCore::ScriptCallback::call): + +2010-09-23 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Ariya Hidayat. + + [Cairo] Generalize ContextShadow from the Qt port and use it for shadow code + https://bugs.webkit.org/show_bug.cgi?id=45599 + + Make ContextShadow platform-independent and add a Cairo implementation. This is currently + disabled for Cairo, but will be enabled in a followup patch with new baselines. + + No new tests as this does not change functionality. + + * GNUmakefile.am: Update source lists. + * WebCore.pro: Update source lists. + * platform/graphics/ContextShadow.cpp: Added. A generalized version of Qt's ContextShadow. + (WebCore::ContextShadow::ContextShadow): + (WebCore::ContextShadow::clear): + (WebCore::ContextShadow::blurLayerImage): + (WebCore::ContextShadow::calculateMinimalLayerRect): + * platform/graphics/ContextShadow.h: Added. + (WebCore::ContextShadow::offset): + * platform/graphics/cairo/CairoUtilities.cpp: Added. + (WebCore::setSourceRGBAFromColor): A utility to set the source RGBA on a Cairo surface from a WebCore color. + * platform/graphics/cairo/CairoUtilities.h: Added. + * platform/graphics/cairo/ContextShadowCairo.cpp: Added. + (WebCore::purgeScratchBuffer): Static function to purge the shadow buffer. + (WebCore::PurgeScratchBufferTimer::fired): Timer callback. + (WebCore::scheduleScratchBufferPurge): Schedule's a WebCore timer to purge the shadow buffer. + (WebCore::getScratchBuffer): Create or reuse the scratch buffer. + (WebCore::ContextShadow::beginShadowLayer): Added. + (WebCore::ContextShadow::endShadowLayer): Added. + * platform/graphics/gtk/CairoUtilities.cpp: Removed. + * platform/graphics/gtk/CairoUtilities.h: Removed. + * platform/graphics/gtk/GdkCairoUtilities.cpp: Renamed from CairoUtilities.cpp. + (getCairoSurfacePixel): + (getGdkPixbufPixel): + (cairoImageSurfaceToGdkPixbuf): + * platform/graphics/gtk/GdkCairoUtilities.h: Added. + * platform/graphics/gtk/ImageBufferGtk.cpp: + * platform/graphics/gtk/ImageGtk.cpp: + * platform/graphics/qt/ContextShadow.cpp: Removed. + * platform/graphics/qt/ContextShadow.h: Removed. + * platform/graphics/qt/ContextShadowQt.cpp: Added. Adapted from code originally in ContextShadow.cpp. + (WebCore::ShadowBuffer::ShadowBuffer): + (WebCore::ShadowBuffer::scratchImage): + (WebCore::ShadowBuffer::schedulePurge): + (WebCore::ShadowBuffer::timerEvent): + (WebCore::ContextShadow::beginShadowLayer): + (WebCore::ContextShadow::endShadowLayer): + * platform/graphics/qt/FontQt.cpp: + (WebCore::drawTextCommon): Updated to reflect new ContextShadow members. + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::hasShadow): Updated to reflect new ContextShadow members. + (WebCore::GraphicsContext::strokeArc): Ditto. + (WebCore::GraphicsContext::drawConvexPolygon): Ditto. + (WebCore::GraphicsContext::fillPath): Ditto. + (WebCore::GraphicsContext::strokePath): Ditto. + (WebCore::GraphicsContext::fillRect): Ditto. + (WebCore::GraphicsContext::fillRoundedRect): Ditto. + (WebCore::GraphicsContext::setPlatformShadow): Ditto. + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Add internetStatusCallback to ResourceHandleWin. + https://bugs.webkit.org/show_bug.cgi?id=46187 + + Add callback for asynchronous network transfer. + + * platform/network/ResourceHandle.h: + * platform/network/ResourceHandleInternal.h: + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::callOnRedirect): + (WebCore::callOnRequestComplete): + (WebCore::ResourceHandle::internetStatusCallback): + (WebCore::ResourceHandle::onRedirect): + +2010-09-23 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + IDBTransactionCoordinator contains a broken assertion. + https://bugs.webkit.org/show_bug.cgi?id=46356 + + Remove the broken assertion. + + * storage/IDBTransactionCoordinator.cpp: + (WebCore::IDBTransactionCoordinator::processStartedTransactions): + +2010-09-23 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: highlight DOM nodes when navigating the DOM with keyboard + https://bugs.webkit.org/show_bug.cgi?id=46346 + + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype.onselect): + * inspector/front-end/treeoutline.js: + (TreeOutline.prototype._treeKeyDown): + (TreeElement.prototype.selectOnMouseDown): + (TreeElement.prototype.select): + +2010-09-23 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [Chromium] Build broken due to missing include in IDBTransactionBackendImpl.h + https://bugs.webkit.org/show_bug.cgi?id=46352 + + No new tests needed, build fix. + + * storage/IDBTransaction.cpp: + (WebCore::IDBTransaction::objectStore): + * storage/IDBTransactionBackendImpl.h: + +2010-09-23 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + IDBObjectStore::get should run in a transaction. + https://bugs.webkit.org/show_bug.cgi?id=44700 + + Implements logic for running IDBObjectStore::get() in a transaction. + Refactors the pending transaction monitor and the transaction coordinator + to use pointers instead of transaction IDs. + + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::didLeaveScriptContext): + * storage/IDBCursorBackendImpl.cpp: + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::objectStore): + * storage/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::objectStore): + * storage/IDBDatabaseBackendImpl.h: + (WebCore::IDBDatabaseBackendImpl::transactionCoordinator): + * storage/IDBFactoryBackendImpl.cpp: + * storage/IDBFactoryBackendImpl.h: + * storage/IDBFactoryBackendInterface.h: + * storage/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::IDBObjectStore): + (WebCore::IDBObjectStore::get): + * storage/IDBObjectStore.h: + (WebCore::IDBObjectStore::create): + * storage/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBTask::IDBTask): + (WebCore::IDBTask::performTask): + (WebCore::createTask): + (WebCore::IDBObjectStoreBackendImpl::get): + (WebCore::IDBObjectStoreBackendImpl::getInternal): + * storage/IDBObjectStoreBackendImpl.h: + * storage/IDBObjectStoreBackendInterface.h: + * storage/IDBPendingTransactionMonitor.cpp: + (WebCore::IDBPendingTransactionMonitor::addPendingTransaction): + (WebCore::IDBPendingTransactionMonitor::removePendingTransaction): + (WebCore::IDBPendingTransactionMonitor::abortPendingTransactions): + * storage/IDBPendingTransactionMonitor.h: + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::IDBRequest): + (WebCore::IDBRequest::~IDBRequest): + (WebCore::IDBRequest::onSuccess): + (WebCore::IDBRequest::timerFired): + * storage/IDBRequest.h: + (WebCore::IDBRequest::create): + * storage/IDBTransaction.cpp: + (WebCore::IDBTransaction::IDBTransaction): + (WebCore::IDBTransaction::objectStore): + * storage/IDBTransactionBackendImpl.cpp: + (WebCore::IDBTransactionBackendImpl::create): + (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl): + (WebCore::IDBTransactionBackendImpl::objectStore): + (WebCore::IDBTransactionBackendImpl::scheduleTask): + (WebCore::IDBTransactionBackendImpl::abort): + (WebCore::IDBTransactionBackendImpl::didCompleteTaskEvents): + (WebCore::IDBTransactionBackendImpl::run): + (WebCore::IDBTransactionBackendImpl::start): + (WebCore::IDBTransactionBackendImpl::commit): + (WebCore::IDBTransactionBackendImpl::timerFired): + * storage/IDBTransactionBackendImpl.h: + (WebCore::IDBTransactionBackendImpl::~IDBTransactionBackendImpl): + (WebCore::IDBTransactionBackendImpl::isFinished): + * storage/IDBTransactionBackendInterface.h: + * storage/IDBTransactionCoordinator.cpp: + (WebCore::IDBTransactionCoordinator::createTransaction): + (WebCore::IDBTransactionCoordinator::didStartTransaction): + (WebCore::IDBTransactionCoordinator::didFinishTransaction): + (WebCore::IDBTransactionCoordinator::processStartedTransactions): + * storage/IDBTransactionCoordinator.h: + +2010-09-23 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + [WINCE] Remove usage of MemoryManager + https://bugs.webkit.org/show_bug.cgi?id=46206 + + MemoryManager does not provide any extra value, so remove it. + + * page/wince/FrameWinCE.cpp: + (WebCore::imageFromSelection): + * platform/graphics/wince/PlatformPathWinCE.cpp: + (WebCore::drawPolygons): + +2010-09-23 Darin Adler <darin@apple.com> + + Reviewed by Chris Fleizach. + + media/video-controls-with-mutation-event-handler.html crashing + https://bugs.webkit.org/show_bug.cgi?id=46169 + + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlInputElement::MediaControlInputElement): Don't take a type argument. + We can't set the type until after the element is created beacuse of reference counting rules. + (WebCore::MediaControlMuteButtonElement::MediaControlMuteButtonElement): Don't pass the type. + (WebCore::MediaControlMuteButtonElement::create): Set the type. + (WebCore::MediaControlPlayButtonElement::MediaControlPlayButtonElement): More of the same. + (WebCore::MediaControlPlayButtonElement::create): Ditto. + (WebCore::MediaControlSeekButtonElement::MediaControlSeekButtonElement): Ditto. + (WebCore::MediaControlSeekButtonElement::create): Ditto. + (WebCore::MediaControlRewindButtonElement::MediaControlRewindButtonElement): Ditto. + (WebCore::MediaControlRewindButtonElement::create): Ditto. + (WebCore::MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement): Ditto. + (WebCore::MediaControlReturnToRealtimeButtonElement::create): Ditto. + (WebCore::MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement): Ditto. + (WebCore::MediaControlToggleClosedCaptionsButtonElement::create): Ditto. + (WebCore::MediaControlTimelineElement::MediaControlTimelineElement): Ditto. + (WebCore::MediaControlTimelineElement::create): Ditto. + (WebCore::MediaControlVolumeSliderElement::MediaControlVolumeSliderElement): Ditto. + (WebCore::MediaControlVolumeSliderElement::create): Ditto. + (WebCore::MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement): Ditto. + (WebCore::MediaControlFullscreenButtonElement::create): Ditto. + + * rendering/MediaControlElements.h: Removed the type argument from the MediaControlInputElement + constructor. + +2010-09-22 Luke Macpherson <macpherson@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Don't allow empty strings as tokens in xmlhttprequest, as per rfc2616 section 2.2. + + XMLHttpRequest: setRequestHeader() does not throw SYNTAX_ERR exception if the header field name is empty + https://bugs.webkit.org/show_bug.cgi?id=46151 + + Test: http/tests/xmlhttprequest/xmlhttprequest-setrequestheader-no-name.html + + * xml/XMLHttpRequest.cpp: + (WebCore::isValidToken): + +2010-09-22 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Adam Barth. + + [BREWMP] Enable touch events + https://bugs.webkit.org/show_bug.cgi?id=46321 + + Enable TOUCH_EVENTS by porting PlatformTouchEvent and PlatformTouchPoint. + Brew MP does not support multi touch, so enable only single touch for now. + + * platform/PlatformTouchEvent.h: + * platform/PlatformTouchPoint.h: + * platform/brew/PlatformTouchEventBrew.cpp: Added. + (WebCore::PlatformTouchEvent::PlatformTouchEvent): + * platform/brew/PlatformTouchPointBrew.cpp: Added. + (WebCore::PlatformTouchPoint::PlatformTouchPoint): + +2010-09-22 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r61285): Microsoft Entourage 2008 does not invoke My Day window + https://bugs.webkit.org/show_bug.cgi?id=46334 + + * WebCore.exp.in: Export __ZN7WebCore27applicationIsMicrosoftMyDayEv. + * platform/mac/RuntimeApplicationChecks.h: + * platform/mac/RuntimeApplicationChecks.mm: + (WebCore::applicationIsMicrosoftMyDay): Determine if the embeddding + application is Microsoft My Day by checking the bundle identifier. + +2010-09-22 Andy Estes <aestes@apple.com> + + Rubber-stamped by Darin Adler. + + Fix a typo and correct an inaccurate phrase in a comment. + + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processEndTag): + +2010-09-22 Andy Estes <aestes@apple.com> + + Reviewed by Adam Barth. + + REGRESSION (r61285): <script /> parses differently in HTML5 + https://bugs.webkit.org/show_bug.cgi?id=42909 + + If pre-HTML5 parser quirks are enabled, the HTMLTreeBuilder should + handle self-closing script tags like the old parser did. Specifically, + "<script />" should be treated as "<script></script>". + + * html/parser/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::HTMLDocumentParser): Instantiate + HTMLTreeBuilder with the value of usePreHTML5ParserQuirks(). + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + (WebCore::HTMLTreeBuilder::processEndTag): If the tokenizer is not + currently in DataState, this means that the current end token is fake + and was created by the tree builder to handle a self-closing script tag. + Assert that pre-HTML5 quirks are enabled and set the tokenizer's state + to DataState in this case. + (WebCore::HTMLTreeBuilder::processStartTagForInHead): If pre-HTML5 + parser quirks are enabled and the script tag is self-closing, create and + procses a fake script end tag. + * html/parser/HTMLTreeBuilder.h: + (WebCore::HTMLTreeBuilder::create): + +2010-09-22 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] User style layout tests don't pass on Chromium + https://bugs.webkit.org/show_bug.cgi?id=46069 + + Instead of making resetUserStyleCacheInAllFrames be a no-op for + Chromium, have it be controlled by a UserStyleInjectionTime enum. + + Also move the UserStyleSheet::Level enum to be inside + UserStyleSheetTypes for consistency. + + * WebCore.exp.in: + * dom/Document.cpp: + (WebCore::Document::pageGroupUserSheets): + * page/PageGroup.cpp: + (WebCore::PageGroup::addUserStyleSheetToWorld): + * page/PageGroup.h: + * page/UserStyleSheet.h: + (WebCore::UserStyleSheet::UserStyleSheet): + (WebCore::UserStyleSheet::level): + * page/UserStyleSheetTypes.h: + +2010-09-22 Ruben <chromium@hybridsource.org> + + Reviewed by Tony Chang. + + [chromium] added ifdefs for FreeBSD support + https://bugs.webkit.org/show_bug.cgi?id=46316 + + * bindings/js/JSInspectorFrontendHostCustom.cpp: + (WebCore::JSInspectorFrontendHost::platform): + * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp: + (WebCore::V8InspectorFrontendHost::platformCallback): + * dom/SelectElement.cpp: + * loader/CachedFont.cpp: + * page/EventHandler.cpp: + * page/chromium/EventHandlerChromium.cpp: + * platform/Scrollbar.cpp: + * platform/chromium/ChromiumBridge.h: + * platform/graphics/chromium/FontPlatformData.h: + * platform/graphics/skia/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::~FontCustomPlatformData): + (WebCore::FontCustomPlatformData::fontPlatformData): + (WebCore::createFontCustomPlatformData): + * platform/graphics/skia/FontCustomPlatformData.h: + +2010-09-22 Rafael Antognolli <antognolli@profusion.mobi> + + Unreviewed build fix. + + [EFL] Fix build due to latest EFL (Edje) changes. + https://bugs.webkit.org/show_bug.cgi?id=46317 + + Make the change int -> Edje_Load_Error (enum). + + No new functionality, so no new tests. + + * platform/efl/RenderThemeEfl.cpp: + (WebCore::RenderThemeEfl::themePartCacheEntryReset): + (WebCore::RenderThemeEfl::createEdje): + (WebCore::RenderThemeEfl::applyPartDescriptions): + * platform/efl/ScrollbarEfl.cpp: + (ScrollbarEfl::setParent): + +2010-09-22 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + AX: aria-hidden change doesn't update the ax tree + https://bugs.webkit.org/show_bug.cgi?id=45836 + + Test: accessibility/aria-hidden-update.html + + * dom/Element.cpp: + (WebCore::Element::updateAfterAttributeChanged): + +2010-09-22 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dumitru Daniliuc. + + [FileSystem] Fix Flags handling in DirectoryEntry custom binding code + https://bugs.webkit.org/show_bug.cgi?id=46028 + + Do not use adoptRef to get RefPtr from a raw pointer that is already + adopted in toNative/toJS. + + Test: fast/filesystem/flags-passing.html + + * bindings/js/JSDirectoryEntryCustom.cpp: + (WebCore::JSDirectoryEntry::getFile): + (WebCore::JSDirectoryEntry::getDirectory): + * bindings/v8/custom/V8DirectoryEntryCustom.cpp: + (WebCore::V8DirectoryEntry::getDirectoryCallback): + (WebCore::V8DirectoryEntry::getFileCallback): + +2010-09-22 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Need to stop autocorrection panel timer when selection changes. + https://bugs.webkit.org/show_bug.cgi?id=46201 + <rdar://problem/8441042> + + * editing/Editor.cpp: + (WebCore::Editor::appliedEditing): Stop correction timer after editing. + (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): When text checking is done for + showing autocorrection panel, we suppress all corrections that are not at the end of + text checking range. So that we don't replace other words while showing correction panel + for the last word. + (WebCore::Editor::stopCorrectionPanelTimer): Stop correction timer. + + * editing/Editor.h: Added stopCorrectionPanelTimer() method. + +2010-09-22 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Add Chromium implementation for FileWriter + https://bugs.webkit.org/show_bug.cgi?id=44361 + + No new tests; the implementation's not yet far enough along for that. + + This makes a chain of contruction-and-linking-up for various sorts of + FileWriter interfaces to call through to Chromium, and for various + sorts of FileWriterClients to call back, with object ownership always + pointing towards the Chromium API. That is, the DOM object owns an + AsyncFileWriter, which owns its implementation object, and the reverse + (client) direction is raw pointers. + + File metadata is looked up before the FileWriter is returned, so that + we know the file exists and can cache its length. + + The WebCore part of this is simple and generic enough to handle + Chromium, so it should be easy for me to put in a WebCore-only + implementation next. + + * fileapi/AsyncFileWriter.h: + * fileapi/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::createWriter): + * fileapi/DOMFileSystem.h: + * fileapi/FileSystemCallbacks.cpp: + (WebCore::FileSystemCallbacksBase::didCreateFileWriter): + (WebCore::FileWriterCallbacks::FileWriterCallbacks): + (WebCore::FileWriterCallbacks::didCreateFileWriter): + * fileapi/FileSystemCallbacks.h: + * platform/AsyncFileSystem.h: + * platform/AsyncFileSystemCallbacks.h: + +2010-09-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=46222 + <rdar://problem/8461701> Document.getElementById() malfunctions if ID was changed via Attr node modification. + + Test: fast/dom/Attr/change-id-via-attr-node-value.html + + * dom/Attr.h: + * dom/Attr.cpp: + (WebCore::Attr::setValue): Separated a version callable from WebCore from one avaiable to JS. + Attr::setValue() can be called from Element::setAttribute(), and we don't want to update + m_elementsById (or to call attributeChanged()) twice in that case. + (WebCore::Attr::childrenChanged): If Attr's node children change, id changes. + + * dom/Document.cpp: (WebCore::Document::removeElementById): Added an assertion that we are + not trying to remove something that isn't there. If we are, we probably failed to update + m_elementsById earlier. + + * dom/Element.cpp: (WebCore::Element::setAttribute): If the attribute has an Attr node, its + children should be updated to match attribute value. + +2010-09-22 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46311, lock form controls and replaced elements to vertical block flow. + + Patch form controls that don't use RenderReplaced by hand in html.css. Patch all RenderReplaced elements + with an override of setStyle that forces the new style to have a vertical block flow. We have to do something like + this to cover the CSS3 content: url(img) method of image replacement. + + * css/html.css: + (input, textarea, keygen, select, button, isindex, meter, progress): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::setStyle): + * rendering/RenderReplaced.h: + +2010-09-22 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46304 + + display:inline should become display:inline-block when an object's block flow does not match its parent's block flow. + + Added fast/blockflow/display-mutation.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::styleForElement): + (WebCore::CSSStyleSelector::pseudoStyleForElement): + (WebCore::CSSStyleSelector::adjustRenderStyle): + * css/CSSStyleSelector.h: + +2010-09-22 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Martin Robinson. + + [Gtk] object:text-changed events should be emitted for entries and password text + https://bugs.webkit.org/show_bug.cgi?id=25898 + + Implement proper 'text-changed' signal emission for the GTK port + + Call deleteTextFromNode() when needed while removing text nodes. + Do it even when removeNode() is going to be called afterwards, in + order to allow accessibility to get properly notified about the + text being removed alongside with that node. + + * editing/DeleteSelectionCommand.cpp: + (WebCore::DeleteSelectionCommand::handleGeneralDelete): + + New function in AXObjectCache to call when text changes in a node. + Added one new function to allow notifying something changed in a + text node through the associated RenderObject, making such a + function dependant on the platform-specific implementation, + provided through a protected function (provided a proper + implementation for the GTK port and a dummy one for the others). + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::nodeTextChangeNotification): New + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::AXTextChange): New enumeration + (WebCore::AXObjectCache::nodeTextChangeNotification): New + (WebCore::AXObjectCache::nodeTextChangePlatformNotification): New + * accessibility/AccessibilityRenderObject.h: + (WebCore::toAccessibilityRenderObject): + * accessibility/chromium/AXObjectCacheChromium.cpp: + (WebCore::AXObjectCache::nodeTextChangePlatformNotification): New + * accessibility/gtk/AXObjectCacheAtk.cpp: + (WebCore::emitTextChanged): + (WebCore::AXObjectCache::nodeTextChangePlatformNotification): New + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::nodeTextChangePlatformNotification): New + * accessibility/win/AXObjectCacheWin.cpp: + (WebCore::AXObjectCache::nodeTextChangePlatformNotification): New + + Notify accessibility when something changes in a text node. + Call to AXObjectCache::nodeTextChangeNotification() to notify when + text was inserted/deleted when applying/unapplying a text edition + command, along with the offset in the original text where the + change took place and the number of characters that got affected. + + * editing/AppendNodeCommand.cpp: + (WebCore::sendAXTextChangedIgnoringLineBreaks): + (WebCore::AppendNodeCommand::doApply): + (WebCore::AppendNodeCommand::doUnapply): + * editing/DeleteFromTextNodeCommand.cpp: + (WebCore::DeleteFromTextNodeCommand::doApply): + (WebCore::DeleteFromTextNodeCommand::doUnapply): + * editing/InsertIntoTextNodeCommand.cpp: + (WebCore::InsertIntoTextNodeCommand::doApply): + (WebCore::InsertIntoTextNodeCommand::doUnapply): + * editing/InsertNodeBeforeCommand.cpp: + (WebCore::InsertNodeBeforeCommand::doApply): + (WebCore::InsertNodeBeforeCommand::doUnapply): + (WebCore::DeleteSelectionCommand::handleGeneralDelete): + +2010-09-22 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46298, add logicalWidth/Height getters/setters to RenderBox. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::logicalWidth): + (WebCore::RenderBox::logicalHeight): + (WebCore::RenderBox::setLogicalWidth): + (WebCore::RenderBox::setLogicalHeight): + * rendering/RenderBox.h: + +2010-09-22 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Oliver Hunt. + + Script engine agnostic ScriptCallback class + https://bugs.webkit.org/show_bug.cgi?id=43216 + + Refactoring class ScriptFunctionCall to create a class (ScriptCallback) that + receives a script function as a ScriptValue and calls that function with provided parameters. + + * bindings/js/ScriptFunctionCall.cpp: + (WebCore::ScriptCallArgumentHandler::appendArgument): + (WebCore::ScriptFunctionCall::ScriptFunctionCall): + (WebCore::ScriptCallback::ScriptCallback): + (WebCore::ScriptCallback::call): + * bindings/js/ScriptFunctionCall.h: + (WebCore::ScriptCallArgumentHandler::ScriptCallArgumentHandler): + * bindings/v8/ScriptFunctionCall.cpp: + (WebCore::ScriptCallArgumentHandler::appendArgument): + (WebCore::ScriptFunctionCall::ScriptFunctionCall): + (WebCore::ScriptCallback::ScriptCallback): + (WebCore::ScriptCallback::call): + * bindings/v8/ScriptFunctionCall.h: + (WebCore::ScriptCallArgumentHandler::ScriptCallArgumentHandler): + +2010-09-22 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed. + + Build fix for invalid assertion after r68059. + + * editing/ApplyStyleCommand.cpp: + (WebCore::getPropertiesNotIn): Correct assertion target after + name change. + +2010-09-22 David Hyatt <hyatt@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=45957, fix regression in column rules stacking test. + + Rewrite how the pagination bit gets set in RenderLayers, since it was totally broken and not + accounting for whether or not the columns block was even in the layer's containing block + hierarchy. + + * rendering/RenderLayer.cpp: + (WebCore::checkContainingBlockChainForPagination): + (WebCore::RenderLayer::updatePagination): + +2010-09-22 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed. + + [WinCairo] Build fix for platform/cairo stuff after r67981. + + * WebCore.vcproj/WebCore.vcproj: Add new files needed by all cairo + ports. + +2010-09-22 Erik Arvidsson <arv@chromium.org> + + Reviewed by Nate Chapin. + + [Chromium] Fix memory model for dataset + https://bugs.webkit.org/show_bug.cgi?id=46280 + + This is covered by existing tests. + + * bindings/v8/custom/V8DOMStringMapCustom.cpp: + (WebCore::toV8): + +2010-09-22 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dave Hyatt. + + Fix wrong casts for table cell since its parent is not a RenderBlock. Remove + the redundant destroy call for empty anonymous columns or column span block. + https://bugs.webkit.org/show_bug.cgi?id=46245 + + Tests: fast/table/table-anonymous-block-destroy-crash.html + fast/table/table-columns-blocks-calc-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::addChildToAnonymousColumnBlocks): + (WebCore::RenderBlock::columnsBlockForSpanningElement): + (WebCore::RenderBlock::removeChild): + +2010-09-22 Matt Perry <mpcomplete@chromium.org> + + Reviewed by Darin Fisher. + + Trying to reland a version of r67749: + Have V8DOMWindowShell ask the embedder whether to run a V8 extension + in a particular script context. + https://bugs.webkit.org/show_bug.cgi?id=45721 + + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::createNewContext): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::registerExtension): + * bindings/v8/V8Proxy.h: + * loader/EmptyClients.h: + (WebCore::EmptyFrameLoaderClient::allowScriptExtension): + * loader/FrameLoaderClient.h: + +2010-09-22 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Darin Adler. + + queryCommandState returns false for Underline command when no selection is made + https://bugs.webkit.org/show_bug.cgi?id=17594 + + The bug was caused by selectionComputedStyle's adding -webkit-text-decorations-in-effect property + to a dummy span used to obtain the computed style when there is a typing style. + Since this property is for internal use only, the CSS parser always stripped the property. + As a result, we were always ignoring the text decorations set by the typing style. + + Fixed the bug by making selectionComputedStyle directly merge the computed style of the current + caret position and the typing style. This also eliminates the need for a dummy span element. + Due to the merge, the return value of selectionComputedStyle had to be changed to CSSMutableStyleDeclaration + from CSSComputedStyleDeclaration. + + Test: editing/execCommand/query-text-decoration-with-typing-style.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::StyleChange::init): Calls getPropertiesNotIn. + (WebCore::getPropertiesNotIn): Renamed from getPropertiesNotInComputedStyle since it takes + CSSStyleDeclaration* instead of CSSComputedStyleDeclaration* for the second argument. + (WebCore::ApplyStyleCommand::removeNonEditingProperties): Extracted from editingStyleAtPosition. + (WebCore::ApplyStyleCommand::editingStyleAtPosition): Calls removeNonEditingProperties. + * editing/ApplyStyleCommand.h: + * editing/Editor.cpp: + (WebCore::triStateOfStyle): Calls getPropertiesNotIn. Renamed from triStateOfStyleInComputedStyle + since it no longer takes CSSComputedStyleDeclaration. + (WebCore::Editor::selectionStartHasStyle): Calls selectionComputedStyle and triStateOfStyle. + (WebCore::Editor::selectionHasStyle): Ditto. + (WebCore::Editor::selectionStartCSSPropertyValue): Calls selectionComputedStyle. + (WebCore::Editor::selectionComputedStyle): See above. + * editing/Editor.h: + * editing/EditorCommand.cpp: + (WebCore::executeToggleStyleInList): Calls selectionComputedStyle. + +2010-09-22 Jamey Hicks <jamey.hicks@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Web Inspector: Remote Web Inspector support for QtWebKit + https://bugs.webkit.org/show_bug.cgi?id=43988 + + Runs a web debug server on port specified by QtTestBrowser + argument -remote-inspector-port. Property + _q_webInspectorServerPort of the QWebPage instance will be set + according to the argument. All pages with that property set will + be remotely inspectable. + + URL for remote inspection of first QWebPage is + http://localhost:9222/webkit/inspector/inspector.html?page=1 + where 1 is the number of the QWebPage instance. + + The base URL yields an index page with links to the individual inspectors: + http://localhost:9222/ + + * WebCore.pro + +2010-09-21 Darin Adler <darin@apple.com> + + Reviewed by Anders Carlsson. + + Fix some Objective-C GC problems and use RetainPtr instead of HardRetain/Release + https://bugs.webkit.org/show_bug.cgi?id=46220 + + * WebCore.exp.in: Updated. + + * bindings/objc/ObjCEventListener.h: Use a RetainPtr for m_listener, since that + will do a CFRetain, which is right for GC rather than an -[NSObject retain], + which is not. + * bindings/objc/ObjCEventListener.mm: + (WebCore::ObjCEventListener::ObjCEventListener): Removed explicit retain. + (WebCore::ObjCEventListener::~ObjCEventListener): Removed explicit release and + added get(). + (WebCore::ObjCEventListener::handleEvent): Added get(); + + * bridge/objc/objc_instance.mm: + (ObjcInstance::setGlobalException): Use copy/release instead of + HardRetain/HardRelease. + (ObjcInstance::moveGlobalExceptionToExecState): Ditto. + + * platform/Cursor.h: Use RetainPtr for PlatformCursor on Mac. + + * platform/Cursor.cpp: + (WebCore::Cursor::platformCursor): Moved this to CursorMac for the Mac. + + * platform/Widget.cpp: Removed retain/releasePlatformWidget and made them + both inlines in the header file. + + * platform/Widget.h: Fixed includes and added an include of RetainPtr. + Made platformWidget and setPlatformWidget non-inline on the Mac platform. + Made releasePlatformWidget and retainPlatformWidget empty inline functions + for non-GTK platforms. + + * platform/graphics/mac/ImageMac.mm: Removed unneeded FoundationExtras.h + include. + + * platform/mac/ClipboardMac.mm: + (WebCore::cocoaTypeFromHTMLClipboardType): use RetainPtr for the return type. + (WebCore::ClipboardMac::clearData): Use RetainPtr. + (WebCore::ClipboardMac::getData): Ditto. + (WebCore::ClipboardMac::setData): Ditto. + + * platform/mac/CursorMac.mm: + (WebCore::createCustomCursor): Use RetainPtr for the return type. + (WebCore::Cursor::ensurePlatformCursor): Removed all the calls to HardRetain + since m_platformCursor is now a RetainPtr. + (WebCore::Cursor::Cursor): Ditto. + (WebCore::Cursor::operator=): Ditto. Also HardRelease. + (WebCore::Cursor::~Cursor): Ditto. + (WebCore::Cursor::platformCursor): Use get here. + + * platform/mac/FoundationExtras.h: Removed all the functions except for + HardAutorelease. Later we can remove that one too. + + * platform/mac/ThemeMac.mm: + (WebCore::setUpButtonCell): Changed this function to have a return value. + Otherwise we end up taking a pointer (actually a reference) to a global + variable, which does not do the right thing for GC. + (WebCore::nonDefaultButton): Added. + (WebCore::defaultButton): Added. + (WebCore::button): Changed to call two separate functions with two separate + global variables to avoid the problem with pointers to globals. + + * platform/mac/WidgetMac.mm: + (WebCore::Widget::~Widget): Removed unneeded call to releasePlatformWidget. + (WebCore::Widget::platformWidget): Non-inline so we can comipile the header + plain non-Objective-C C++. + (WebCore::Widget::setPlatformWidget): Ditto. + + * platform/network/mac/WebCoreURLResponse.mm: + (mimeTypeFromUTITree): Use RetainPtr for the return type. + (-[NSURLResponse adjustMIMETypeIfNecessary]): Use RetainPtr. + +2010-09-22 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] r68027 caused many crashes on the bots + https://bugs.webkit.org/show_bug.cgi?id=46268 + + Add the appropriate OwnPtrCairo.h include which has the OwnPtr + specialization for Cairo paths. Without it, we will have memory + corruption. + + * platform/graphics/cairo/PathCairo.cpp: Add OwnPtrCairo.h include. + +2010-09-22 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: implement pausing on XHR + https://bugs.webkit.org/show_bug.cgi?id=46086 + + * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: + (WebCore::V8XMLHttpRequest::sendCallback): + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::setNativeBreakpoint): + (WebCore::InspectorController::removeNativeBreakpoint): + (WebCore::InspectorController::willInsertDOMNodeImpl): + (WebCore::InspectorController::willRemoveDOMNodeImpl): + (WebCore::InspectorController::willModifyDOMAttrImpl): + (WebCore::InspectorController::instrumentWillSendXMLHttpRequestImpl): + * inspector/InspectorController.h: + (WebCore::InspectorController::instrumentWillSendXMLHttpRequest): + (WebCore::InspectorController::inspectorControllerForScriptExecutionContext): + (WebCore::InspectorController::inspectorControllerForNode): + (WebCore::InspectorController::inspectorControllerForDocument): + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent): + (WebCore::InspectorDebuggerAgent::didPause): + (WebCore::InspectorDebuggerAgent::breakProgram): + * inspector/InspectorDebuggerAgent.h: + * inspector/InspectorTimelineAgent.h: + * inspector/front-end/CallStackSidebarPane.js: + (WebInspector.CallStackSidebarPane.prototype.updateStatus): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel): + (WebInspector.ElementsPanel.prototype.reset): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype.debuggerPaused): + (WebInspector.ScriptsPanel.prototype.reset): + * inspector/front-end/Settings.js: + * xml/XMLHttpRequest.h: + (WebCore::XMLHttpRequest::url): + +2010-09-22 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + Add local triangulation of cubic curve control points + https://bugs.webkit.org/show_bug.cgi?id=45252 + + Adding a localized triangulation algorithm which takes as input + the four control points of a cubic curve segment and provides both + triangles as well as the ability to walk the interior edges. The + latter will be used later to fill the interior of shapes bounded + by these cubic curves, quadratic curves and line segments. + + * platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp: Added. + (WebCore::LoopBlinnLocalTriangulator::Triangle::contains): + (WebCore::LoopBlinnLocalTriangulator::Triangle::nextVertex): + (WebCore::LoopBlinnLocalTriangulator::Triangle::indexForVertex): + (WebCore::LoopBlinnLocalTriangulator::Triangle::makeCounterClockwise): + (WebCore::LoopBlinnLocalTriangulator::LoopBlinnLocalTriangulator): + (WebCore::LoopBlinnLocalTriangulator::reset): + (WebCore::LoopBlinnLocalTriangulator::triangulate): + (WebCore::LoopBlinnLocalTriangulator::triangulateHelper): + (WebCore::LoopBlinnLocalTriangulator::addTriangle): + (WebCore::LoopBlinnLocalTriangulator::addInteriorVertex): + (WebCore::LoopBlinnLocalTriangulator::isSharedEdge): + * platform/graphics/gpu/LoopBlinnLocalTriangulator.h: Added. + (WebCore::LoopBlinnLocalTriangulator::Vertex::Vertex): + (WebCore::LoopBlinnLocalTriangulator::Vertex::xyCoordinates): + (WebCore::LoopBlinnLocalTriangulator::Vertex::klmCoordinates): + (WebCore::LoopBlinnLocalTriangulator::Vertex::set): + (WebCore::LoopBlinnLocalTriangulator::Vertex::end): + (WebCore::LoopBlinnLocalTriangulator::Vertex::setEnd): + (WebCore::LoopBlinnLocalTriangulator::Vertex::marked): + (WebCore::LoopBlinnLocalTriangulator::Vertex::setMarked): + (WebCore::LoopBlinnLocalTriangulator::Vertex::interior): + (WebCore::LoopBlinnLocalTriangulator::Vertex::setInterior): + (WebCore::LoopBlinnLocalTriangulator::Vertex::resetFlags): + (WebCore::LoopBlinnLocalTriangulator::Triangle::Triangle): + (WebCore::LoopBlinnLocalTriangulator::Triangle::getVertex): + (WebCore::LoopBlinnLocalTriangulator::Triangle::setVertices): + (WebCore::LoopBlinnLocalTriangulator::getVertex): + (WebCore::LoopBlinnLocalTriangulator::numberOfTriangles): + (WebCore::LoopBlinnLocalTriangulator::getTriangle): + (WebCore::LoopBlinnLocalTriangulator::numberOfInteriorVertices): + (WebCore::LoopBlinnLocalTriangulator::getInteriorVertex): + +2010-09-22 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Unreviewed, EFL build fix. + + * CMakeListsEfl.txt: + * platform/efl/ClipboardEfl.cpp: + (WebCore::ClipboardEfl::ClipboardEfl): + +2010-09-22 İsmail Dönmez <ismail@namtrac.org> + + Reviewed by Andreas Kling. + + [Qt] Build fix for WinCE + + Add two missing stubs: + - privateBrowsingStateChanged(bool) + - bindingInstance() + + * platform/qt/TemporaryLinkStubsQt.cpp: + (PluginView::privateBrowsingStateChanged): + (PluginView::bindingInstance): + +2010-09-22 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] FontCustomPlatformData.cpp leaks FT_Faces + https://bugs.webkit.org/show_bug.cgi?id=16941 + + Attach lifetime of the FontCustomPlatformData FT_Face to the resulting cairo_font_face_t. + This will free the memory associated with the FT_Face once the cairo_font_face_t is + destroyed. + + No new tests as functionality should not change. + + * platform/graphics/cairo/FontCustomPlatformData.cpp: + (WebCore::releaseCustomFontData): Moved this helper method to the top of the file + and gave it a more descriptive name. + (WebCore::FontCustomPlatformData::FontCustomPlatformData): Changed the constructor to + take the FT_Face and the buffer, so to better encapsulate the creation of the cairo + face. + (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Added a comment about the + fate of the FT_Face to the destructor. + (WebCore::createFontCustomPlatformData): Cleaned up the code here and moved some of the + logic into the constructor. + * platform/graphics/cairo/FontCustomPlatformData.h: Updated method definitions. + +2010-09-22 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + PluginStrategy should satisfy the needs of Qt + https://bugs.webkit.org/show_bug.cgi?id=45857 + No new functionality so no new tests. + + * plugins/PluginData.cpp: + (WebCore::PluginData::initPlugins): + * plugins/PluginStrategy.h: Added a |const Page*| argument to getPluginInfo. + +2010-09-22 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Elements panel does not reflect changes to the text node values. + https://bugs.webkit.org/show_bug.cgi?id=46166 + + * dom/CharacterData.cpp: + (WebCore::CharacterData::dispatchModifiedEvent): + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::characterDataModifiedImpl): + * inspector/InspectorController.h: + (WebCore::InspectorController::characterDataModified): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::characterDataModified): + * inspector/InspectorDOMAgent.h: + (WebCore::EventListenerInfo::EventListenerInfo): + (WebCore::InspectorDOMAgent::create): + (WebCore::InspectorDOMAgent::cast): + (WebCore::InspectorDOMAgent::cssStore): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent.prototype._characterDataModified): + (WebInspector.characterDataModified): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype._characterDataModified): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted): + +2010-09-21 Ragner Magalhaes <ragner.magalhaes@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] On Maemo platform, web style is missing for some inputs + https://bugs.webkit.org/show_bug.cgi?id=46182 + + * css/themeQtMaemo5.css: + +2010-09-22 Patrick Gansterer <paroga@webkit.org> + + Unreviewed. + + [WINCE] Build fix for ResourceHandleWin after r67291. + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::loadResourceSynchronously): Replace Frame* parameter with NetworkingContext*. + +2010-09-22 Chris Guillory <chris.guillory@google.com> + + Reviewed by Chris Fleizach. + + Crash due to bad cast in AXObjectCacheChromium.cpp. + https://bugs.webkit.org/show_bug.cgi?id=46237 + + * accessibility/chromium/AXObjectCacheChromium.cpp: + (WebCore::AXObjectCache::postPlatformNotification): + * page/ChromeClient.h: + (WebCore::ChromeClient::postAccessibilityNotification): + (WebCore::ChromeClient::didChangeAccessibilityObjectState): + (WebCore::ChromeClient::didChangeAccessibilityObjectChildren): + * page/chromium/ChromeClientChromium.h: + +2010-09-22 Chris Rogers <crogers@google.com> + + Reviewed by James Robinson. + + Add HRTFElevation files + https://bugs.webkit.org/show_bug.cgi?id=45864 + + No new tests since audio API is not yet implemented. + + * platform/audio/HRTFElevation.cpp: Added. + (WebCore::HRTFElevation::calculateSymmetricKernelsForAzimuthElevation): + (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation): + (WebCore::HRTFElevation::createForSubject): + (WebCore::HRTFElevation::createByInterpolatingSlices): + (WebCore::HRTFElevation::getKernelsFromAzimuth): + * platform/audio/HRTFElevation.h: Added. + (WebCore::HRTFElevation::kernelListL): + (WebCore::HRTFElevation::kernelListR): + (WebCore::HRTFElevation::elevationAngle): + (WebCore::HRTFElevation::numberOfAzimuths): + (WebCore::HRTFElevation::sampleRate): + (WebCore::HRTFElevation::HRTFElevation): + +2010-09-22 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [gtk] Use the smart pointers to handle cairo_path_t + https://bugs.webkit.org/show_bug.cgi?id=46212 + + Modified the code to use smart pointers with cairo_path_t + variables. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::appendPathToCairoContext): + (WebCore::GraphicsContext::clip): + (WebCore::GraphicsContext::drawTiledShadow): + * platform/graphics/cairo/PathCairo.cpp: + (WebCore::Path::Path): + (WebCore::Path::operator=): + (WebCore::Path::apply): + (WebCore::Path::debugString): + +2010-09-22 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Implement Image::loadPlatformResource + https://bugs.webkit.org/show_bug.cgi?id=45873 + + Load images from the resource directory. + + * platform/graphics/brew/ImageBrew.cpp: Added. + (WebCore::Image::loadPlatformResource): + +2010-09-22 Chris Rogers <crogers@google.com> + + Reviewed by James Robinson. + + Add HRTFKernel files + https://bugs.webkit.org/show_bug.cgi?id=45863 + + No new tests since audio API is not yet implemented. + + * platform/audio/HRTFKernel.cpp: Added. + (WebCore::extractAverageGroupDelay): + (WebCore::HRTFKernel::HRTFKernel): + (WebCore::HRTFKernel::createImpulseResponse): + (WebCore::HRTFKernel::createInterpolatedKernel): + * platform/audio/HRTFKernel.h: Added. + (WebCore::HRTFKernel::create): + (WebCore::HRTFKernel::fftFrame): + (WebCore::HRTFKernel::fftSize): + (WebCore::HRTFKernel::frameDelay): + (WebCore::HRTFKernel::sampleRate): + (WebCore::HRTFKernel::nyquist): + (WebCore::HRTFKernel::HRTFKernel): + +2010-09-22 Kent Tamura <tkent@chromium.org> + + Reviewed by Chris Fleizach. + + Support keyboard operations for <input type=range>. + https://bugs.webkit.org/show_bug.cgi?id=45803 + + Increasing the value with Up/Right arrow keys by its step value, + and decreasing with Down/Left arrow keys. If an input element has + step=any attribute, increasing/decreasing by 1/100 of max-min. + + Note: This change is not useful on Mac because users can't set + focus on range controls. + + Test: fast/forms/range-keyoperation.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::defaultEventHandler): + Calls handleKeyEventForRange() for RANGE and key events. + (WebCore::HTMLInputElement::handleKeyEventForRange): + * html/HTMLInputElement.h: Add handleKeyEventForRange() declaration. + +2010-09-22 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [Gtk] Incorrect exposure of list items whose children are elements + https://bugs.webkit.org/show_bug.cgi?id=45383 + + Set ATK_ROLE_LIST_ITEM looking for the role of the parent object + + Test: platform/gtk/accessibility/list-items-always-exposed.html + + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): + Always include objects with ListItemRole in accessibility for GTK. + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (getInterfaceMaskFromObject): Add some specific code to handle the + special case of list markers by implementing AtkText when needed. + +2010-09-22 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + Make FilterEffects independent of SVG + https://bugs.webkit.org/show_bug.cgi?id=46177 + + Moving all FilterEffects from svg/graphics/filters to platform/graphics/filters, now that they + are independent of SVG. Removed the SVG prefix of the files and updated the headers. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/filters/DistantLightSource.h: Copied from WebCore/svg/graphics/filters/SVGDistantLightSource.h. + * platform/graphics/filters/FEConvolveMatrix.cpp: Copied from WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp. + * platform/graphics/filters/FEConvolveMatrix.h: Copied from WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h. + * platform/graphics/filters/FEDiffuseLighting.cpp: Copied from WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp. + * platform/graphics/filters/FEDiffuseLighting.h: Copied from WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h. + * platform/graphics/filters/FEDisplacementMap.cpp: Copied from WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp. + * platform/graphics/filters/FEDisplacementMap.h: Copied from WebCore/svg/graphics/filters/SVGFEDisplacementMap.h. + * platform/graphics/filters/FEFlood.cpp: Copied from WebCore/svg/graphics/filters/SVGFEFlood.cpp. + * platform/graphics/filters/FEFlood.h: Copied from WebCore/svg/graphics/filters/SVGFEFlood.h. + * platform/graphics/filters/FELighting.cpp: Copied from WebCore/svg/graphics/filters/SVGFELighting.cpp. + * platform/graphics/filters/FELighting.h: Copied from WebCore/svg/graphics/filters/SVGFELighting.h. + * platform/graphics/filters/FEMerge.cpp: Copied from WebCore/svg/graphics/filters/SVGFEMerge.cpp. + * platform/graphics/filters/FEMerge.h: Copied from WebCore/svg/graphics/filters/SVGFEMerge.h. + * platform/graphics/filters/FEMorphology.cpp: Copied from WebCore/svg/graphics/filters/SVGFEMorphology.cpp. + * platform/graphics/filters/FEMorphology.h: Copied from WebCore/svg/graphics/filters/SVGFEMorphology.h. + * platform/graphics/filters/FEOffset.cpp: Copied from WebCore/svg/graphics/filters/SVGFEOffset.cpp. + * platform/graphics/filters/FEOffset.h: Copied from WebCore/svg/graphics/filters/SVGFEOffset.h. + * platform/graphics/filters/FESpecularLighting.cpp: Copied from WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp. + * platform/graphics/filters/FESpecularLighting.h: Copied from WebCore/svg/graphics/filters/SVGFESpecularLighting.h. + * platform/graphics/filters/FETile.cpp: Copied from WebCore/svg/graphics/filters/SVGFETile.cpp. + * platform/graphics/filters/FETile.h: Copied from WebCore/svg/graphics/filters/SVGFETile.h. + * platform/graphics/filters/FETurbulence.cpp: Copied from WebCore/svg/graphics/filters/SVGFETurbulence.cpp. + * platform/graphics/filters/FETurbulence.h: Copied from WebCore/svg/graphics/filters/SVGFETurbulence.h. + * platform/graphics/filters/LightSource.cpp: Copied from WebCore/svg/graphics/filters/SVGLightSource.cpp. + * platform/graphics/filters/LightSource.h: Copied from WebCore/svg/graphics/filters/SVGLightSource.h. + * platform/graphics/filters/PointLightSource.h: Copied from WebCore/svg/graphics/filters/SVGPointLightSource.h. + * platform/graphics/filters/SpotLightSource.h: Copied from WebCore/svg/graphics/filters/SVGSpotLightSource.h. + * svg/SVGFEConvolveMatrixElement.h: + * svg/SVGFEDiffuseLightingElement.cpp: + * svg/SVGFEDisplacementMapElement.h: + * svg/SVGFEDistantLightElement.cpp: + * svg/SVGFEFloodElement.h: + * svg/SVGFELightElement.h: + * svg/SVGFEMergeElement.h: + * svg/SVGFEMorphologyElement.h: + * svg/SVGFEOffsetElement.h: + * svg/SVGFEPointLightElement.cpp: + * svg/SVGFESpecularLightingElement.h: + * svg/SVGFESpotLightElement.cpp: + * svg/SVGFETileElement.h: + * svg/SVGFETurbulenceElement.h: + * svg/graphics/filters/SVGDistantLightSource.h: Removed. + * svg/graphics/filters/SVGFEConvolveMatrix.cpp: Removed. + * svg/graphics/filters/SVGFEConvolveMatrix.h: Removed. + * svg/graphics/filters/SVGFEDiffuseLighting.cpp: Removed. + * svg/graphics/filters/SVGFEDiffuseLighting.h: Removed. + * svg/graphics/filters/SVGFEDisplacementMap.cpp: Removed. + * svg/graphics/filters/SVGFEDisplacementMap.h: Removed. + * svg/graphics/filters/SVGFEFlood.cpp: Removed. + * svg/graphics/filters/SVGFEFlood.h: Removed. + * svg/graphics/filters/SVGFELighting.cpp: Removed. + * svg/graphics/filters/SVGFELighting.h: Removed. + * svg/graphics/filters/SVGFEMerge.cpp: Removed. + * svg/graphics/filters/SVGFEMerge.h: Removed. + * svg/graphics/filters/SVGFEMorphology.cpp: Removed. + * svg/graphics/filters/SVGFEMorphology.h: Removed. + * svg/graphics/filters/SVGFEOffset.cpp: Removed. + * svg/graphics/filters/SVGFEOffset.h: Removed. + * svg/graphics/filters/SVGFESpecularLighting.cpp: Removed. + * svg/graphics/filters/SVGFESpecularLighting.h: Removed. + * svg/graphics/filters/SVGFETile.cpp: Removed. + * svg/graphics/filters/SVGFETile.h: Removed. + * svg/graphics/filters/SVGFETurbulence.cpp: Removed. + * svg/graphics/filters/SVGFETurbulence.h: Removed. + * svg/graphics/filters/SVGLightSource.cpp: Removed. + * svg/graphics/filters/SVGLightSource.h: Removed. + * svg/graphics/filters/SVGPointLightSource.h: Removed. + * svg/graphics/filters/SVGSpotLightSource.h: Removed. + +2010-09-22 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + [WIN] Add internetHandle to WebCoreSynchronousLoader. + https://bugs.webkit.org/show_bug.cgi?id=46185 + + For loading content via network the WebCoreSynchronousLoader needs its own (synchronous) internetHandle. + This also adds asynchronousInternetHandle() to create a static asynchronous internetHandle. + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::createInternetHandle): + (WebCore::asynchronousInternetHandle): + (WebCore::WebCoreSynchronousLoader::internetHandle): + (WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader): Create synchronous internetHandle. + (WebCore::WebCoreSynchronousLoader::~WebCoreSynchronousLoader): Delete synchronous internetHandle. + +2010-09-22 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Chris Fleizach. + + [chromium] Remove unused sys/types.h in VDMXParser.cpp + https://bugs.webkit.org/show_bug.cgi?id=46136 + + sys/types.h is not needed here. + + * platform/graphics/chromium/VDMXParser.cpp: + +2010-09-22 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Change the home directory path to the WebKit module directory + https://bugs.webkit.org/show_bug.cgi?id=45895 + + AEEFS_HOME_DIR denotes the currently running application's directory. + Change it to fs:/~<clsid> to use the WebKit module directory as home. + + * platform/brew/FileSystemBrew.cpp: + (WebCore::homeDirectoryPath): + +2010-09-22 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Add dummy Pasteboard + https://bugs.webkit.org/show_bug.cgi?id=46107 + + Pasteboard is not supported yet. Add dummy implementation to avoid link errors. + + * platform/brew/PasteboardBrew.cpp: Added. + (WebCore::Pasteboard::generalPasteboard): + (WebCore::Pasteboard::Pasteboard): + (WebCore::Pasteboard::clear): + (WebCore::Pasteboard::writeSelection): + (WebCore::Pasteboard::writePlainText): + (WebCore::Pasteboard::writeURL): + (WebCore::Pasteboard::writeImage): + (WebCore::Pasteboard::canSmartReplace): + (WebCore::Pasteboard::plainText): + (WebCore::Pasteboard::documentFragment): + +2010-09-21 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Kent Tamura. + + Each EntityMaskIn* needs explanation + https://bugs.webkit.org/show_bug.cgi?id=44833 + + Added a description as to why we escape nbsp when serializing HTML documents but not when serializing XML documents. + + * editing/markup.cpp: + +2010-09-21 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Kent Tamura. + + cleanup: removeInlineStyleFromElement and extractInlineStyleToPushDown should be merged + https://bugs.webkit.org/show_bug.cgi?id=46205 + + Cleanup required to fix the bug 27818. Added the style extraction mechanism to removeInlineStyleFromElement + and removeCSSStyle and replaced the call to extractInlineStyleToPushDown by a call to removeInlineStyleFromElement. + + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::removeInlineStyleFromElement): Added extractedStyle argument. + (WebCore::ApplyStyleCommand::removeCSSStyle): Added extractedStyle argument. + (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode): Calls removeInlineStyleFromElement instead of + extractInlineStyleToPushDown which has been deleted. + * editing/ApplyStyleCommand.h: + +2010-09-21 Andrew Wilson <atwilson@chromium.org> + + Unreviewed, rolling out r67982. + http://trac.webkit.org/changeset/67982 + https://bugs.webkit.org/show_bug.cgi?id=45156 + + Causes crashes on chromium testshell + + * WebCore.gypi: + * accessibility/chromium/AXObjectCacheChromium.cpp: + (WebCore::AXObjectCache::postPlatformNotification): + (WebCore::AXObjectCache::handleFocusedUIElementChanged): + (WebCore::AXObjectCache::handleScrolledToAnchor): + * dom/Document.cpp: + (WebCore::Document::implicitClose): + (WebCore::Document::setFocusedNode): + * editing/SelectionController.h: + * editing/chromium/SelectionControllerChromium.cpp: Removed. + * page/FrameView.cpp: + (WebCore::FrameView::layout): + * page/chromium/ChromeClientChromium.h: + +2010-09-21 Cosmin Truta <ctruta@chromium.org> + + Reviewed by James Robinson. + + RenderImage::intrinsicSizeChanged crashes when m_imageResource is missing + https://bugs.webkit.org/show_bug.cgi?id=46120 + + Avoid applying operator -> to m_imageResource when its underlying pointer is NULL. + + * rendering/RenderImage.h: + (WebCore::RenderImage::intrinsicSizeChanged): Checked m_imageResource. + * html/HTMLImageElement.cpp: + (HTMLImageElement::createRenderer): Fixed indentation. + +2010-09-21 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + [chromium] Remove GLES2Context and WebGLES2Context + https://bugs.webkit.org/show_bug.cgi?id=46131 + + Removed now-obsolete GLES2Context and WebGLES2Context classes, and + dependency on command buffer client code from WebCore. Built and + tested 3D CSS and WebGL content on Mac OS X to test. + + * WebCore.gypi: + * platform/chromium/GLES2Context.h: Removed. + * platform/graphics/skia/ImageSkia.cpp: + +2010-09-21 Geoffrey Garen <ggaren@apple.com> + + Try to fix the Windows build. + + * loader/Cache.cpp: + (WebCore::Cache::makeResourcePurgeable): + (WebCore::Cache::evict): Cast to int before using unary '-', to avoid an + MSVC warning. + +2010-09-21 Pratik Solanki <psolanki@apple.com> + + Reviewed by Geoffrey Garen and Darin Adler. + + Use purgeable memory to keep more dead resources in cache + https://bugs.webkit.org/show_bug.cgi?id=44806 + <rdar://problem/8350901> + + This changes the behavior of dead resources in the WebCore cache to be the following if + shouldMakeResourcePurgeableOnEviction() returns true. + + 1. Dead resources in the cache are kept in non-purgeable memory. + 2. When we prune dead resources, instead of freeing them, we mark their memory as purgeable + and keep the resources until the kernel reclaims the purgeable memory. + + By leaving the in-cache dead resources in dirty resident memory, we decrease the likelihood + of the kernel claiming that memory and forcing us to refetch the resource (for example when + a user presses back). + + And by having an unbounded number of resource objects using purgeable memory, we can use + as much memory as is available on the machine. The trade-off is that the CachedResource + object (and its member variables) are allocated in non-purgeable TC-malloc'd memory so + we would see slightly more memory use due to this. + + * loader/Cache.cpp: + (WebCore::Cache::resourceForURL): Adjust sizes appropriately if we made resource memory + non-purgeable. + (WebCore::Cache::pruneDeadResources): When removing dead resources, try first to mark their + memory as purgeable. If not, evict the resource. + (WebCore::Cache::makeResourcePurgeable): Added. Try to mark resource + memory as purgeable. If successful, adjust the sizes so that we don't + factor this resources size in the Cache size calculation. + (WebCore::Cache::evict): Don't decrement size if we already did it in makeResourcePurgeable. + (WebCore::Cache::dumpLRULists): Extra debug logging. + * loader/Cache.h: + (WebCore::Cache::shouldMakeResourcePurgeableOnEviction): Added. Indicates if the new + behaviour is enabled. + * loader/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::allClientsRemoved): Do not mark memory as purgeable. The + Cache class takes care of this. + * loader/CachedImage.cpp: + (WebCore::CachedImage::destroyDecodedData): Ditto. + * loader/CachedScript.cpp: + (WebCore::CachedScript::destroyDecodedData): Ditto. + +2010-09-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/7729077> Extending the selection to sentence boundary after a line break may select extra character + https://bugs.webkit.org/show_bug.cgi?id=46232 + + Test: editing/selection/extend-by-sentence-002.html + + * editing/visible_units.cpp: + (WebCore::nextBoundary): The text iterator’s range end can be the position after + the line break, in which case the next visible is actually after the first character + of the next sentence. Instead, advance the text iterator past the newline character + and return the beginning of its range, which is guaranteed to still be before the + next sentence. + +2010-09-21 Robert Hogan <robert@webkit.org> + + Rubber-stamped by Ariya Hidayat. + + [Qt] Build fix against qt trunk + + * platform/graphics/qt/ContextShadow.cpp: + (WebCore::ContextShadow::beginShadowLayer): + +2010-09-21 Tony Chang <tony@chromium.org> + + Unreviewed, QT build fix. + + * platform/qt/ClipboardQt.cpp: + (WebCore::ClipboardQt::ClipboardQt): + +2010-09-21 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r61285): AIM 2.1.296: Code rendered as text in Welcome screen + https://bugs.webkit.org/show_bug.cgi?id=46134 + + * WebCore.exp.in: Export __ZN7WebCore32applicationIsAOLInstantMessengerEv. + * platform/mac/RuntimeApplicationChecks.h: + * platform/mac/RuntimeApplicationChecks.mm: + (WebCore::applicationIsAOLInstantMessenger): Determine if the embedding + application is AOL Instant Messenger by checking the bundle identifier. + +2010-09-21 Chris Guillory <chris.guillory@google.com> + + Reviewed by Chris Fleizach. + + Send webkit accessibility notifications to Chromium. + https://bugs.webkit.org/show_bug.cgi?id=45156 + + * WebCore.gypi: + * accessibility/chromium/AXObjectCacheChromium.cpp: + (WebCore::AXObjectCache::postPlatformNotification): + (WebCore::AXObjectCache::handleFocusedUIElementChanged): + (WebCore::AXObjectCache::handleScrolledToAnchor): + * dom/Document.cpp: + (WebCore::Document::implicitClose): + (WebCore::Document::setFocusedNode): + * editing/SelectionController.h: + * editing/chromium/SelectionControllerChromium.cpp: Added. + (WebCore::SelectionController::notifyAccessibilityForSelectionChange): + * page/FrameView.cpp: + (WebCore::FrameView::layout): + * page/chromium/ChromeClientChromium.h: + +2010-09-21 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [gtk] Move copyContextProperties outside the GraphicsContextCairo + https://bugs.webkit.org/show_bug.cgi?id=46179. + + Moved the copyContextProperties function to the CairoUtilities so + we can use it outside GraphicsContextCairo. We moved also the old + gtk CairoUtilities file to GdkCairoUtilities and added the new + file in the cairo directory. + + * GNUmakefile.am: + * platform/graphics/cairo/CairoUtilities.cpp: Added. + (WebCore::copyContextProperties): + * platform/graphics/cairo/CairoUtilities.h: Added. + * platform/graphics/cairo/GraphicsContextCairo.cpp: + * platform/graphics/gtk/CairoUtilities.cpp: Removed. + * platform/graphics/gtk/CairoUtilities.h: Removed. + * platform/graphics/gtk/GdkCairoUtilities.cpp: Added. + (getCairoSurfacePixel): + (getGdkPixbufPixel): + (cairoImageSurfaceToGdkPixbuf): + * platform/graphics/gtk/GdkCairoUtilities.h: Added. + * platform/graphics/gtk/ImageBufferGtk.cpp: + * platform/graphics/gtk/ImageGtk.cpp: + +2010-09-21 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by James Robinson. + + [chromium] Cleaned up LayerRendererChromium::prepareToDrawLayers + logic to avoid unnecessary copy operations if the existing root layer + contents aren't useful for scrolling. Also removed call to updateLayersRecursive() + as the composited layer update is actually happening in the drawLayers() method. + https://bugs.webkit.org/show_bug.cgi?id=46199 + + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::prepareToDrawLayers): + +2010-09-21 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Tony Chang. + + Change Clipboard to use an enum instead of isForDragging = true/false + https://bugs.webkit.org/show_bug.cgi?id=46004 + + No new tests, since it's just a refactoring change. + + * bindings/js/JSClipboardCustom.cpp: + (WebCore::JSClipboard::setDragImage): + * bindings/v8/custom/V8ClipboardCustom.cpp: + (WebCore::V8Clipboard::setDragImageCallback): + * dom/Clipboard.cpp: + (WebCore::Clipboard::Clipboard): + (WebCore::Clipboard::setDropEffect): + (WebCore::Clipboard::setEffectAllowed): + * dom/Clipboard.h: + (WebCore::Clipboard::isForCopyAndPaste): + (WebCore::Clipboard::isForDragAndDrop): + * editing/android/EditorAndroid.cpp: + (WebCore::Editor::newGeneralClipboard): + * editing/brew/EditorBrew.cpp: + (WebCore::Editor::newGeneralClipboard): + * editing/chromium/EditorChromium.cpp: + (WebCore::Editor::newGeneralClipboard): + * editing/haiku/EditorHaiku.cpp: + (WebCore::Editor::newGeneralClipboard): + * editing/mac/EditorMac.mm: + (WebCore::Editor::newGeneralClipboard): + * editing/wx/EditorWx.cpp: + (WebCore::Editor::newGeneralClipboard): + * page/chromium/EventHandlerChromium.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * page/efl/EventHandlerEfl.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * page/gtk/EventHandlerGtk.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * page/haiku/EventHandlerHaiku.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * page/mac/EventHandlerMac.mm: + (WebCore::EventHandler::createDraggingClipboard): + * page/qt/EventHandlerQt.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * page/win/EventHandlerWin.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * page/wx/EventHandlerWx.cpp: + (WebCore::EventHandler::createDraggingClipboard): + * platform/android/ClipboardAndroid.cpp: + (WebCore::ClipboardAndroid::ClipboardAndroid): + (WebCore::ClipboardAndroid::clearData): + (WebCore::ClipboardAndroid::clearAllData): + (WebCore::ClipboardAndroid::setData): + * platform/android/ClipboardAndroid.h: + * platform/brew/ClipboardBrew.cpp: + (WebCore::ClipboardBrew::ClipboardBrew): + (WebCore::ClipboardBrew::clearData): + (WebCore::ClipboardBrew::clearAllData): + (WebCore::ClipboardBrew::setData): + * platform/brew/ClipboardBrew.h: + * platform/chromium/ClipboardChromium.cpp: + (WebCore::Clipboard::create): + (WebCore::ClipboardChromium::ClipboardChromium): + (WebCore::ClipboardChromium::create): + (WebCore::ClipboardChromium::getData): + * platform/chromium/ClipboardChromium.h: + * platform/efl/ClipboardEfl.cpp: + (WebCore::Editor::newGeneralClipboard): + (WebCore::ClipboardEfl::ClipboardEfl): + * platform/efl/ClipboardEfl.h: + (WebCore::ClipboardEfl::create): + * platform/gtk/ClipboardGtk.cpp: + (WebCore::Editor::newGeneralClipboard): + (WebCore::Clipboard::create): + (WebCore::ClipboardGtk::ClipboardGtk): + (WebCore::dataObjectTypeFromHTMLClipboardType): + (WebCore::ClipboardGtk::clearData): + (WebCore::ClipboardGtk::getData): + (WebCore::ClipboardGtk::setData): + * platform/gtk/ClipboardGtk.h: + (WebCore::ClipboardGtk::create): + * platform/haiku/ClipboardHaiku.cpp: + (WebCore::Clipboard::create): + (WebCore::ClipboardHaiku::ClipboardHaiku): + * platform/haiku/ClipboardHaiku.h: + (WebCore::ClipboardHaiku::create): + * platform/mac/ClipboardMac.h: + (WebCore::ClipboardMac::create): + * platform/mac/ClipboardMac.mm: + (WebCore::Clipboard::create): + (WebCore::ClipboardMac::ClipboardMac): + * platform/qt/ClipboardQt.cpp: + (WebCore::ClipboardQt::ClipboardQt): + (WebCore::ClipboardQt::~ClipboardQt): + (WebCore::ClipboardQt::clearData): + (WebCore::ClipboardQt::clearAllData): + (WebCore::ClipboardQt::setData): + (WebCore::ClipboardQt::declareAndWriteDragImage): + (WebCore::ClipboardQt::writeURL): + (WebCore::ClipboardQt::writeRange): + (WebCore::ClipboardQt::writePlainText): + * platform/qt/ClipboardQt.h: + (WebCore::ClipboardQt::create): + * platform/win/ClipboardWin.cpp: + (WebCore::Clipboard::create): + (WebCore::ClipboardWin::ClipboardWin): + (WebCore::ClipboardWin::clearData): + (WebCore::ClipboardWin::clearAllData): + (WebCore::ClipboardWin::setData): + (WebCore::ClipboardWin::setExternalDataObject): + * platform/win/ClipboardWin.h: + (WebCore::ClipboardWin::create): + * platform/win/EditorWin.cpp: + (WebCore::Editor::newGeneralClipboard): + * platform/wx/ClipboardWx.cpp: + (WebCore::ClipboardWx::ClipboardWx): + * platform/wx/ClipboardWx.h: + (WebCore::ClipboardWx::create): + +2010-09-21 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dave Hyatt. + + Take isValueList() checks out of the asserts for memory safety. + https://bugs.webkit.org/show_bug.cgi?id=46194 + + Test: editing/execCommand/apply-style-text-decoration-crash.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::StyleChange::extractTextStyles): + (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown): + +2010-09-21 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Kenneth Russell. + + [chromium] Fixing double translation of composited layers when scrolling. + The scrolling transform is now applied by a separate layer maintained in + the RenderLayerCompositor. + https://bugs.webkit.org/show_bug.cgi?id=46193 + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawLayers): + +2010-09-21 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46196, add marginStart/Before/End/After accessors to RenderBoxModelObject. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::marginBefore): + (WebCore::RenderBox::marginAfter): + (WebCore::RenderBox::marginStart): + (WebCore::RenderBox::marginEnd): + * rendering/RenderBox.h: + * rendering/RenderBoxModelObject.h: + * rendering/RenderInline.cpp: + (WebCore::computeMargin): + (WebCore::RenderInline::marginLeft): + (WebCore::RenderInline::marginRight): + (WebCore::RenderInline::marginTop): + (WebCore::RenderInline::marginBottom): + (WebCore::RenderInline::marginStart): + (WebCore::RenderInline::marginEnd): + * rendering/RenderInline.h: + (WebCore::RenderInline::marginBefore): + (WebCore::RenderInline::marginAfter): + +2010-09-21 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46190, add borderStart/Before/End/After accessors to RenderBoxModelObject. + + * rendering/RenderBoxModelObject.h: + (WebCore::RenderBoxModelObject::borderBefore): + (WebCore::RenderBoxModelObject::borderAfter): + (WebCore::RenderBoxModelObject::borderStart): + (WebCore::RenderBoxModelObject::borderEnd): + (WebCore::RenderBoxModelObject::borderAndPaddingLogicalHeight): + (WebCore::RenderBoxModelObject::borderAndPaddingLogicalWidth): + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::borderStart): + (WebCore::RenderTableCell::borderEnd): + (WebCore::RenderTableCell::borderBefore): + (WebCore::RenderTableCell::borderAfter): + * rendering/RenderTableCell.h: + +2010-09-21 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] 'make dist' should be fixed in preparation for the next release + https://bugs.webkit.org/show_bug.cgi?id=46129 + + * GNUmakefile.am: Update the sources list to include missing headers. + +2010-09-21 David Hyatt <hyatt@apple.com> + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=46188, make the cross-platform setPrinting method match the Mac version of the method. + Specifically don't pass the page size down to subframes of the one you're printing. + + * page/Frame.cpp: + (WebCore::Frame::setPrinting): + +2010-09-21 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Roben. + + Use WTF::Vector for storing formData in ResourceHandleWin. + https://bugs.webkit.org/show_bug.cgi?id=46180 + + * platform/network/ResourceHandleInternal.h: + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onHandleCreated): + (WebCore::ResourceHandle::onRequestComplete): + +2010-09-21 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Check if the reply has been deleted before finishing a network request + https://bugs.webkit.org/show_bug.cgi?id=46174 + + A crash can happen with the following sequence: + 1. QNetworkReplyHandler::abort() emits reply->deleteLater() + 2. QNAM emits QNetworkReply::finished() -> calls QNetworkReplyHandler::finish() + 3. event loop would call reply->deleteLater() + However a crash occurs since m_reply == 0 on step 2. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::finish): + +2010-09-21 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Jeremy Orlow. + + Use @ to concatenate the database name and the database identifier when building + the filename to use for indexed databases. That character is valid for filenames + but cannot occur in a database identifier derived from a security origin. + https://bugs.webkit.org/show_bug.cgi?id=46178 + + * storage/IDBFactoryBackendImpl.cpp: + (WebCore::IDBFactoryBackendImpl::databaseFileName): + +2010-09-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + DeviceOrientationClient and DeviceMotionClient should have controllerDestroyed() methods + https://bugs.webkit.org/show_bug.cgi?id=45891 + + Tested by existing DeviceOrientation tests. + + * dom/DeviceMotionClient.h: + * dom/DeviceMotionController.cpp: + (WebCore::DeviceMotionController::~DeviceMotionController): + * dom/DeviceMotionController.h: + * dom/DeviceOrientationClient.h: + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::~DeviceOrientationController): + * dom/DeviceOrientationController.h: + * loader/EmptyClients.h: + (WebCore::EmptyDeviceMotionClient::deviceOrientationControllerDestroyed): + (WebCore::EmptyDeviceOrientationClient::deviceOrientationControllerDestroyed): + * platform/mock/DeviceOrientationClientMock.h: + (WebCore::DeviceOrientationClientMock::deviceOrientationControllerDestroyed): + +2010-09-21 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Jeremy Orlow. + + Factor out the file name used for a given indexed database to a static method. + https://bugs.webkit.org/show_bug.cgi?id=46090 + + * storage/IDBFactoryBackendImpl.cpp: + (WebCore::openSQLiteDatabase): + (WebCore::IDBFactoryBackendImpl::databaseFileName): + * storage/IDBFactoryBackendImpl.h: + +2010-09-21 Dirk Schulze <krit@webkit.org> + + SVG Filter cleanup + https://bugs.webkit.org/show_bug.cgi?id=45612 + + Unreviewed change of epsilon back to a more tolerant value in RenderTreeAsText and made it a static const. + This should turn the bots green again. + + * rendering/RenderTreeAsText.cpp: + (WebCore::hasFractions): + +2010-09-21 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=46125, convert table cell intrinsic padding from top/bottom-based + to before/after-based. A vertical text table can have intrinsic padding built into the left/right + direction (and this allows the base class logical padding methods on RenderBoxModelObject to be safe to use). + + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::RenderTableCell): + (WebCore::RenderTableCell::paddingTop): + (WebCore::RenderTableCell::paddingBottom): + (WebCore::RenderTableCell::paddingLeft): + (WebCore::RenderTableCell::paddingRight): + (WebCore::RenderTableCell::paddingBefore): + (WebCore::RenderTableCell::paddingAfter): + * rendering/RenderTableCell.h: + (WebCore::RenderTableCell::setIntrinsicPaddingBefore): + (WebCore::RenderTableCell::setIntrinsicPaddingAfter): + (WebCore::RenderTableCell::setIntrinsicPadding): + (WebCore::RenderTableCell::intrinsicPaddingBefore): + (WebCore::RenderTableCell::intrinsicPaddingAfter): + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::calcRowHeight): + (WebCore::RenderTableSection::layoutRows): + * rendering/RenderTreeAsText.cpp: + (WebCore::RenderTreeAsText::writeRenderObject): + (WebCore::writeTextRun): + +2010-09-21 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG Filter cleanup + https://bugs.webkit.org/show_bug.cgi?id=45612 + + Second cleanup patch. Modified files to follow webkit style. Removed dependencies + to SVG of most of the filter effects and prepared them to move from WebCore/svg/graphics/filters + to WebCore/platform/graphics/filters/. + Renamed calculateDrawingIntRect and calculateDrawingRect to requestedRegionOfInputImageData and + drawingRegionOfInputImage to clarify the functionality and make both functions distinguishable. + + * platform/graphics/filters/FEBlend.cpp: + (WebCore::FEBlend::apply): + * platform/graphics/filters/FEBlend.h: + * platform/graphics/filters/FEColorMatrix.cpp: + (WebCore::FEColorMatrix::apply): + * platform/graphics/filters/FEColorMatrix.h: + * platform/graphics/filters/FEComponentTransfer.cpp: + (WebCore::FEComponentTransfer::apply): + * platform/graphics/filters/FEComponentTransfer.h: + (WebCore::ComponentTransferFunction::ComponentTransferFunction): + * platform/graphics/filters/FEComposite.cpp: + (WebCore::FEComposite::apply): + * platform/graphics/filters/FEComposite.h: + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::FEGaussianBlur::apply): + * platform/graphics/filters/FEGaussianBlur.h: + * platform/graphics/filters/Filter.h: + * platform/graphics/filters/FilterEffect.cpp: + (WebCore::FilterEffect::requestedRegionOfInputImageData): + (WebCore::FilterEffect::drawingRegionOfInputImage): + (WebCore::FilterEffect::effectContext): + * platform/graphics/filters/FilterEffect.h: + * platform/graphics/filters/ImageBufferFilter.cpp: + * platform/graphics/filters/ImageBufferFilter.h: + * platform/graphics/filters/SourceAlpha.cpp: + (WebCore::SourceAlpha::apply): + * platform/graphics/filters/SourceAlpha.h: + (WebCore::SourceAlpha::isSourceInput): + (WebCore::SourceAlpha::SourceAlpha): + * platform/graphics/filters/SourceGraphic.cpp: + (WebCore::SourceGraphic::apply): + * platform/graphics/filters/SourceGraphic.h: + (WebCore::SourceGraphic::isSourceInput): + (WebCore::SourceGraphic::SourceGraphic): + * rendering/RenderTreeAsText.cpp: + (WebCore::hasFractions): + (WebCore::operator<<): + * rendering/RenderTreeAsText.h: + (WebCore::operator<<): + * rendering/SVGRenderTreeAsText.cpp: + * rendering/SVGRenderTreeAsText.h: + * svg/graphics/filters/SVGFEConvolveMatrix.cpp: + (WebCore::FEConvolveMatrix::apply): + * svg/graphics/filters/SVGFEConvolveMatrix.h: + * svg/graphics/filters/SVGFEDiffuseLighting.cpp: + * svg/graphics/filters/SVGFEDiffuseLighting.h: + * svg/graphics/filters/SVGFEDisplacementMap.cpp: + (WebCore::FEDisplacementMap::apply): + * svg/graphics/filters/SVGFEDisplacementMap.h: + * svg/graphics/filters/SVGFEFlood.cpp: + (WebCore::FEFlood::apply): + (WebCore::FEFlood::externalRepresentation): + * svg/graphics/filters/SVGFEFlood.h: + * svg/graphics/filters/SVGFEImage.cpp: + (WebCore::FEImage::apply): + * svg/graphics/filters/SVGFEImage.h: + * svg/graphics/filters/SVGFELighting.cpp: + (WebCore::FELighting::apply): + * svg/graphics/filters/SVGFELighting.h: + * svg/graphics/filters/SVGFEMerge.cpp: + (WebCore::FEMerge::apply): + * svg/graphics/filters/SVGFEMerge.h: + * svg/graphics/filters/SVGFEMorphology.cpp: + (WebCore::FEMorphology::apply): + * svg/graphics/filters/SVGFEMorphology.h: + * svg/graphics/filters/SVGFEOffset.cpp: + (WebCore::FEOffset::apply): + * svg/graphics/filters/SVGFEOffset.h: + * svg/graphics/filters/SVGFESpecularLighting.cpp: + * svg/graphics/filters/SVGFESpecularLighting.h: + * svg/graphics/filters/SVGFETile.cpp: + (WebCore::FETile::apply): + * svg/graphics/filters/SVGFETile.h: + * svg/graphics/filters/SVGFETurbulence.cpp: + (WebCore::FETurbulence::apply): + * svg/graphics/filters/SVGFETurbulence.h: + +2010-09-20 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Carlson. + + [GTK] enhanced context menu for media elements + https://bugs.webkit.org/show_bug.cgi?id=45021 + + New items in the media Element context menu: + - play/pause + - mute/unmute + - controls display control + - switch to fullscreen (for video only) + - loop playback control + - copy media url to clipboard + - open in new window + + Test: media/context-menu-actions.html + + * page/ContextMenuController.cpp: + (WebCore::ContextMenuController::contextMenuItemSelected): + * platform/ContextMenu.cpp: + (WebCore::ContextMenu::populate): + (WebCore::ContextMenu::checkOrEnableIfNeeded): + * platform/ContextMenuItem.h: + * platform/LocalizationStrategy.h: + * platform/LocalizedStrings.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * platform/LocalizedStrings.h: + * platform/android/LocalizedStringsAndroid.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * platform/brew/LocalizedStringsBrew.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * platform/efl/LocalizedStringsEfl.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * platform/gtk/ContextMenuItemGtk.cpp: + (WebCore::gtkStockIDFromContextMenuAction): + * platform/gtk/LocalizedStringsGtk.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * platform/haiku/LocalizedStringsHaiku.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * platform/wx/LocalizedStringsWx.cpp: + (WebCore::contextMenuItemTagOpenVideoInNewWindow): + (WebCore::contextMenuItemTagOpenAudioInNewWindow): + (WebCore::contextMenuItemTagCopyVideoLinkToClipboard): + (WebCore::contextMenuItemTagCopyAudioLinkToClipboard): + (WebCore::contextMenuItemTagToggleMediaControls): + (WebCore::contextMenuItemTagToggleMediaLoop): + (WebCore::contextMenuItemTagEnterVideoFullscreen): + (WebCore::contextMenuItemTagMediaPlay): + (WebCore::contextMenuItemTagMediaPause): + (WebCore::contextMenuItemTagMediaMute): + * rendering/HitTestResult.cpp: + (WebCore::HitTestResult::absoluteMediaURL): + (WebCore::HitTestResult::mediaSupportsFullscreen): + (WebCore::HitTestResult::mediaElement): + (WebCore::HitTestResult::toggleMediaControlsDisplay): + (WebCore::HitTestResult::toggleMediaLoopPlayback): + (WebCore::HitTestResult::enterFullscreenForVideo): + (WebCore::HitTestResult::mediaControlsEnabled): + (WebCore::HitTestResult::mediaLoopEnabled): + (WebCore::HitTestResult::mediaPlaying): + (WebCore::HitTestResult::toggleMediaPlayState): + (WebCore::HitTestResult::mediaHasAudio): + (WebCore::HitTestResult::mediaMuted): + (WebCore::HitTestResult::toggleMediaMuteState): + * rendering/HitTestResult.h: + +2010-09-20 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Daniel Bates. + + [BREWMP] Handle tab key + https://bugs.webkit.org/show_bug.cgi?id=46104 + + In Brew MP, AVK_FUNCTION is the key code for tab. + Process AVK_FUNCTION as tab in PlatformKeyboardEvent. + + * platform/brew/PlatformKeyboardEventBrew.cpp: + (WebCore::keyIdentifierForBrewKeyCode): + (WebCore::windowsKeyCodeForKeyEvent): + +2010-09-20 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r67918. + http://trac.webkit.org/changeset/67918 + https://bugs.webkit.org/show_bug.cgi?id=46162 + + Broke chromium win compile (Requested by jamesr on #webkit). + + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * platform/graphics/chromium/GlyphPageTreeNodeLinux.cpp: Renamed from WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp. + (WebCore::GlyphPage::fill): + +2010-09-20 Daniel Bates <dbates@rim.com> + + Reviewed by Dan Bernstein. + + Cleanup: Extract common border radii expansion code in + RenderBoxModelObject::paintBoxShadow() into function + https://bugs.webkit.org/show_bug.cgi?id=45934 + + Extracted code for expanding and clamping the border radii + into common function to remove duplicate code. + + No functionality was changed. So, no new tests. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::uniformlyExpandBorderRadii): Added. + (WebCore::RenderBoxModelObject::paintBoxShadow): Moved common code to uniformlyExpandBorderRadii(). + +2010-09-20 Kwang Yul Seo <skyul@company100.net> + + Reviewed by James Robinson. + + Make sure skia is not Chromium specific + https://bugs.webkit.org/show_bug.cgi?id=39672 + + GGlyphPageTreeNodeLinux does not depend on Linux or Chromium. + Move GGlyphPageTreeNodeLinux to platform/graphics/skia and rename it to + GlyphPageTreeNodeSkia.cpp so that other ports can use it. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * platform/graphics/chromium/GlyphPageTreeNodeLinux.cpp: Removed. + * platform/graphics/skia/GlyphPageTreeNodeSkia.cpp: Added. + +2010-09-20 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by David Levin. + + Add NoStaticTables attributes to IDLs of FileSystem API for Worker support + https://bugs.webkit.org/show_bug.cgi?id=46021 + + Added NoStaticTables attributes to IDLs except for ones for Callbacks. + (As NoStaticTables only affects non-callback interfaces.) + + * fileapi/DOMFileSystem.idl: + * fileapi/DirectoryEntry.idl: + * fileapi/DirectoryReader.idl: + * fileapi/Entry.idl: + * fileapi/EntryArray.idl: + * fileapi/FileEntry.idl: + * fileapi/Flags.idl: + * fileapi/Metadata.idl: + +2010-09-20 Nico Weber <thakis@chromium.org> + + Reviewed by Adam Barth. + + Fix "operands of ? are integers of different signs" clang warnings + https://bugs.webkit.org/show_bug.cgi?id=46157 + + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::advance): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::calcHeight): + +2010-09-20 Vangelis Kokkevis <vangelis@chromium.org> + + Unreviewed, rolling out r67906. + http://trac.webkit.org/changeset/67906 + https://bugs.webkit.org/show_bug.cgi?id=46139 + + Change causes chromium to crash when switching pages + + * platform/graphics/chromium/ContentLayerChromium.h: + * platform/graphics/chromium/LayerChromium.h: + +2010-09-19 Antonio Gomes <agomes@rim.com> + + Reviewed by Ojan Vafai. + + SelectionController::modify should ask EditingBehavior for platform specific behavior + https://bugs.webkit.org/show_bug.cgi?id=41975 + + As a follow up of the refactoring work in bug 39854, patch makes SelectionController::modify() + stop accessing EditingBehaviorType values directly, and replaces its use by the EditingBehavior + class. + + Since the "Settings*" parameter of the private SelectionController::modify() method becomes unneeded + with this change (it was used to query the editingBehaviorType), patch merges two modify() methods. + + No behavior change, so no new tests. + + * editing/EditingBehavior.h: + (WebCore::EditingBehavior::shouldAlwaysGrowSelectionWhenExtendingToBoundary): + * editing/SelectionController.cpp: + (WebCore::SelectionController::modify): + * editing/SelectionController.h: + 2010-09-20 Vangelis Kokkevis <vangelis@chromium.org> Reviewed by James Robinson. diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig index 533d5e2..81913dd 100644 --- a/WebCore/Configurations/Version.xcconfig +++ b/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 9; +MINOR_VERSION = 10; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index bab8109..898da5c 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -91,6 +91,7 @@ #include "JSDOMSelection.cpp" #include "JSDOMStringList.cpp" #include "JSDOMStringMap.cpp" +#include "JSDOMTokenList.cpp" #include "JSDOMWindow.cpp" #include "JSElement.cpp" #include "JSEntity.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index adbd30c..2fda5e9 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -124,6 +124,7 @@ DOM_CLASSES = \ DOMSelection \ DOMStringList \ DOMStringMap \ + DOMTokenList \ DOMWindow \ Database \ DatabaseCallback \ diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js Binary files differindex a3720e2..62103d7 100644 --- a/WebCore/English.lproj/localizedStrings.js +++ b/WebCore/English.lproj/localizedStrings.js diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 1a0a754..c80e8ed 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -71,7 +71,6 @@ webcore_cppflags += \ webcoregtk_cppflags += \ -DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \ -DWTF_USE_SOUP=1 \ - -DWTF_USE_GSTREAMER=1 \ -I$(srcdir)/WebCore/accessibility/gtk \ -I$(srcdir)/WebCore/loader/gtk \ -I$(srcdir)/WebCore/page/gtk \ @@ -82,15 +81,18 @@ webcoregtk_cppflags += \ -I$(srcdir)/WebCore/platform/network/soup webcore_built_nosources += \ - DerivedSources/WebCore/DocTypeStrings.cpp \ - DerivedSources/WebCore/tokenizer.cpp \ - DerivedSources/WebCore/ColorData.cpp + DerivedSources/WebCore/tokenizer.cpp webcore_built_sources += \ DerivedSources/WebCore/CSSGrammar.cpp \ DerivedSources/WebCore/CSSGrammar.h \ DerivedSources/WebCore/CSSPropertyNames.h \ + DerivedSources/WebCore/CSSPropertyNames.cpp \ DerivedSources/WebCore/CSSValueKeywords.h \ + DerivedSources/WebCore/CSSValueKeywords.cpp \ + DerivedSources/WebCore/ColorData.cpp \ + DerivedSources/WebCore/DocTypeStrings.cpp \ + DerivedSources/WebCore/HashTools.h \ DerivedSources/WebCore/HTMLElementFactory.cpp \ DerivedSources/WebCore/HTMLElementFactory.h \ DerivedSources/WebCore/HTMLEntityTable.cpp \ @@ -216,6 +218,8 @@ webcore_built_sources += \ DerivedSources/WebCore/JSDOMStringList.h \ DerivedSources/WebCore/JSDOMStringMap.cpp \ DerivedSources/WebCore/JSDOMStringMap.h \ + DerivedSources/WebCore/JSDOMTokenList.cpp \ + DerivedSources/WebCore/JSDOMTokenList.h \ DerivedSources/WebCore/JSDOMWindow.cpp \ DerivedSources/WebCore/JSDOMWindow.h \ DerivedSources/WebCore/JSElement.cpp \ @@ -645,11 +649,13 @@ webcore_sources += \ WebCore/bindings/js/DOMWrapperWorld.h \ WebCore/bindings/js/GCController.cpp \ WebCore/bindings/js/GCController.h \ + WebCore/bindings/js/IDBBindingUtilities.h \ WebCore/bindings/js/JavaScriptCallFrame.cpp \ WebCore/bindings/js/JavaScriptCallFrame.h \ WebCore/bindings/js/JSAttrCustom.cpp \ WebCore/bindings/js/JSAudioConstructor.cpp \ WebCore/bindings/js/JSAudioConstructor.h \ + WebCore/bindings/js/JSBinding.h \ WebCore/bindings/js/JSCallbackData.cpp \ WebCore/bindings/js/JSCallbackData.h \ WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp \ @@ -1348,6 +1354,7 @@ webcore_sources += \ WebCore/editing/WrapContentsInDummySpanCommand.cpp \ WebCore/editing/WrapContentsInDummySpanCommand.h \ WebCore/fileapi/AsyncFileWriter.h \ + WebCore/fileapi/AsyncFileWriterClient.h \ WebCore/fileapi/BlobBuilder.cpp \ WebCore/fileapi/BlobBuilder.h \ WebCore/fileapi/Blob.cpp \ @@ -1391,7 +1398,6 @@ webcore_sources += \ WebCore/fileapi/FileThread.h \ WebCore/fileapi/FileThreadTask.h \ WebCore/fileapi/FileWriterCallback.h \ - WebCore/fileapi/FileWriterClient.h \ WebCore/fileapi/FileWriter.cpp \ WebCore/fileapi/FileWriter.h \ WebCore/fileapi/Flags.h \ @@ -1418,6 +1424,10 @@ webcore_sources += \ WebCore/history/PageCache.h \ WebCore/html/AsyncImageResizer.cpp \ WebCore/html/AsyncImageResizer.h \ + WebCore/html/BaseTextInputType.cpp \ + WebCore/html/BaseTextInputType.h \ + WebCore/html/ButtonInputType.cpp \ + WebCore/html/ButtonInputType.h \ WebCore/html/canvas/CanvasContextAttributes.h \ WebCore/html/canvas/CanvasGradient.cpp \ WebCore/html/canvas/CanvasGradient.h \ @@ -1431,9 +1441,15 @@ webcore_sources += \ WebCore/html/canvas/CanvasRenderingContext.h \ WebCore/html/canvas/CanvasStyle.cpp \ WebCore/html/canvas/CanvasStyle.h \ + WebCore/html/DOMTokenList.cpp \ + WebCore/html/DOMTokenList.h \ + WebCore/html/CheckboxInputType.cpp \ + WebCore/html/CheckboxInputType.h \ WebCore/html/CollectionCache.cpp \ WebCore/html/CollectionCache.h \ WebCore/html/CollectionType.h \ + WebCore/html/ColorInputType.cpp \ + WebCore/html/ColorInputType.h \ WebCore/html/DataGridColumn.cpp \ WebCore/html/DataGridColumn.h \ WebCore/html/DataGridColumnList.cpp \ @@ -1441,10 +1457,20 @@ webcore_sources += \ WebCore/html/DataGridDataSource.h \ WebCore/html/DateComponents.cpp \ WebCore/html/DateComponents.h \ + WebCore/html/DateInputType.cpp \ + WebCore/html/DateInputType.h \ + WebCore/html/DateTimeInputType.cpp \ + WebCore/html/DateTimeInputType.h \ + WebCore/html/DateTimeLocalInputType.cpp \ + WebCore/html/DateTimeLocalInputType.h \ WebCore/html/DOMDataGridDataSource.cpp \ WebCore/html/DOMDataGridDataSource.h \ WebCore/html/DOMFormData.cpp \ WebCore/html/DOMFormData.h \ + WebCore/html/EmailInputType.cpp \ + WebCore/html/EmailInputType.h \ + WebCore/html/FileInputType.cpp \ + WebCore/html/FileInputType.h \ WebCore/html/FormDataList.cpp \ WebCore/html/FormDataList.h \ WebCore/html/FTPDirectoryDocument.cpp \ @@ -1622,17 +1648,29 @@ webcore_sources += \ WebCore/html/HTMLVideoElement.h \ WebCore/html/HTMLViewSourceDocument.cpp \ WebCore/html/HTMLViewSourceDocument.h \ + WebCore/html/HiddenInputType.cpp \ + WebCore/html/HiddenInputType.h \ WebCore/html/ImageData.cpp \ WebCore/html/ImageData.h \ WebCore/html/ImageDocument.cpp \ WebCore/html/ImageDocument.h \ + WebCore/html/ImageInputType.cpp \ + WebCore/html/ImageInputType.h \ WebCore/html/ImageResizerThread.cpp \ WebCore/html/ImageResizerThread.h \ + WebCore/html/InputType.cpp \ + WebCore/html/InputType.h \ + WebCore/html/IsIndexInputType.cpp \ + WebCore/html/IsIndexInputType.h \ WebCore/html/LabelsNodeList.cpp \ WebCore/html/LabelsNodeList.h \ WebCore/html/MediaDocument.cpp \ WebCore/html/MediaDocument.h \ WebCore/html/MediaError.h \ + WebCore/html/MonthInputType.cpp \ + WebCore/html/MonthInputType.h \ + WebCore/html/NumberInputType.cpp \ + WebCore/html/NumberInputType.h \ WebCore/html/parser/CSSPreloadScanner.cpp \ WebCore/html/parser/CSSPreloadScanner.h \ WebCore/html/parser/HTMLConstructionSite.cpp \ @@ -1670,18 +1708,42 @@ webcore_sources += \ WebCore/html/parser/TextDocumentParser.h \ WebCore/html/parser/TextViewSourceParser.cpp \ WebCore/html/parser/TextViewSourceParser.h \ + WebCore/html/PasswordInputType.cpp \ + WebCore/html/PasswordInputType.h \ WebCore/html/PluginDocument.cpp \ WebCore/html/PluginDocument.h \ + WebCore/html/RadioInputType.cpp \ + WebCore/html/RadioInputType.h \ + WebCore/html/RangeInputType.cpp \ + WebCore/html/RangeInputType.h \ + WebCore/html/ResetInputType.cpp \ + WebCore/html/ResetInputType.h \ + WebCore/html/SearchInputType.cpp \ + WebCore/html/SearchInputType.h \ WebCore/html/StepRange.cpp \ WebCore/html/StepRange.h \ + WebCore/html/SubmitInputType.cpp \ + WebCore/html/SubmitInputType.h \ + WebCore/html/TelephoneInputType.cpp \ + WebCore/html/TelephoneInputType.h \ WebCore/html/TextDocument.cpp \ WebCore/html/TextDocument.h \ + WebCore/html/TextFieldInputType.cpp \ + WebCore/html/TextFieldInputType.h \ + WebCore/html/TextInputType.cpp \ + WebCore/html/TextInputType.h \ WebCore/html/TextMetrics.h \ + WebCore/html/TimeInputType.cpp \ + WebCore/html/TimeInputType.h \ WebCore/html/TimeRanges.cpp \ WebCore/html/TimeRanges.h \ + WebCore/html/URLInputType.cpp \ + WebCore/html/URLInputType.h \ WebCore/html/ValidityState.cpp \ WebCore/html/ValidityState.h \ WebCore/html/VoidCallback.h \ + WebCore/html/WeekInputType.cpp \ + WebCore/html/WeekInputType.h \ WebCore/icu/unicode/parseerr.h \ WebCore/icu/unicode/platform.h \ WebCore/icu/unicode/putil.h \ @@ -2084,7 +2146,10 @@ webcore_sources += \ WebCore/platform/graphics/Color.cpp \ WebCore/platform/graphics/Color.h \ WebCore/platform/graphics/ColorSpace.h \ + WebCore/platform/graphics/ContextShadow.cpp \ + WebCore/platform/graphics/ContextShadow.h \ WebCore/platform/graphics/DashArray.h \ + WebCore/platform/graphics/filters/DistantLightSource.h \ WebCore/platform/graphics/filters/FEBlend.cpp \ WebCore/platform/graphics/filters/FEBlend.h \ WebCore/platform/graphics/filters/FEColorMatrix.cpp \ @@ -2093,17 +2158,43 @@ webcore_sources += \ WebCore/platform/graphics/filters/FEComponentTransfer.h \ WebCore/platform/graphics/filters/FEComposite.cpp \ WebCore/platform/graphics/filters/FEComposite.h \ + WebCore/platform/graphics/filters/FEConvolveMatrix.cpp \ + WebCore/platform/graphics/filters/FEConvolveMatrix.h \ + WebCore/platform/graphics/filters/FEDiffuseLighting.cpp \ + WebCore/platform/graphics/filters/FEDiffuseLighting.h \ + WebCore/platform/graphics/filters/FEDisplacementMap.cpp \ + WebCore/platform/graphics/filters/FEDisplacementMap.h \ WebCore/platform/graphics/filters/FEGaussianBlur.cpp \ WebCore/platform/graphics/filters/FEGaussianBlur.h \ + WebCore/platform/graphics/filters/FEFlood.cpp \ + WebCore/platform/graphics/filters/FEFlood.h \ + WebCore/platform/graphics/filters/FELighting.cpp \ + WebCore/platform/graphics/filters/FELighting.h \ + WebCore/platform/graphics/filters/FEMerge.cpp \ + WebCore/platform/graphics/filters/FEMerge.h \ + WebCore/platform/graphics/filters/FEMorphology.cpp \ + WebCore/platform/graphics/filters/FEMorphology.h \ + WebCore/platform/graphics/filters/FEOffset.cpp \ + WebCore/platform/graphics/filters/FEOffset.h \ + WebCore/platform/graphics/filters/FESpecularLighting.cpp \ + WebCore/platform/graphics/filters/FESpecularLighting.h \ + WebCore/platform/graphics/filters/FETile.cpp \ + WebCore/platform/graphics/filters/FETile.h \ + WebCore/platform/graphics/filters/FETurbulence.cpp \ + WebCore/platform/graphics/filters/FETurbulence.h \ WebCore/platform/graphics/filters/FilterEffect.cpp \ WebCore/platform/graphics/filters/FilterEffect.h \ WebCore/platform/graphics/filters/Filter.h \ WebCore/platform/graphics/filters/ImageBufferFilter.cpp \ WebCore/platform/graphics/filters/ImageBufferFilter.h \ + WebCore/platform/graphics/filters/LightSource.cpp \ + WebCore/platform/graphics/filters/LightSource.h \ + WebCore/platform/graphics/filters/PointLightSource.h \ WebCore/platform/graphics/filters/SourceAlpha.cpp \ WebCore/platform/graphics/filters/SourceAlpha.h \ WebCore/platform/graphics/filters/SourceGraphic.cpp \ WebCore/platform/graphics/filters/SourceGraphic.h \ + WebCore/platform/graphics/filters/SpotLightSource.h \ WebCore/platform/graphics/FloatPoint3D.cpp \ WebCore/platform/graphics/FloatPoint3D.h \ WebCore/platform/graphics/FloatPoint.cpp \ @@ -2781,6 +2872,8 @@ webcore_sources += \ WebCore/storage/IDBIndex.cpp \ WebCore/storage/IDBIndex.h \ WebCore/storage/IDBKey.h \ + WebCore/storage/IDBKeyPath.h \ + WebCore/storage/IDBKeyPathBackendImpl.h \ WebCore/storage/IDBKeyRange.cpp \ WebCore/storage/IDBKeyRange.h \ WebCore/storage/IDBObjectStoreBackendImpl.cpp \ @@ -2794,6 +2887,7 @@ webcore_sources += \ WebCore/storage/IDBSuccessEvent.cpp \ WebCore/storage/IDBSuccessEvent.h \ WebCore/storage/IDBTransactionBackendInterface.h \ + WebCore/storage/IDBTransactionCoordinator.h \ WebCore/storage/IDBTransaction.cpp \ WebCore/storage/IDBTransaction.h \ WebCore/storage/LocalStorageTask.cpp \ @@ -2856,39 +2950,12 @@ webcore_sources += \ WebCore/svg/ColorDistance.h \ WebCore/svg/ElementTimeControl.h \ WebCore/svg/GradientAttributes.h \ - WebCore/svg/graphics/filters/SVGDistantLightSource.h \ - WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp \ - WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h \ - WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp \ - WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h \ - WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp \ - WebCore/svg/graphics/filters/SVGFEDisplacementMap.h \ - WebCore/svg/graphics/filters/SVGFEFlood.cpp \ - WebCore/svg/graphics/filters/SVGFEFlood.h \ WebCore/svg/graphics/filters/SVGFEImage.cpp \ WebCore/svg/graphics/filters/SVGFEImage.h \ - WebCore/svg/graphics/filters/SVGFELighting.cpp \ - WebCore/svg/graphics/filters/SVGFELighting.h \ - WebCore/svg/graphics/filters/SVGFEMerge.cpp \ - WebCore/svg/graphics/filters/SVGFEMerge.h \ - WebCore/svg/graphics/filters/SVGFEMorphology.cpp \ - WebCore/svg/graphics/filters/SVGFEMorphology.h \ - WebCore/svg/graphics/filters/SVGFEOffset.cpp \ - WebCore/svg/graphics/filters/SVGFEOffset.h \ - WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp \ - WebCore/svg/graphics/filters/SVGFESpecularLighting.h \ - WebCore/svg/graphics/filters/SVGFETile.cpp \ - WebCore/svg/graphics/filters/SVGFETile.h \ - WebCore/svg/graphics/filters/SVGFETurbulence.cpp \ - WebCore/svg/graphics/filters/SVGFETurbulence.h \ WebCore/svg/graphics/filters/SVGFilterBuilder.cpp \ WebCore/svg/graphics/filters/SVGFilterBuilder.h \ WebCore/svg/graphics/filters/SVGFilter.cpp \ WebCore/svg/graphics/filters/SVGFilter.h \ - WebCore/svg/graphics/filters/SVGLightSource.cpp \ - WebCore/svg/graphics/filters/SVGLightSource.h \ - WebCore/svg/graphics/filters/SVGPointLightSource.h \ - WebCore/svg/graphics/filters/SVGSpotLightSource.h \ WebCore/svg/graphics/SVGImage.cpp \ WebCore/svg/graphics/SVGImage.h \ WebCore/svg/LinearGradientAttributes.h \ @@ -3349,6 +3416,9 @@ webcoregtk_sources += \ WebCore/page/gtk/EventHandlerGtk.cpp \ WebCore/page/gtk/FrameGtk.cpp \ WebCore/platform/graphics/cairo/CairoPath.h \ + WebCore/platform/graphics/cairo/CairoUtilities.cpp \ + WebCore/platform/graphics/cairo/CairoUtilities.h \ + WebCore/platform/graphics/cairo/ContextShadowCairo.cpp \ WebCore/platform/graphics/cairo/FontCairo.cpp \ WebCore/platform/graphics/cairo/FontCustomPlatformData.h \ WebCore/platform/graphics/cairo/FontPlatformData.h \ @@ -3381,10 +3451,10 @@ webcoregtk_sources += \ WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h \ WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp \ WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h \ - WebCore/platform/graphics/gtk/CairoUtilities.cpp \ - WebCore/platform/graphics/gtk/CairoUtilities.h \ WebCore/platform/graphics/gtk/ColorGtk.cpp \ WebCore/platform/graphics/gtk/FontGtk.cpp \ + WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp \ + WebCore/platform/graphics/gtk/GdkCairoUtilities.h \ WebCore/platform/graphics/gtk/IconGtk.cpp \ WebCore/platform/graphics/gtk/ImageBufferGtk.cpp \ WebCore/platform/graphics/gtk/ImageGtk.cpp \ @@ -3544,6 +3614,7 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/FontCacheFreeType.cpp \ WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp \ WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp \ + WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h \ WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp \ WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp endif # END USE_FREETYPE @@ -3557,6 +3628,7 @@ webcoregtk_sources += \ WebCore/platform/graphics/gtk/FontCachePango.cpp \ WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp \ WebCore/platform/graphics/gtk/FontPlatformDataPango.cpp \ + WebCore/platform/graphics/gtk/FontPlatformDataPango.h \ WebCore/platform/graphics/gtk/GlyphPageTreeNodePango.cpp \ WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp endif # END USE_PANGO @@ -3802,6 +3874,7 @@ FEATURE_DEFINES += ENABLE_VIDEO=1 HTML_FEATURES += ENABLE_VIDEO=1 webcore_cppflags += -DENABLE_VIDEO=1 +if USE_GSTREAMER if ENABLE_DEBUG webcore_cppflags += -DGST_DISABLE_DEPRECATED endif # END ENABLE_DEBUG @@ -3810,6 +3883,7 @@ webcore_libadd += \ -lgstvideo-0.10 \ -lgstpbutils-0.10 \ -lgstapp-0.10 +endif # END USE_GSTREAMER endif # END ENABLE_VIDEO # ---- @@ -4321,6 +4395,7 @@ FEATURE_DEFINES += ENABLE_BLOB=1 webcore_cppflags += -DENABLE_BLOB=1 endif # END ENABLE_BLOB +DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl if sort $(WEBCORE_CSS_PROPERTY_NAMES) | uniq -d | grep -E '^[^#]'; then echo 'Duplicate value!'; exit 1; fi cat $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.in @@ -4328,18 +4403,19 @@ DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCo mv CSSPropertyNames.* $(GENSOURCES_WEBCORE) # Lower case all the values, as CSS values are case-insensitive -DerivedSources/WebCore/CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/makevalues.pl +DerivedSources/WebCore/CSSValueKeywords.cpp: +DerivedSources/WebCore/CSSValueKeywords.h: $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/makevalues.pl $(PERL) -ne 'print lc' $(WEBCORE_CSS_VALUE_KEYWORDS) > CSSValueKeywords.in if sort CSSValueKeywords.in | uniq -d | grep -E '^[^#]'; then echo 'Duplicate value!'; exit 1; fi $(PERL) "$(WebCore)/css/makevalues.pl" mv CSSValueKeywords.* $(GENSOURCES_WEBCORE) # DOCTYPE strings -DerivedSources/WebCore/DocTypeStrings.cpp : $(WebCore)/html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl +DerivedSources/WebCore/DocTypeStrings.cpp DerivedSources/WebCore/HashTools.h: $(WebCore)/html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES_WEBCORE) $(WebCore)/html/DocTypeStrings.gperf # HTML entity names -DerivedSources/WebCore/HTMLEntityTable.cpp : $(WebCore)/html/parser/HTMLEntityNames.in $(WebCore)/html/parser/create-html-entity-table +DerivedSources/WebCore/HTMLEntityTable.cpp: $(WebCore)/html/parser/HTMLEntityNames.in $(WebCore)/html/parser/create-html-entity-table $(PYTHON) $(WebCore)/html/parser/create-html-entity-table -o $(GENSOURCES_WEBCORE)/HTMLEntityTable.cpp $(WebCore)/html/parser/HTMLEntityNames.in # color names diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in index d2a6edb..5d789dc 100644 --- a/WebCore/WebCore.exp.in +++ b/WebCore/WebCore.exp.in @@ -139,6 +139,7 @@ __ZN3WTF6StringC1EP8NSString __ZN3WTF6StringC1EPK10__CFString __ZN7WebCore10MouseEventC1ERKN3WTF12AtomicStringEbbNS1_10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_11EventTargetEEENS5_INS_9ClipboardEEEb __ZN7WebCore10ScrollView20setCanHaveScrollbarsEb +__ZN7WebCore10ScrollView24windowResizerRectChangedEv __ZN7WebCore10deleteFileERKN3WTF6StringE __ZN7WebCore10handCursorEv __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_4KURLERKN3WTF6StringE @@ -360,7 +361,9 @@ __ZN7WebCore15VisiblePositionC1ERKNS_8PositionENS_9EAffinityE __ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE __ZN7WebCore15visitedLinkHashEPKtj __ZN7WebCore16AbstractDatabase14setIsAvailableEb -__ZN7WebCore16DeviceMotionData6createEbdbdbdbdbdbdbd +__ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd +__ZN7WebCore16DeviceMotionData12RotationRate6createEbdbdbd +__ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd __ZN7WebCore16FontFallbackList15releaseFontDataEv __ZN7WebCore16FontPlatformDataC1EP6NSFontbb __ZN7WebCore16FontPlatformDataD1Ev @@ -493,6 +496,7 @@ __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_ __ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_17DeviceOrientationEEE __ZN7WebCore27DeviceOrientationClientMockC1Ev __ZN7WebCore27applicationIsAdobeInstallerEv +__ZN7WebCore27applicationIsMicrosoftMyDayEv __ZN7WebCore27contextMenuItemTagShowFontsEv __ZN7WebCore27contextMenuItemTagUnderlineEv __ZN7WebCore28InspectorFrontendClientLocal20sendMessageToBackendERKN3WTF6StringE @@ -516,6 +520,7 @@ __ZN7WebCore31contextMenuItemTagIgnoreGrammarEv __ZN7WebCore31contextMenuItemTagMakeLowerCaseEv __ZN7WebCore31contextMenuItemTagMakeUpperCaseEv __ZN7WebCore31contextMenuItemTagStartSpeakingEv +__ZN7WebCore32applicationIsAOLInstantMessengerEv __ZN7WebCore32contextMenuItemTagInspectElementEv __ZN7WebCore32contextMenuItemTagSmartCopyPasteEv __ZN7WebCore32plainTextToMallocAllocatedBufferEPKNS_5RangeERjbNS_20TextIteratorBehaviorE @@ -577,6 +582,7 @@ __ZN7WebCore4PageD1Ev __ZN7WebCore4coreEP20NSURLProtectionSpace __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE +__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE __ZN7WebCore5Cache11setDisabledEb __ZN7WebCore5Cache13getStatisticsEv __ZN7WebCore5Cache13setCapacitiesEjjj @@ -650,8 +656,7 @@ __ZN7WebCore6Loader20servePendingRequestsENS0_8PriorityE __ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE __ZN7WebCore6Widget16removeFromParentEv __ZN7WebCore6Widget17frameRectsChangedEv -__ZN7WebCore6Widget20retainPlatformWidgetEv -__ZN7WebCore6Widget21releasePlatformWidgetEv +__ZN7WebCore6Widget17setPlatformWidgetEP6NSView __ZN7WebCore6Widget4hideEv __ZN7WebCore6Widget4showEv __ZN7WebCore6Widget5paintEPNS_15GraphicsContextERKNS_7IntRectE @@ -684,6 +689,8 @@ __ZN7WebCore8Document26pageSizeAndMarginsInPixelsEiRNS_7IntSizeERiS3_S3_S3_ __ZN7WebCore8Document27removeMediaCanStartListenerEPNS_21MediaCanStartListenerE __ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv __ZN7WebCore8Document4headEv +__ZNK7WebCore8Document13nodesFromRectEiijjjjb +__ZN7WebCore10JSDocument6s_infoE __ZN7WebCore8FormData6createEPKvm __ZN7WebCore8FormDataD1Ev __ZN7WebCore8IntPointC1ERK8_NSPoint @@ -828,7 +835,7 @@ __ZN7WebCore9PageGroup18addVisitedLinkHashEy __ZN7WebCore9PageGroup20addUserScriptToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLENS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE __ZN7WebCore9PageGroup20removeAllUserContentEv __ZN7WebCore9PageGroup21removeAllVisitedLinksEv -__ZN7WebCore9PageGroup24addUserStyleSheetToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLENS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_25UserContentInjectedFramesENS_14UserStyleSheet5LevelE +__ZN7WebCore9PageGroup24addUserStyleSheetToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLENS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_25UserContentInjectedFramesENS_14UserStyleLevelENS_22UserStyleInjectionTimeE __ZN7WebCore9PageGroup25removeUserScriptFromWorldEPNS_15DOMWrapperWorldERKNS_4KURLE __ZN7WebCore9PageGroup26removeUserScriptsFromWorldEPNS_15DOMWrapperWorldE __ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb @@ -917,6 +924,7 @@ __ZNK7WebCore13HitTestResult18titleDisplayStringEv __ZNK7WebCore13HitTestResult5imageEv __ZNK7WebCore13HitTestResult5titleERNS_13TextDirectionE __ZNK7WebCore13HitTestResult9imageRectEv +__ZN7WebCore13HitTestResult13rectFromPointERKNS_8IntPointEjjjj __ZNK7WebCore13ResourceErrorcvP7NSErrorEv __ZNK7WebCore14DocumentLoader10requestURLEv __ZNK7WebCore14DocumentLoader11frameLoaderEv @@ -1036,6 +1044,7 @@ __ZNK7WebCore6Editor7canCopyEv __ZNK7WebCore6Editor7canEditEv __ZNK7WebCore6Editor8canPasteEv __ZNK7WebCore6Editor9canDeleteEv +__ZNK7WebCore6Widget14platformWidgetEv __ZNK7WebCore6Widget23convertToContainingViewERKNS_7IntRectE __ZNK7WebCore6Widget23convertToContainingViewERKNS_8IntPointE __ZNK7WebCore6Widget25convertFromContainingViewERKNS_7IntRectE @@ -1144,7 +1153,6 @@ _wkSignalCFReadStreamEnd _wkSignalCFReadStreamError _wkSignalCFReadStreamHasBytes - #if ENABLE(3D_RENDERING) _WebCoreHas3DRendering #endif diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index 2745cfa..6b13eb5 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -244,10 +244,14 @@ '../platform/mac', '../platform/text/mac', ], - # enable -Wall and -Werror, just in Mac build for now - # FIXME: Also enable this for Linux/Windows after verifying no warnings + # enable -Wall and -Werror, just for Mac and Linux builds for now + # FIXME: Also enable this for Windows after verifying no warnings 'chromium_code': 1, }], +# FIXME: disabled for now due to failures on different gcc versions +# ['OS=="linux"', { +# 'chromium_code': 1, +# }], ['OS=="win"', { 'webcore_include_dirs': [ '../page/win', @@ -646,7 +650,6 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit', '<(RULE_INPUT_PATH)', ], - 'process_outputs_as_sources': 0, }, # Rule to build generated JavaScript (V8) bindings from .idl source. { @@ -743,6 +746,12 @@ # in webcore_files. '<@(derived_sources_aggregate_files)', + # Additional .cpp files for HashTools.h + '<(SHARED_INTERMEDIATE_DIR)/webkit/DocTypeStrings.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorData.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.cpp', + # Additional .cpp files from webcore_bindings_sources actions. '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp', @@ -973,6 +982,21 @@ ], }, { + 'target_name': 'webcore_html', + 'type': '<(library)', + 'dependencies': [ + 'webcore_prerequisites', + ], + 'sources': [ + '<@(webcore_files)', + ], + 'sources/': [ + # Start by excluding everything then include html files only. + ['exclude', '.*'], + ['include', 'html/'], + ], + }, + { 'target_name': 'webcore_svg', 'type': '<(library)', 'dependencies': [ @@ -1201,7 +1225,7 @@ # Exclude things that don't apply to the Chromium platform on the basis # of their enclosing directories and tags at the ends of their # filenames. - ['exclude', '(android|cairo|cf|cg|curl|gtk|haiku|linux|mac|opentype|platform|posix|qt|soup|svg|symbian|win|wx)/'], + ['exclude', '(android|cairo|cf|cg|curl|gtk|haiku|html|linux|mac|opentype|platform|posix|qt|soup|svg|symbian|win|wx)/'], ['exclude', '(?<!Chromium)(Android|Cairo|CF|CG|Curl|Gtk|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|Wx)\\.(cpp|mm?)$'], # Exclude most of SVG except css and javascript bindings. @@ -1331,6 +1355,7 @@ 'target_name': 'webcore', 'type': 'none', 'dependencies': [ + 'webcore_html', 'webcore_platform', 'webcore_remaining', # Exported. diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index 528dc3c..8e6af6b 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -111,6 +111,7 @@ 'fileapi/Metadata.idl', 'fileapi/MetadataCallback.idl', 'html/DOMFormData.idl', + 'html/DOMTokenList.idl', 'html/DataGridColumn.idl', 'html/DataGridColumnList.idl', 'html/HTMLAllCollection.idl', @@ -766,6 +767,7 @@ 'bindings/v8/custom/V8DocumentLocationCustom.cpp', 'bindings/v8/custom/V8DOMFormDataCustom.cpp', 'bindings/v8/custom/V8DOMStringMapCustom.cpp', + 'bindings/v8/custom/V8DOMTokenListCustom.cpp', 'bindings/v8/custom/V8DOMWindowCustom.cpp', 'bindings/v8/custom/V8DocumentCustom.cpp', 'bindings/v8/custom/V8ElementCustom.cpp', @@ -1333,6 +1335,7 @@ 'dom/XMLDocumentParserQt.cpp', 'editing/android/EditorAndroid.cpp', 'editing/chromium/EditorChromium.cpp', + 'editing/chromium/SelectionControllerChromium.cpp', 'editing/mac/EditorMac.mm', 'editing/mac/SelectionControllerMac.mm', 'editing/qt/EditorQt.cpp', @@ -1438,6 +1441,7 @@ 'editing/visible_units.cpp', 'editing/visible_units.h', 'fileapi/AsyncFileWriter.h', + 'fileapi/AsyncFileWriterClient.h', 'fileapi/Blob.cpp', 'fileapi/Blob.h', 'fileapi/BlobBuilder.cpp', @@ -1483,7 +1487,6 @@ 'fileapi/FileWriter.cpp', 'fileapi/FileWriter.h', 'fileapi/FileWriterCallback.h', - 'fileapi/FileWriterClient.h', 'fileapi/Flags.h', 'fileapi/LocalFileSystem.h', 'fileapi/Metadata.h', @@ -1509,21 +1512,41 @@ 'history/PageCache.h', 'html/AsyncImageResizer.cpp', 'html/AsyncImageResizer.h', + 'html/BaseTextInputType.cpp', + 'html/BaseTextInputType.h', + 'html/ButtonInputType.cpp', + 'html/ButtonInputType.h', + 'html/CheckboxInputType.cpp', + 'html/CheckboxInputType.h', 'html/CollectionCache.cpp', 'html/CollectionCache.h', 'html/CollectionType.h', + 'html/ColorInputType.cpp', + 'html/ColorInputType.h', 'html/DOMDataGridDataSource.cpp', 'html/DOMDataGridDataSource.h', 'html/DOMFormData.cpp', 'html/DOMFormData.h', + 'html/DOMTokenList.cpp', + 'html/DOMTokenList.h', 'html/DataGridColumn.cpp', 'html/DataGridColumn.h', 'html/DataGridColumnList.cpp', 'html/DataGridColumnList.h', 'html/DateComponents.cpp', 'html/DateComponents.h', + 'html/DateInputType.cpp', + 'html/DateInputType.h', + 'html/DateTimeInputType.cpp', + 'html/DateTimeInputType.h', + 'html/DateTimeLocalInputType.cpp', + 'html/DateTimeLocalInputType.h', + 'html/EmailInputType.cpp', + 'html/EmailInputType.h', 'html/FTPDirectoryDocument.cpp', 'html/FTPDirectoryDocument.h', + 'html/FileInputType.cpp', + 'html/FileInputType.h', 'html/FormDataList.cpp', 'html/FormDataList.h', 'html/HTMLAllCollection.cpp', @@ -1696,29 +1719,65 @@ 'html/HTMLVideoElement.h', 'html/HTMLViewSourceDocument.cpp', 'html/HTMLViewSourceDocument.h', + 'html/HiddenInputType.cpp', + 'html/HiddenInputType.h', 'html/ImageData.cpp', 'html/ImageData.h', 'html/ImageDocument.cpp', 'html/ImageDocument.h', + 'html/ImageInputType.cpp', + 'html/ImageInputType.h', 'html/ImageResizerThread.cpp', 'html/ImageResizerThread.h', + 'html/InputType.cpp', + 'html/InputType.h', + 'html/IsIndexInputType.cpp', + 'html/IsIndexInputType.h', 'html/LabelsNodeList.cpp', 'html/LabelsNodeList.h', 'html/MediaDocument.cpp', 'html/MediaDocument.h', 'html/MediaError.h', + 'html/MonthInputType.cpp', + 'html/MonthInputType.h', + 'html/NumberInputType.cpp', + 'html/NumberInputType.h', + 'html/PasswordInputType.cpp', + 'html/PasswordInputType.h', 'html/PluginDocument.cpp', 'html/PluginDocument.h', + 'html/RadioInputType.cpp', + 'html/RadioInputType.h', + 'html/RangeInputType.cpp', + 'html/RangeInputType.h', + 'html/ResetInputType.cpp', + 'html/ResetInputType.h', + 'html/SearchInputType.cpp', + 'html/SearchInputType.h', 'html/StepRange.cpp', 'html/StepRange.h', + 'html/SubmitInputType.cpp', + 'html/SubmitInputType.h', + 'html/TelephoneInputType.cpp', + 'html/TelephoneInputType.h', 'html/TextDocument.cpp', 'html/TextDocument.h', + 'html/TextFieldInputType.cpp', + 'html/TextFieldInputType.h', + 'html/TextInputType.cpp', + 'html/TextInputType.h', 'html/TextMetrics.h', + 'html/TimeInputType.cpp', + 'html/TimeInputType.h', 'html/TimeRanges.cpp', 'html/TimeRanges.h', + 'html/URLInputType.cpp', + 'html/URLInputType.h', 'html/ValidityState.cpp', 'html/ValidityState.h', 'html/VoidCallback.h', + 'html/WeekInputType.cpp', + 'html/WeekInputType.h', 'html/canvas/ArrayBuffer.cpp', 'html/canvas/ArrayBuffer.h', 'html/canvas/ArrayBufferView.cpp', @@ -2220,7 +2279,6 @@ 'platform/chromium/FramelessScrollViewClient.h', 'platform/chromium/GeolocationServiceChromium.cpp', 'platform/chromium/GeolocationServiceChromium.h', - 'platform/chromium/GLES2Context.h', 'platform/chromium/KeyCodeConversion.h', 'platform/chromium/KeyCodeConversionGtk.cpp', 'platform/chromium/Language.cpp', @@ -2345,6 +2403,8 @@ 'platform/graphics/chromium/UniscribeHelper.h', 'platform/graphics/chromium/UniscribeHelperTextRun.cpp', 'platform/graphics/chromium/UniscribeHelperTextRun.h', + 'platform/graphics/chromium/VideoFrameChromium.cpp', + 'platform/graphics/chromium/VideoFrameChromium.h', 'platform/graphics/chromium/VideoLayerChromium.cpp', 'platform/graphics/chromium/VideoLayerChromium.h', 'platform/graphics/chromium/VDMXParser.cpp', @@ -2353,6 +2413,7 @@ 'platform/graphics/chromium/WebGLLayerChromium.h', 'platform/graphics/cocoa/FontPlatformData.h', 'platform/graphics/cocoa/FontPlatformDataCocoa.mm', + 'platform/graphics/filters/DistantLightSource.h', 'platform/graphics/filters/FEBlend.cpp', 'platform/graphics/filters/FEBlend.h', 'platform/graphics/filters/FEColorMatrix.cpp', @@ -2361,8 +2422,34 @@ 'platform/graphics/filters/FEComponentTransfer.h', 'platform/graphics/filters/FEComposite.cpp', 'platform/graphics/filters/FEComposite.h', + 'platform/graphics/filters/FEConvolveMatrix.cpp', + 'platform/graphics/filters/FEConvolveMatrix.h', + 'platform/graphics/filters/FEDiffuseLighting.cpp', + 'platform/graphics/filters/FEDiffuseLighting.h', + 'platform/graphics/filters/FEDisplacementMap.cpp', + 'platform/graphics/filters/FEDisplacementMap.h', + 'platform/graphics/filters/FEFlood.cpp', + 'platform/graphics/filters/FEFlood.h', 'platform/graphics/filters/FEGaussianBlur.cpp', 'platform/graphics/filters/FEGaussianBlur.h', + 'platform/graphics/filters/FELighting.cpp', + 'platform/graphics/filters/FELighting.h', + 'platform/graphics/filters/FEMerge.cpp', + 'platform/graphics/filters/FEMerge.h', + 'platform/graphics/filters/FEMorphology.cpp', + 'platform/graphics/filters/FEMorphology.h', + 'platform/graphics/filters/FEOffset.cpp', + 'platform/graphics/filters/FEOffset.h', + 'platform/graphics/filters/FESpecularLighting.cpp', + 'platform/graphics/filters/FESpecularLighting.h', + 'platform/graphics/filters/FETile.cpp', + 'platform/graphics/filters/FETile.h', + 'platform/graphics/filters/FETurbulence.cpp', + 'platform/graphics/filters/FETurbulence.h', + 'platform/graphics/filters/LightSource.cpp', + 'platform/graphics/filters/LightSource.h', + 'platform/graphics/filters/PointLightSource.h', + 'platform/graphics/filters/SpotLightSource.h', 'platform/graphics/filters/Filter.h', 'platform/graphics/filters/FilterEffect.cpp', 'platform/graphics/filters/FilterEffect.h', @@ -3772,39 +3859,12 @@ 'svg/animation/SMILTimeContainer.h', 'svg/animation/SVGSMILElement.cpp', 'svg/animation/SVGSMILElement.h', - 'svg/graphics/filters/SVGDistantLightSource.h', - 'svg/graphics/filters/SVGFEConvolveMatrix.cpp', - 'svg/graphics/filters/SVGFEConvolveMatrix.h', - 'svg/graphics/filters/SVGFEDiffuseLighting.cpp', - 'svg/graphics/filters/SVGFEDiffuseLighting.h', - 'svg/graphics/filters/SVGFEDisplacementMap.cpp', - 'svg/graphics/filters/SVGFEDisplacementMap.h', - 'svg/graphics/filters/SVGFEFlood.cpp', - 'svg/graphics/filters/SVGFEFlood.h', 'svg/graphics/filters/SVGFEImage.cpp', 'svg/graphics/filters/SVGFEImage.h', - 'svg/graphics/filters/SVGFELighting.cpp', - 'svg/graphics/filters/SVGFELighting.h', - 'svg/graphics/filters/SVGFEMerge.cpp', - 'svg/graphics/filters/SVGFEMerge.h', - 'svg/graphics/filters/SVGFEMorphology.cpp', - 'svg/graphics/filters/SVGFEMorphology.h', - 'svg/graphics/filters/SVGFEOffset.cpp', - 'svg/graphics/filters/SVGFEOffset.h', - 'svg/graphics/filters/SVGFESpecularLighting.cpp', - 'svg/graphics/filters/SVGFESpecularLighting.h', - 'svg/graphics/filters/SVGFETile.cpp', - 'svg/graphics/filters/SVGFETile.h', - 'svg/graphics/filters/SVGFETurbulence.cpp', - 'svg/graphics/filters/SVGFETurbulence.h', 'svg/graphics/filters/SVGFilter.cpp', 'svg/graphics/filters/SVGFilter.h', 'svg/graphics/filters/SVGFilterBuilder.cpp', 'svg/graphics/filters/SVGFilterBuilder.h', - 'svg/graphics/filters/SVGLightSource.cpp', - 'svg/graphics/filters/SVGLightSource.h', - 'svg/graphics/filters/SVGPointLightSource.h', - 'svg/graphics/filters/SVGSpotLightSource.h', 'svg/graphics/SVGImage.cpp', 'svg/graphics/SVGImage.h', 'svg/ColorDistance.cpp', @@ -4224,7 +4284,6 @@ 'webinspector_files': [ 'inspector/front-end/inspector.html', - 'inspector/front-end/AbstractTimelinePanel.js', 'inspector/front-end/ApplicationCacheItemsView.js', 'inspector/front-end/AuditCategories.js', 'inspector/front-end/AuditFormatters.js', @@ -4265,6 +4324,7 @@ 'inspector/front-end/ExtensionRegistryStub.js', 'inspector/front-end/ExtensionServer.js', 'inspector/front-end/FontView.js', + 'inspector/front-end/GoToLineDialog.js', 'inspector/front-end/HAREntry.js', 'inspector/front-end/HeapSnapshotView.js', 'inspector/front-end/HelpScreen.js', @@ -4276,6 +4336,7 @@ 'inspector/front-end/inspector.js', 'inspector/front-end/KeyboardShortcut.js', 'inspector/front-end/MetricsSidebarPane.js', + 'inspector/front-end/NetworkPanel.js', 'inspector/front-end/Object.js', 'inspector/front-end/ObjectPropertiesSection.js', 'inspector/front-end/Panel.js', @@ -4329,10 +4390,12 @@ 'inspector/front-end/WelcomeView.js', 'inspector/front-end/WorkersSidebarPane.js', 'inspector/front-end/audits.css', + 'inspector/front-end/goToLineDialog.css', 'inspector/front-end/heapProfiler.css', 'inspector/front-end/helpScreen.css', 'inspector/front-end/inspector.css', 'inspector/front-end/inspectorSyntaxHighlight.css', + 'inspector/front-end/networkPanel.css', 'inspector/front-end/popover.css', 'inspector/front-end/textViewer.css', ], @@ -4389,7 +4452,9 @@ 'inspector/front-end/Images/grayConnectorPoint.png', 'inspector/front-end/Images/largerResourcesButtonGlyph.png', 'inspector/front-end/Images/localStorage.png', + 'inspector/front-end/Images/networkIcon.png', 'inspector/front-end/Images/nodeSearchButtonGlyph.png', + 'inspector/front-end/Images/paneAddButtons.png', 'inspector/front-end/Images/paneBottomGrow.png', 'inspector/front-end/Images/paneBottomGrowActive.png', 'inspector/front-end/Images/paneGrowHandleLine.png', diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index 37bb205..3331626 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -61,7 +61,7 @@ STYLESHEETS_EMBED = \ $$PWD/css/mediaControls.css \ $$PWD/css/mediaControlsQt.css \ $$PWD/css/themeQtNoListboxes.css \ - $$PWD/css/themeQtMaemo5.css + $$PWD/css/themeQtMobile.css v8 { IDL_BINDINGS += \ @@ -201,6 +201,7 @@ IDL_BINDINGS += \ html/DataGridColumn.idl \ html/DataGridColumnList.idl \ html/DOMFormData.idl \ + html/DOMTokenList.idl \ html/HTMLAllCollection.idl \ html/HTMLAudioElement.idl \ html/HTMLAnchorElement.idl \ @@ -546,7 +547,7 @@ cssprops.wkScript = $$PWD/css/makeprop.pl cssprops.output = $${WC_GENERATED_SOURCES_DIR}/CSSPropertyNames.cpp cssprops.input = WALDOCSSPROPS cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} > $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.in && cd $$WC_GENERATED_SOURCES_DIR && perl $$cssprops.wkScript && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf -cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} +cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} $$cssprops.wkScript addExtraCompiler(cssprops) # GENERATOR 6-B: @@ -554,7 +555,7 @@ cssvalues.wkScript = $$PWD/css/makevalues.pl cssvalues.output = $${WC_GENERATED_SOURCES_DIR}/CSSValueKeywords.cpp cssvalues.input = WALDOCSSVALUES cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$EXTRACSSVALUES > $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.in && cd $$WC_GENERATED_SOURCES_DIR && perl $$cssvalues.wkScript && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf -cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES} +cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES} $$cssvalues.wkScript cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.h addExtraCompiler(cssvalues) diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 9a9a3e5..e595f3b 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -128,7 +128,7 @@ CONFIG(release):!CONFIG(standalone_package) { DEFINES += BUILD_WEBKIT # Remove whole program optimizations due to miscompilations -win32-msvc2005|win32-msvc2008:{ +win32-msvc2005|win32-msvc2008|wince*:{ QMAKE_CFLAGS_RELEASE -= -GL QMAKE_CXXFLAGS_RELEASE -= -GL } @@ -403,7 +403,8 @@ v8 { bindings/v8/custom/V8InjectedScriptHostCustom.cpp \ bindings/v8/custom/V8InspectorFrontendHostCustom.cpp \ bindings/v8/custom/V8CustomEventListener.cpp \ - bindings/v8/custom/V8DOMStringMapCustom.cpp + bindings/v8/custom/V8DOMStringMapCustom.cpp \ + bindings/v8/custom/V8DOMTokenListCustom.cpp SOURCES += \ bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \ @@ -835,13 +836,23 @@ SOURCES += \ history/qt/HistoryItemQt.cpp \ history/PageCache.cpp \ html/AsyncImageResizer.cpp \ + html/BaseTextInputType.cpp \ + html/ButtonInputType.cpp \ + html/CheckboxInputType.cpp \ html/CollectionCache.cpp \ + html/ColorInputType.cpp \ html/DOMDataGridDataSource.cpp \ html/DOMFormData.cpp \ + html/DOMTokenList.cpp \ html/DataGridColumn.cpp \ html/DataGridColumnList.cpp \ html/DateComponents.cpp \ + html/DateInputType.cpp \ + html/DateTimeInputType.cpp \ + html/DateTimeLocalInputType.cpp \ + html/EmailInputType.cpp \ html/FTPDirectoryDocument.cpp \ + html/FileInputType.cpp \ html/FormDataList.cpp \ html/HTMLAllCollection.cpp \ html/HTMLAnchorElement.cpp \ @@ -924,15 +935,33 @@ SOURCES += \ html/HTMLTitleElement.cpp \ html/HTMLUListElement.cpp \ html/HTMLViewSourceDocument.cpp \ + html/HiddenInputType.cpp \ html/ImageData.cpp \ html/ImageDocument.cpp \ + html/ImageInputType.cpp \ html/ImageResizerThread.cpp \ + html/InputType.cpp \ + html/IsIndexInputType.cpp \ html/LabelsNodeList.cpp \ html/MediaDocument.cpp \ + html/MonthInputType.cpp \ + html/NumberInputType.cpp \ + html/PasswordInputType.cpp \ html/PluginDocument.cpp \ + html/RadioInputType.cpp \ + html/RangeInputType.cpp \ + html/ResetInputType.cpp \ + html/SearchInputType.cpp \ html/StepRange.cpp \ + html/SubmitInputType.cpp \ + html/TelephoneInputType.cpp \ html/TextDocument.cpp \ + html/TextFieldInputType.cpp \ + html/TextInputType.cpp \ + html/TimeInputType.cpp \ + html/URLInputType.cpp \ html/ValidityState.cpp \ + html/WeekInputType.cpp \ html/canvas/CanvasGradient.cpp \ html/canvas/CanvasPattern.cpp \ html/canvas/CanvasPixelArray.cpp \ @@ -1095,6 +1124,7 @@ SOURCES += \ platform/graphics/FontFamily.cpp \ platform/graphics/BitmapImage.cpp \ platform/graphics/Color.cpp \ + platform/graphics/ContextShadow.cpp \ platform/graphics/FloatPoint3D.cpp \ platform/graphics/FloatPoint.cpp \ platform/graphics/FloatQuad.cpp \ @@ -1715,6 +1745,7 @@ HEADERS += \ html/DateComponents.h \ html/DOMDataGridDataSource.h \ html/DOMFormData.h \ + html/DOMTokenList.h \ html/FormDataList.h \ html/FTPDirectoryDocument.h \ html/HTMLAllCollection.h \ @@ -1977,12 +2008,25 @@ HEADERS += \ platform/mock/SpeechInputClientMock.h \ platform/graphics/BitmapImage.h \ platform/graphics/Color.h \ + platform/graphics/ContextShadow.h \ platform/graphics/filters/FEBlend.h \ platform/graphics/filters/FEColorMatrix.h \ platform/graphics/filters/FEComponentTransfer.h \ platform/graphics/filters/FEComposite.h \ + platform/graphics/filters/FEConvolveMatrix.h \ + platform/graphics/filters/FEDiffuseLighting.h \ + platform/graphics/filters/FEDisplacementMap.h \ + platform/graphics/filters/FEFlood.h \ platform/graphics/filters/FEGaussianBlur.h \ + platform/graphics/filters/FELighting.h \ + platform/graphics/filters/FEMerge.h \ + platform/graphics/filters/FEMorphology.h \ + platform/graphics/filters/FEOffset.h \ + platform/graphics/filters/FESpecularLighting.h \ + platform/graphics/filters/FETile.h \ + platform/graphics/filters/FETurbulence.h \ platform/graphics/filters/FilterEffect.h \ + platform/graphics/filters/LightSource.h \ platform/graphics/filters/SourceAlpha.h \ platform/graphics/filters/SourceGraphic.h \ platform/graphics/FloatPoint3D.h \ @@ -2010,7 +2054,6 @@ HEADERS += \ platform/graphics/PathTraversalState.h \ platform/graphics/Pattern.h \ platform/graphics/Pen.h \ - platform/graphics/qt/ContextShadow.h \ platform/graphics/qt/FontCustomPlatformData.h \ platform/graphics/qt/GraphicsLayerQt.h \ platform/graphics/qt/ImageDecoderQt.h \ @@ -2274,21 +2317,9 @@ HEADERS += \ svg/animation/SMILTime.h \ svg/animation/SVGSMILElement.h \ svg/ColorDistance.h \ - svg/graphics/filters/SVGFEConvolveMatrix.h \ - svg/graphics/filters/SVGFEDiffuseLighting.h \ - svg/graphics/filters/SVGFEDisplacementMap.h \ - svg/graphics/filters/SVGFEFlood.h \ svg/graphics/filters/SVGFEImage.h \ - svg/graphics/filters/SVGFELighting.h \ - svg/graphics/filters/SVGFEMerge.h \ - svg/graphics/filters/SVGFEMorphology.h \ - svg/graphics/filters/SVGFEOffset.h \ - svg/graphics/filters/SVGFESpecularLighting.h \ - svg/graphics/filters/SVGFETile.h \ - svg/graphics/filters/SVGFETurbulence.h \ svg/graphics/filters/SVGFilterBuilder.h \ svg/graphics/filters/SVGFilter.h \ - svg/graphics/filters/SVGLightSource.h \ svg/graphics/SVGImage.h \ svg/SVGAElement.h \ svg/SVGAltGlyphElement.h \ @@ -2503,6 +2534,7 @@ HEADERS += \ xml/XSLTProcessor.h \ xml/XSLTUnicodeSort.h \ $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ + $$PWD/../WebKit/qt/WebCoreSupport/InspectorServerQt.h \ $$PWD/../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \ @@ -2535,7 +2567,7 @@ SOURCES += \ page/qt/FrameQt.cpp \ platform/graphics/qt/TransformationMatrixQt.cpp \ platform/graphics/qt/ColorQt.cpp \ - platform/graphics/qt/ContextShadow.cpp \ + platform/graphics/qt/ContextShadowQt.cpp \ platform/graphics/qt/FontQt.cpp \ platform/graphics/qt/FontPlatformDataQt.cpp \ platform/graphics/qt/FloatPointQt.cpp \ @@ -2609,6 +2641,7 @@ SOURCES += \ ../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \ ../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \ ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/InspectorServerQt.cpp \ ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \ ../WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \ @@ -2705,6 +2738,9 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { maemo5 { DEFINES += MOZ_PLATFORM_MAEMO=5 } + contains(DEFINES, Q_WS_MAEMO_6) { + DEFINES += MOZ_PLATFORM_MAEMO=6 + } SOURCES += \ plugins/qt/PluginContainerQt.cpp \ plugins/qt/PluginPackageQt.cpp \ @@ -3034,7 +3070,7 @@ contains(DEFINES, ENABLE_VIDEO=1) { bindings/js/JSAudioConstructor.cpp } - !lessThan(QT_MINOR_VERSION, 6):contains(MOBILITY_CONFIG, multimedia) { + contains(MOBILITY_CONFIG, multimedia) { HEADERS += platform/graphics/qt/MediaPlayerPrivateQt.h SOURCES += platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -3106,8 +3142,20 @@ contains(DEFINES, ENABLE_FILTERS=1) { platform/graphics/filters/FEColorMatrix.cpp \ platform/graphics/filters/FEComponentTransfer.cpp \ platform/graphics/filters/FEComposite.cpp \ + platform/graphics/filters/FEConvolveMatrix.cpp \ + platform/graphics/filters/FEDiffuseLighting.cpp \ + platform/graphics/filters/FEDisplacementMap.cpp \ + platform/graphics/filters/FEFlood.cpp \ platform/graphics/filters/FEGaussianBlur.cpp \ + platform/graphics/filters/FELighting.cpp \ + platform/graphics/filters/FEMerge.cpp \ + platform/graphics/filters/FEMorphology.cpp \ + platform/graphics/filters/FEOffset.cpp \ + platform/graphics/filters/FESpecularLighting.cpp \ + platform/graphics/filters/FETile.cpp \ + platform/graphics/filters/FETurbulence.cpp \ platform/graphics/filters/FilterEffect.cpp \ + platform/graphics/filters/LightSource.cpp \ platform/graphics/filters/SourceAlpha.cpp \ platform/graphics/filters/SourceGraphic.cpp } @@ -3376,21 +3424,9 @@ contains(DEFINES, ENABLE_SVG=1) { svg/animation/SMILTime.cpp \ svg/animation/SMILTimeContainer.cpp \ svg/animation/SVGSMILElement.cpp \ - svg/graphics/filters/SVGFEConvolveMatrix.cpp \ - svg/graphics/filters/SVGFEDiffuseLighting.cpp \ - svg/graphics/filters/SVGFEDisplacementMap.cpp \ - svg/graphics/filters/SVGFEFlood.cpp \ svg/graphics/filters/SVGFEImage.cpp \ - svg/graphics/filters/SVGFELighting.cpp \ - svg/graphics/filters/SVGFEMerge.cpp \ - svg/graphics/filters/SVGFEMorphology.cpp \ - svg/graphics/filters/SVGFEOffset.cpp \ - svg/graphics/filters/SVGFESpecularLighting.cpp \ - svg/graphics/filters/SVGFETile.cpp \ - svg/graphics/filters/SVGFETurbulence.cpp \ svg/graphics/filters/SVGFilter.cpp \ svg/graphics/filters/SVGFilterBuilder.cpp \ - svg/graphics/filters/SVGLightSource.cpp \ svg/graphics/SVGImage.cpp \ rendering/RenderForeignObject.cpp \ rendering/RenderPath.cpp \ @@ -3684,7 +3720,7 @@ HEADERS += $$WEBKIT_API_HEADERS } } -CONFIG(QTDIR_build) { +!CONFIG(webkit-debug):CONFIG(QTDIR_build) { # Remove the following 2 lines if you want debug information in WebCore CONFIG -= separate_debug_info CONFIG += no_debug_info diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index 414a67d..1971e15 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -545,6 +545,26 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\HashTools.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\DocTypeStrings.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\CSSValueKeywords.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\CSSPropertyNames.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\ColorData.cpp"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\InspectorBackendDispatcher.cpp"
>
</File>
@@ -4033,6 +4053,14 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMTokenList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMTokenList.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMWindow.cpp"
>
<FileConfiguration
@@ -5300,7 +5328,7 @@ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSGeoposition.h"
>
</File>
- <File
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHashChangeEvent.cpp"
>
<FileConfiguration
@@ -26363,6 +26391,78 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\platform\graphics\cairo\CairoUtilities.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\platform\graphics\cairo\CairoUtilities.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\platform\graphics\cairo\DrawErrorUnderline.h"
>
<FileConfiguration
@@ -26687,6 +26787,42 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\platform\graphics\cairo\OwnPtrCairo.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\platform\graphics\cairo\PathCairo.cpp"
>
<FileConfiguration
@@ -26795,6 +26931,42 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\platform\graphics\cairo\PlatformRefPtrCairo.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\platform\graphics\cairo\TransformationMatrixCairo.cpp"
>
<FileConfiguration
@@ -26927,6 +27099,10 @@ Name="filters"
>
<File
+ RelativePath="..\platform\graphics\filters\DistantLightSource.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\filters\FEBlend.cpp"
>
</File>
@@ -26959,6 +27135,38 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\filters\FEConvolveMatrix.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEConvolveMatrix.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEDiffuseLighting.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEDiffuseLighting.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEDisplacementMap.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEDisplacementMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEFlood.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEFlood.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\filters\FEGaussianBlur.cpp"
>
</File>
@@ -26967,6 +27175,62 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\filters\FELighting.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FELighting.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEMerge.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEMerge.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEMorphology.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEMorphology.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEOffset.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FEOffset.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FESpecularLighting.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FESpecularLighting.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FETile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FETile.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FETurbulence.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\FETurbulence.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\filters\Filter.h"
>
</File>
@@ -26987,6 +27251,18 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\filters\LightSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\LightSource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\filters\PointLightSource.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\filters\SourceAlpha.cpp"
>
</File>
@@ -27002,6 +27278,10 @@ RelativePath="..\platform\graphics\filters\SourceGraphic.h"
>
</File>
+ <File
+ RelativePath="..\platform\graphics\filters\SpotLightSource.h"
+ >
+ </File>
</Filter>
</Filter>
<Filter
@@ -33985,11 +34265,11 @@ >
</File>
<File
- RelativePath="..\dom\InputElement.cpp"
+ RelativePath="..\dom\HashChangeEvent.h"
>
</File>
<File
- RelativePath="..\dom\HashChangeEvent.h"
+ RelativePath="..\dom\InputElement.cpp"
>
</File>
<File
@@ -37289,6 +37569,10 @@ >
</File>
<File
+ RelativePath="..\fileapi\AsyncFileWriterClient.h"
+ >
+ </File>
+ <File
RelativePath="..\html\AsyncImageResizer.cpp"
>
</File>
@@ -37297,6 +37581,14 @@ >
</File>
<File
+ RelativePath="..\html\BaseTextInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\BaseTextInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\fileapi\Blob.cpp"
>
</File>
@@ -37321,6 +37613,14 @@ >
</File>
<File
+ RelativePath="..\html\ButtonInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\ButtonInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\canvas\CanvasGradient.cpp"
>
</File>
@@ -37369,6 +37669,14 @@ >
</File>
<File
+ RelativePath="..\html\CheckboxInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\CheckboxInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\CollectionCache.cpp"
>
<FileConfiguration
@@ -37389,6 +37697,14 @@ >
</File>
<File
+ RelativePath="..\html\ColorInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\ColorInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\DataGridColumn.cpp"
>
</File>
@@ -37417,6 +37733,30 @@ >
</File>
<File
+ RelativePath="..\html\DateInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\DateInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\DateTimeInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\DateTimeInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\DateTimeLocalInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\DateTimeLocalInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\fileapi\DirectoryEntry.cpp"
>
</File>
@@ -37465,6 +37805,14 @@ >
</File>
<File
+ RelativePath="..\html\EmailInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\EmailInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\fileapi\EntriesCallback.h"
>
</File>
@@ -37525,6 +37873,14 @@ >
</File>
<File
+ RelativePath="..\html\FileInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\FileInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\fileapi\FileList.cpp"
>
</File>
@@ -37593,10 +37949,6 @@ >
</File>
<File
- RelativePath="..\fileapi\FileWriterClient.h"
- >
- </File>
- <File
RelativePath="..\fileapi\Flags.h"
>
</File>
@@ -37613,6 +37965,18 @@ >
</File>
<File
+ RelativePath="..\html\DOMTokenList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\DOMTokenList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\FormDataList.cpp"
+ >
+ </File>
+ <File
RelativePath="..\html\FTPDirectoryDocument.h"
>
</File>
@@ -41965,6 +42329,14 @@ >
</File>
<File
+ RelativePath="..\html\HiddenInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HiddenInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\ImageData.cpp"
>
</File>
@@ -41981,6 +42353,14 @@ >
</File>
<File
+ RelativePath="..\html\ImageInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\ImageInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\ImageResizerThread.cpp"
>
</File>
@@ -41989,6 +42369,22 @@ >
</File>
<File
+ RelativePath="..\html\InputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\InputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\IsIndexInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\IsIndexInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\LabelsNodeList.cpp"
>
</File>
@@ -42025,6 +42421,30 @@ >
</File>
<File
+ RelativePath="..\html\MonthInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\MonthInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\NumberInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\NumberInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\PasswordInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\PasswordInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\PluginDocument.cpp"
>
</File>
@@ -42033,6 +42453,38 @@ >
</File>
<File
+ RelativePath="..\html\RadioInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\RadioInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\RangeInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\RangeInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\ResetInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\ResetInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\SearchInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\SearchInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\StepRange.cpp"
>
</File>
@@ -42041,10 +42493,42 @@ >
</File>
<File
+ RelativePath="..\html\SubmitInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\SubmitInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TelephoneInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TelephoneInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\TextDocument.cpp"
>
</File>
<File
+ RelativePath="..\html\TextFieldInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TextFieldInputType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TextInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TextInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\fileapi\ThreadableBlobRegistry.cpp"
>
</File>
@@ -42053,6 +42537,14 @@ >
</File>
<File
+ RelativePath="..\html\TimeInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\TimeInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\TimeRanges.cpp"
>
</File>
@@ -42061,6 +42553,14 @@ >
</File>
<File
+ RelativePath="..\html\URLInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\URLInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\html\ValidityState.cpp"
>
</File>
@@ -42072,6 +42572,14 @@ RelativePath="..\html\VoidCallback.h"
>
</File>
+ <File
+ RelativePath="..\html\WeekInputType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\WeekInputType.h"
+ >
+ </File>
<Filter
Name="parser"
>
@@ -43896,6 +44404,10 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\bindings\js\JSDirectoryEntryCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSDocumentCustom.cpp"
>
<FileConfiguration
@@ -46868,10 +47380,6 @@ >
</File>
<File
- RelativePath="..\bindings\js\JSDirectoryEntryCustom.cpp"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSImageConstructor.cpp"
>
<FileConfiguration
@@ -51163,42 +51671,6 @@ Name="filters"
>
<File
- RelativePath="..\svg\graphics\filters\SVGDistantLightSource.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEConvolveMatrix.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEConvolveMatrix.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEDiffuseLighting.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEDiffuseLighting.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEDisplacementMap.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEDisplacementMap.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEFlood.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEFlood.h"
- >
- </File>
- <File
RelativePath="..\svg\graphics\filters\SVGFEImage.cpp"
>
</File>
@@ -51207,62 +51679,6 @@ >
</File>
<File
- RelativePath="..\svg\graphics\filters\SVGFELighting.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFELighting.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEMerge.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEMerge.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEMorphology.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEMorphology.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEOffset.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFEOffset.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFESpecularLighting.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFESpecularLighting.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFETile.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFETile.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFETurbulence.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGFETurbulence.h"
- >
- </File>
- <File
RelativePath="..\svg\graphics\filters\SVGFilter.cpp"
>
</File>
@@ -51278,22 +51694,6 @@ RelativePath="..\svg\graphics\filters\SVGFilterBuilder.h"
>
</File>
- <File
- RelativePath="..\svg\graphics\filters\SVGLightSource.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGLightSource.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGPointLightSource.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\filters\SVGSpotLightSource.h"
- >
- </File>
</Filter>
</Filter>
</Filter>
@@ -52416,10 +52816,6 @@ Name="front-end"
>
<File
- RelativePath="..\inspector\front-end\AbstractTimelinePanel.js"
- >
- </File>
- <File
RelativePath="..\inspector\front-end\ApplicationCacheItemsView.js"
>
</File>
@@ -52576,6 +52972,14 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\GoToLineDialog.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\goToLineDialog.css"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\HAREntry.js"
>
</File>
@@ -52632,6 +53036,14 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\NetworkPanel.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\networkPanel.css"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\Object.js"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 735e9d5..d104455 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -495,6 +495,10 @@ 1AB7FC860A8B92EC00D9D37B /* XPathValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC650A8B92EC00D9D37B /* XPathValue.h */; }; 1AB7FC870A8B92EC00D9D37B /* XPathVariableReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC660A8B92EC00D9D37B /* XPathVariableReference.cpp */; }; 1AB7FC880A8B92EC00D9D37B /* XPathVariableReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC670A8B92EC00D9D37B /* XPathVariableReference.h */; }; + 1ABA76C911D20E47004C201C /* ColorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F3FB1198307D009D59D6 /* ColorData.cpp */; }; + 1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */; }; + 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */; }; + 1ABA76CC11D20E5B004C201C /* DocTypeStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */; }; 1ABFE7530CD968D000FE4834 /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ABFE7520CD968D000FE4834 /* SQLTransaction.cpp */; }; 1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; }; 1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; }; @@ -822,6 +826,8 @@ 37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.cpp */; }; 37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */; }; + 37E3524B12450C5200BAF5D9 /* InputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E3524A12450C5200BAF5D9 /* InputType.cpp */; }; + 37E3524D12450C6600BAF5D9 /* InputType.h in Headers */ = {isa = PBXBuildFile; fileRef = 37E3524C12450C6600BAF5D9 /* InputType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37F818FD0D657606005E1F05 /* WebCoreURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37F818FE0D657606005E1F05 /* WebCoreURLResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */; }; 37FD4298118368460093C029 /* TreeDepthLimit.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FD4297118368460093C029 /* TreeDepthLimit.h */; }; @@ -1327,7 +1333,7 @@ 6596F2C10B87325C001326BD /* DOMHTMLTextAreaElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E7117F0AC5D5350053270F /* DOMHTMLTextAreaElementInternal.h */; }; 659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */ = {isa = PBXBuildFile; fileRef = 659A7D120B6DB4D9001155B3 /* SubstituteData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 659DDC8009E198BA001BF3C6 /* JSDocument.cpp */; }; - 659DDC8309E198BA001BF3C6 /* JSDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 659DDC8109E198BA001BF3C6 /* JSDocument.h */; }; + 659DDC8309E198BA001BF3C6 /* JSDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 659DDC8109E198BA001BF3C6 /* JSDocument.h */; settings = {ATTRIBUTES = (Private, ); }; }; 65A21468097A329100B9050A /* Page.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A21467097A329100B9050A /* Page.h */; settings = {ATTRIBUTES = (Private, ); }; }; 65A21484097A3F5300B9050A /* FrameTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65A21482097A3F5300B9050A /* FrameTree.cpp */; }; 65A21485097A3F5300B9050A /* FrameTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A21483097A3F5300B9050A /* FrameTree.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -1412,12 +1418,18 @@ 7693BAD3106C2DCA007B0823 /* PluginHalter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7693BACF106C2DCA007B0823 /* PluginHalter.cpp */; }; 7693BAD4106C2DCA007B0823 /* PluginHalter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7693BAD0106C2DCA007B0823 /* PluginHalter.h */; }; 7693BAD5106C2DCA007B0823 /* PluginHalterClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7693BAD1106C2DCA007B0823 /* PluginHalterClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7694563A1214D97C0007CBAE /* JSDOMTokenList.cpp */; }; + 7694563D1214D97C0007CBAE /* JSDOMTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7694563B1214D97C0007CBAE /* JSDOMTokenList.h */; }; + 7694565B1214DB630007CBAE /* DOMDOMTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 769456591214DB630007CBAE /* DOMDOMTokenList.h */; }; + 7694565C1214DB630007CBAE /* DOMDOMTokenList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7694565A1214DB630007CBAE /* DOMDOMTokenList.mm */; }; 76CDD2F21103DA6600680521 /* AccessibilityMenuList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76CDD2EC1103DA6600680521 /* AccessibilityMenuList.cpp */; }; 76CDD2F31103DA6600680521 /* AccessibilityMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = 76CDD2ED1103DA6600680521 /* AccessibilityMenuList.h */; }; 76CDD2F41103DA6600680521 /* AccessibilityMenuListPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76CDD2EE1103DA6600680521 /* AccessibilityMenuListPopup.cpp */; }; 76CDD2F51103DA6600680521 /* AccessibilityMenuListPopup.h in Headers */ = {isa = PBXBuildFile; fileRef = 76CDD2EF1103DA6600680521 /* AccessibilityMenuListPopup.h */; }; 76CDD2F61103DA6600680521 /* AccessibilityMenuListOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76CDD2F01103DA6600680521 /* AccessibilityMenuListOption.cpp */; }; 76CDD2F71103DA6600680521 /* AccessibilityMenuListOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 76CDD2F11103DA6600680521 /* AccessibilityMenuListOption.h */; }; + 76FC2B0B12370DA0006A991A /* DOMTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76FC2B0812370DA0006A991A /* DOMTokenList.cpp */; }; + 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 76FC2B0912370DA0006A991A /* DOMTokenList.h */; }; 76FF17E311235673001D61B5 /* PluginViewNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76FF17E211235673001D61B5 /* PluginViewNone.cpp */; }; 79AC9218109945C80021266E /* JSCompositionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79AC9216109945C80021266E /* JSCompositionEvent.cpp */; }; 79AC9219109945C80021266E /* JSCompositionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 79AC9217109945C80021266E /* JSCompositionEvent.h */; }; @@ -1479,6 +1491,33 @@ 845E72F80FD261EE00A87D79 /* Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 845E72F70FD261EE00A87D79 /* Filter.h */; }; 845E72FB0FD2623900A87D79 /* SVGFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 845E72F90FD2623900A87D79 /* SVGFilter.cpp */; }; 845E72FC0FD2623900A87D79 /* SVGFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 845E72FA0FD2623900A87D79 /* SVGFilter.h */; }; + 84730D771248F0B300D3A9C9 /* DistantLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */; }; + 84730D781248F0B300D3A9C9 /* FEConvolveMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D5B1248F0B300D3A9C9 /* FEConvolveMatrix.cpp */; }; + 84730D791248F0B300D3A9C9 /* FEConvolveMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D5C1248F0B300D3A9C9 /* FEConvolveMatrix.h */; }; + 84730D7A1248F0B300D3A9C9 /* FEDiffuseLighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D5D1248F0B300D3A9C9 /* FEDiffuseLighting.cpp */; }; + 84730D7B1248F0B300D3A9C9 /* FEDiffuseLighting.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D5E1248F0B300D3A9C9 /* FEDiffuseLighting.h */; }; + 84730D7C1248F0B300D3A9C9 /* FEDisplacementMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D5F1248F0B300D3A9C9 /* FEDisplacementMap.cpp */; }; + 84730D7D1248F0B300D3A9C9 /* FEDisplacementMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D601248F0B300D3A9C9 /* FEDisplacementMap.h */; }; + 84730D7E1248F0B300D3A9C9 /* FEFlood.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D611248F0B300D3A9C9 /* FEFlood.cpp */; }; + 84730D7F1248F0B300D3A9C9 /* FEFlood.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D621248F0B300D3A9C9 /* FEFlood.h */; }; + 84730D801248F0B300D3A9C9 /* FELighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D631248F0B300D3A9C9 /* FELighting.cpp */; }; + 84730D811248F0B300D3A9C9 /* FELighting.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D641248F0B300D3A9C9 /* FELighting.h */; }; + 84730D821248F0B300D3A9C9 /* FEMerge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D651248F0B300D3A9C9 /* FEMerge.cpp */; }; + 84730D831248F0B300D3A9C9 /* FEMerge.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D661248F0B300D3A9C9 /* FEMerge.h */; }; + 84730D841248F0B300D3A9C9 /* FEMorphology.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D671248F0B300D3A9C9 /* FEMorphology.cpp */; }; + 84730D851248F0B300D3A9C9 /* FEMorphology.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D681248F0B300D3A9C9 /* FEMorphology.h */; }; + 84730D861248F0B300D3A9C9 /* FEOffset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D691248F0B300D3A9C9 /* FEOffset.cpp */; }; + 84730D871248F0B300D3A9C9 /* FEOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D6A1248F0B300D3A9C9 /* FEOffset.h */; }; + 84730D881248F0B300D3A9C9 /* FESpecularLighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D6B1248F0B300D3A9C9 /* FESpecularLighting.cpp */; }; + 84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D6C1248F0B300D3A9C9 /* FESpecularLighting.h */; }; + 84730D8A1248F0B300D3A9C9 /* FETile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D6D1248F0B300D3A9C9 /* FETile.cpp */; }; + 84730D8B1248F0B300D3A9C9 /* FETile.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D6E1248F0B300D3A9C9 /* FETile.h */; }; + 84730D8C1248F0B300D3A9C9 /* FETurbulence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D6F1248F0B300D3A9C9 /* FETurbulence.cpp */; }; + 84730D8D1248F0B300D3A9C9 /* FETurbulence.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D701248F0B300D3A9C9 /* FETurbulence.h */; }; + 84730D901248F0B300D3A9C9 /* LightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84730D731248F0B300D3A9C9 /* LightSource.cpp */; }; + 84730D911248F0B300D3A9C9 /* LightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D741248F0B300D3A9C9 /* LightSource.h */; }; + 84730D921248F0B300D3A9C9 /* PointLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D751248F0B300D3A9C9 /* PointLightSource.h */; }; + 84730D931248F0B300D3A9C9 /* SpotLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D761248F0B300D3A9C9 /* SpotLightSource.h */; }; 8476C9E511DF6A0B00555B02 /* SVGPathSegListBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8476C9E311DF6A0B00555B02 /* SVGPathSegListBuilder.cpp */; }; 8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E411DF6A0B00555B02 /* SVGPathSegListBuilder.h */; }; 8476C9EA11DF6A2900555B02 /* SVGPathBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8476C9E711DF6A2900555B02 /* SVGPathBuilder.cpp */; }; @@ -2770,7 +2809,7 @@ 976D6C8F122B8A3D001FD1F7 /* FileThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C70122B8A3D001FD1F7 /* FileThreadTask.h */; }; 976D6C90122B8A3D001FD1F7 /* FileWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C71122B8A3D001FD1F7 /* FileWriter.cpp */; }; 976D6C91122B8A3D001FD1F7 /* FileWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C72122B8A3D001FD1F7 /* FileWriter.h */; }; - 976D6C93122B8A3D001FD1F7 /* FileWriterClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C74122B8A3D001FD1F7 /* FileWriterClient.h */; }; + 976D6C93122B8A3D001FD1F7 /* AsyncFileWriterClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C74122B8A3D001FD1F7 /* AsyncFileWriterClient.h */; }; 976D6C94122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C75122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp */; }; 976D6C95122B8A3D001FD1F7 /* ThreadableBlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C76122B8A3D001FD1F7 /* ThreadableBlobRegistry.h */; }; 977B37231228721700B81FF8 /* HTMLElementStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977B371F1228721700B81FF8 /* HTMLElementStack.cpp */; }; @@ -2908,7 +2947,6 @@ A7D20F62107F406900A80392 /* JSWebGLActiveInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D20F60107F406900A80392 /* JSWebGLActiveInfo.cpp */; }; A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */; }; A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */; }; - A7D27FC40E0A599F0079AD2B /* SVGFETile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D27FC30E0A599F0079AD2B /* SVGFETile.cpp */; }; A7D3C5240B576B4B002CA450 /* PasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7D6B3490F61104500B79FD1 /* WorkerScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */; }; A7D6B34A0F61104500B79FD1 /* WorkerScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */; }; @@ -4048,32 +4086,8 @@ B237C8A80D344D110013F707 /* SVGFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B237C8A60D344D110013F707 /* SVGFontData.h */; }; B24055650B5BE640002A28C0 /* DOMSVGElementInstanceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = B24055630B5BE640002A28C0 /* DOMSVGElementInstanceInternal.h */; }; B24055660B5BE640002A28C0 /* DOMSVGElementInstanceListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = B24055640B5BE640002A28C0 /* DOMSVGElementInstanceListInternal.h */; }; - B25599710D00D8BA00BB825C /* SVGDistantLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598D70D00D8B900BB825C /* SVGDistantLightSource.h */; }; - B255997A0D00D8BA00BB825C /* SVGFEConvolveMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598E00D00D8B900BB825C /* SVGFEConvolveMatrix.cpp */; }; - B255997B0D00D8BA00BB825C /* SVGFEConvolveMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598E10D00D8B900BB825C /* SVGFEConvolveMatrix.h */; }; - B255997C0D00D8BA00BB825C /* SVGFEDiffuseLighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598E20D00D8B900BB825C /* SVGFEDiffuseLighting.cpp */; }; - B255997D0D00D8BA00BB825C /* SVGFEDiffuseLighting.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598E30D00D8B900BB825C /* SVGFEDiffuseLighting.h */; }; - B255997E0D00D8BA00BB825C /* SVGFEDisplacementMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598E40D00D8B900BB825C /* SVGFEDisplacementMap.cpp */; }; - B255997F0D00D8BA00BB825C /* SVGFEDisplacementMap.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598E50D00D8B900BB825C /* SVGFEDisplacementMap.h */; }; - B25599800D00D8BA00BB825C /* SVGFEFlood.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598E60D00D8B900BB825C /* SVGFEFlood.cpp */; }; - B25599810D00D8BA00BB825C /* SVGFEFlood.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598E70D00D8B900BB825C /* SVGFEFlood.h */; }; B25599840D00D8BA00BB825C /* SVGFEImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598EA0D00D8B900BB825C /* SVGFEImage.cpp */; }; B25599850D00D8BA00BB825C /* SVGFEImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598EB0D00D8B900BB825C /* SVGFEImage.h */; }; - B25599860D00D8BA00BB825C /* SVGFEMerge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598EC0D00D8B900BB825C /* SVGFEMerge.cpp */; }; - B25599870D00D8BA00BB825C /* SVGFEMerge.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598ED0D00D8B900BB825C /* SVGFEMerge.h */; }; - B25599880D00D8BA00BB825C /* SVGFEMorphology.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598EE0D00D8B900BB825C /* SVGFEMorphology.cpp */; }; - B25599890D00D8BA00BB825C /* SVGFEMorphology.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598EF0D00D8B900BB825C /* SVGFEMorphology.h */; }; - B255998A0D00D8BA00BB825C /* SVGFEOffset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598F00D00D8B900BB825C /* SVGFEOffset.cpp */; }; - B255998B0D00D8BA00BB825C /* SVGFEOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598F10D00D8B900BB825C /* SVGFEOffset.h */; }; - B255998C0D00D8BA00BB825C /* SVGFESpecularLighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598F20D00D8B900BB825C /* SVGFESpecularLighting.cpp */; }; - B255998D0D00D8BA00BB825C /* SVGFESpecularLighting.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598F30D00D8B900BB825C /* SVGFESpecularLighting.h */; }; - B255998E0D00D8BA00BB825C /* SVGFETile.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598F40D00D8B900BB825C /* SVGFETile.h */; }; - B255998F0D00D8BA00BB825C /* SVGFETurbulence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598F50D00D8B900BB825C /* SVGFETurbulence.cpp */; }; - B25599900D00D8BA00BB825C /* SVGFETurbulence.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598F60D00D8B900BB825C /* SVGFETurbulence.h */; }; - B25599930D00D8BA00BB825C /* SVGLightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25598F90D00D8B900BB825C /* SVGLightSource.cpp */; }; - B25599940D00D8BA00BB825C /* SVGLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598FA0D00D8B900BB825C /* SVGLightSource.h */; }; - B25599950D00D8BA00BB825C /* SVGPointLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598FB0D00D8B900BB825C /* SVGPointLightSource.h */; }; - B25599960D00D8BA00BB825C /* SVGSpotLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598FC0D00D8B900BB825C /* SVGSpotLightSource.h */; }; B25599A30D00D8BA00BB825C /* SVGImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B255990B0D00D8B900BB825C /* SVGImage.cpp */; }; B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990C0D00D8B900BB825C /* SVGImage.h */; }; B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990D0D00D8B900BB825C /* EmptyClients.h */; }; @@ -4961,7 +4975,7 @@ BCD9C2C00C17B69E005C90A2 /* JSNamedNodeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2BC0C17B69E005C90A2 /* JSNamedNodeMap.cpp */; }; BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */; }; BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */; }; - BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */; }; + BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCDD454E1236C95C009A7985 /* ColumnInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDD454D1236C95C009A7985 /* ColumnInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCDF317B11F8D683003C5BF8 /* UserTypingGestureIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDF317911F8D683003C5BF8 /* UserTypingGestureIndicator.cpp */; }; BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDF317A11F8D683003C5BF8 /* UserTypingGestureIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5170,7 +5184,7 @@ CEA3949C11D45CDA003094CF /* StaticHashSetNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEA3949A11D45CDA003094CF /* StaticHashSetNodeList.cpp */; }; CEA3949D11D45CDA003094CF /* StaticHashSetNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = CEA3949B11D45CDA003094CF /* StaticHashSetNodeList.h */; }; CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEF418CC1179678C009D112C /* ViewportArguments.cpp */; }; - CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = CEF418CD1179678C009D112C /* ViewportArguments.h */; }; + CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = CEF418CD1179678C009D112C /* ViewportArguments.h */; settings = {ATTRIBUTES = (Private, ); }; }; D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D000EBA011BDAFD400C47726 /* FrameLoaderStateMachine.cpp */; }; D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */ = {isa = PBXBuildFile; fileRef = D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */; settings = {ATTRIBUTES = (Private, ); }; }; D000ED2711C1B9CD00C47726 /* SubframeLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */; }; @@ -5291,8 +5305,6 @@ E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */; }; E415F1690D9A165D0033CE97 /* DOMElementTimeControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E415F1680D9A165D0033CE97 /* DOMElementTimeControl.h */; }; E415F1840D9A1A830033CE97 /* ElementTimeControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E415F1830D9A1A830033CE97 /* ElementTimeControl.h */; }; - E440A2D51191A50B000820B0 /* SVGFELighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E440A2D41191A50B000820B0 /* SVGFELighting.cpp */; }; - E440A2D71191A523000820B0 /* SVGFELighting.h in Headers */ = {isa = PBXBuildFile; fileRef = E440A2D61191A523000820B0 /* SVGFELighting.h */; }; E44613A10CD6331000FADA75 /* HTMLAudioElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */; }; E44613A20CD6331000FADA75 /* HTMLAudioElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613900CD6331000FADA75 /* HTMLAudioElement.h */; }; E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44613920CD6331000FADA75 /* HTMLMediaElement.cpp */; }; @@ -5365,6 +5377,58 @@ F3D461491161D53200CA0D09 /* JSWorkerContextErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */; }; F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */; }; F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */; }; + F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; }; + F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */; }; + F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */; }; + F55B3DB01251F12D003EF269 /* ButtonInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7C1251F12D003EF269 /* ButtonInputType.h */; }; + F55B3DB11251F12D003EF269 /* CheckboxInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D7D1251F12D003EF269 /* CheckboxInputType.cpp */; }; + F55B3DB21251F12D003EF269 /* CheckboxInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7E1251F12D003EF269 /* CheckboxInputType.h */; }; + F55B3DB31251F12D003EF269 /* ColorInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D7F1251F12D003EF269 /* ColorInputType.cpp */; }; + F55B3DB41251F12D003EF269 /* ColorInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D801251F12D003EF269 /* ColorInputType.h */; }; + F55B3DB51251F12D003EF269 /* DateInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D811251F12D003EF269 /* DateInputType.cpp */; }; + F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D821251F12D003EF269 /* DateInputType.h */; }; + F55B3DB71251F12D003EF269 /* DateTimeInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D831251F12D003EF269 /* DateTimeInputType.cpp */; }; + F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D841251F12D003EF269 /* DateTimeInputType.h */; }; + F55B3DB91251F12D003EF269 /* DateTimeLocalInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D851251F12D003EF269 /* DateTimeLocalInputType.cpp */; }; + F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D861251F12D003EF269 /* DateTimeLocalInputType.h */; }; + F55B3DBB1251F12D003EF269 /* EmailInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D871251F12D003EF269 /* EmailInputType.cpp */; }; + F55B3DBC1251F12D003EF269 /* EmailInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D881251F12D003EF269 /* EmailInputType.h */; }; + F55B3DBD1251F12D003EF269 /* FileInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D891251F12D003EF269 /* FileInputType.cpp */; }; + F55B3DBE1251F12D003EF269 /* FileInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D8A1251F12D003EF269 /* FileInputType.h */; }; + F55B3DBF1251F12D003EF269 /* HiddenInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D8B1251F12D003EF269 /* HiddenInputType.cpp */; }; + F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D8C1251F12D003EF269 /* HiddenInputType.h */; }; + F55B3DC11251F12D003EF269 /* ImageInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */; }; + F55B3DC21251F12D003EF269 /* ImageInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D8E1251F12D003EF269 /* ImageInputType.h */; }; + F55B3DC31251F12D003EF269 /* IsIndexInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D8F1251F12D003EF269 /* IsIndexInputType.cpp */; }; + F55B3DC41251F12D003EF269 /* IsIndexInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D901251F12D003EF269 /* IsIndexInputType.h */; }; + F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D911251F12D003EF269 /* MonthInputType.cpp */; }; + F55B3DC61251F12D003EF269 /* MonthInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D921251F12D003EF269 /* MonthInputType.h */; }; + F55B3DC71251F12D003EF269 /* NumberInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D931251F12D003EF269 /* NumberInputType.cpp */; }; + F55B3DC81251F12D003EF269 /* NumberInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D941251F12D003EF269 /* NumberInputType.h */; }; + F55B3DC91251F12D003EF269 /* PasswordInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D951251F12D003EF269 /* PasswordInputType.cpp */; }; + F55B3DCA1251F12D003EF269 /* PasswordInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D961251F12D003EF269 /* PasswordInputType.h */; }; + F55B3DCB1251F12D003EF269 /* RadioInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D971251F12D003EF269 /* RadioInputType.cpp */; }; + F55B3DCC1251F12D003EF269 /* RadioInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D981251F12D003EF269 /* RadioInputType.h */; }; + F55B3DCD1251F12D003EF269 /* RangeInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D991251F12D003EF269 /* RangeInputType.cpp */; }; + F55B3DCE1251F12D003EF269 /* RangeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D9A1251F12D003EF269 /* RangeInputType.h */; }; + F55B3DCF1251F12D003EF269 /* ResetInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D9B1251F12D003EF269 /* ResetInputType.cpp */; }; + F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D9C1251F12D003EF269 /* ResetInputType.h */; }; + F55B3DD11251F12D003EF269 /* SearchInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D9D1251F12D003EF269 /* SearchInputType.cpp */; }; + F55B3DD21251F12D003EF269 /* SearchInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D9E1251F12D003EF269 /* SearchInputType.h */; }; + F55B3DD31251F12D003EF269 /* SubmitInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D9F1251F12D003EF269 /* SubmitInputType.cpp */; }; + F55B3DD41251F12D003EF269 /* SubmitInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DA01251F12D003EF269 /* SubmitInputType.h */; }; + F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DA11251F12D003EF269 /* TelephoneInputType.cpp */; }; + F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DA21251F12D003EF269 /* TelephoneInputType.h */; }; + F55B3DD71251F12D003EF269 /* TextFieldInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DA31251F12D003EF269 /* TextFieldInputType.cpp */; }; + F55B3DD81251F12D003EF269 /* TextFieldInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DA41251F12D003EF269 /* TextFieldInputType.h */; }; + F55B3DD91251F12D003EF269 /* TextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DA51251F12D003EF269 /* TextInputType.cpp */; }; + F55B3DDA1251F12D003EF269 /* TextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DA61251F12D003EF269 /* TextInputType.h */; }; + F55B3DDB1251F12D003EF269 /* TimeInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DA71251F12D003EF269 /* TimeInputType.cpp */; }; + F55B3DDC1251F12D003EF269 /* TimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DA81251F12D003EF269 /* TimeInputType.h */; }; + F55B3DDD1251F12D003EF269 /* URLInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DA91251F12D003EF269 /* URLInputType.cpp */; }; + F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DAA1251F12D003EF269 /* URLInputType.h */; }; + F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DAB1251F12D003EF269 /* WeekInputType.cpp */; }; + F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DAC1251F12D003EF269 /* WeekInputType.h */; }; F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */; }; F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */; }; F5C041E30FFCA96D00839D4A /* DOMHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */; }; @@ -6710,6 +6774,8 @@ 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextControllerCoreText.cpp; sourceTree = "<group>"; }; 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypesettingFeatures.h; sourceTree = "<group>"; }; 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringKeyedMRUCache.h; sourceTree = "<group>"; }; + 37E3524A12450C5200BAF5D9 /* InputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputType.cpp; sourceTree = "<group>"; }; + 37E3524C12450C6600BAF5D9 /* InputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputType.h; sourceTree = "<group>"; }; 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreURLResponse.h; sourceTree = "<group>"; }; 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponse.mm; sourceTree = "<group>"; }; 37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrailingFloatsRootInlineBox.h; sourceTree = "<group>"; }; @@ -7370,12 +7436,19 @@ 7693BACF106C2DCA007B0823 /* PluginHalter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginHalter.cpp; sourceTree = "<group>"; }; 7693BAD0106C2DCA007B0823 /* PluginHalter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginHalter.h; sourceTree = "<group>"; }; 7693BAD1106C2DCA007B0823 /* PluginHalterClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginHalterClient.h; sourceTree = "<group>"; }; + 7694563A1214D97C0007CBAE /* JSDOMTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMTokenList.cpp; sourceTree = "<group>"; }; + 7694563B1214D97C0007CBAE /* JSDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMTokenList.h; sourceTree = "<group>"; }; + 769456591214DB630007CBAE /* DOMDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMTokenList.h; sourceTree = "<group>"; }; + 7694565A1214DB630007CBAE /* DOMDOMTokenList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMDOMTokenList.mm; sourceTree = "<group>"; }; 76CDD2EC1103DA6600680521 /* AccessibilityMenuList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMenuList.cpp; sourceTree = "<group>"; }; 76CDD2ED1103DA6600680521 /* AccessibilityMenuList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMenuList.h; sourceTree = "<group>"; }; 76CDD2EE1103DA6600680521 /* AccessibilityMenuListPopup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMenuListPopup.cpp; sourceTree = "<group>"; }; 76CDD2EF1103DA6600680521 /* AccessibilityMenuListPopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMenuListPopup.h; sourceTree = "<group>"; }; 76CDD2F01103DA6600680521 /* AccessibilityMenuListOption.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMenuListOption.cpp; sourceTree = "<group>"; }; 76CDD2F11103DA6600680521 /* AccessibilityMenuListOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMenuListOption.h; sourceTree = "<group>"; }; + 76FC2B0812370DA0006A991A /* DOMTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTokenList.cpp; sourceTree = "<group>"; }; + 76FC2B0912370DA0006A991A /* DOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTokenList.h; sourceTree = "<group>"; }; + 76FC2B0A12370DA0006A991A /* DOMTokenList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMTokenList.idl; sourceTree = "<group>"; }; 76FF17E211235673001D61B5 /* PluginViewNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginViewNone.cpp; sourceTree = "<group>"; }; 79AC9216109945C80021266E /* JSCompositionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCompositionEvent.cpp; sourceTree = "<group>"; }; 79AC9217109945C80021266E /* JSCompositionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCompositionEvent.h; sourceTree = "<group>"; }; @@ -7442,6 +7515,33 @@ 845E72F70FD261EE00A87D79 /* Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filter.h; path = filters/Filter.h; sourceTree = "<group>"; }; 845E72F90FD2623900A87D79 /* SVGFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilter.cpp; sourceTree = "<group>"; }; 845E72FA0FD2623900A87D79 /* SVGFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilter.h; sourceTree = "<group>"; }; + 84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DistantLightSource.h; path = filters/DistantLightSource.h; sourceTree = "<group>"; }; + 84730D5B1248F0B300D3A9C9 /* FEConvolveMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEConvolveMatrix.cpp; path = filters/FEConvolveMatrix.cpp; sourceTree = "<group>"; }; + 84730D5C1248F0B300D3A9C9 /* FEConvolveMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEConvolveMatrix.h; path = filters/FEConvolveMatrix.h; sourceTree = "<group>"; }; + 84730D5D1248F0B300D3A9C9 /* FEDiffuseLighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEDiffuseLighting.cpp; path = filters/FEDiffuseLighting.cpp; sourceTree = "<group>"; }; + 84730D5E1248F0B300D3A9C9 /* FEDiffuseLighting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEDiffuseLighting.h; path = filters/FEDiffuseLighting.h; sourceTree = "<group>"; }; + 84730D5F1248F0B300D3A9C9 /* FEDisplacementMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEDisplacementMap.cpp; path = filters/FEDisplacementMap.cpp; sourceTree = "<group>"; }; + 84730D601248F0B300D3A9C9 /* FEDisplacementMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEDisplacementMap.h; path = filters/FEDisplacementMap.h; sourceTree = "<group>"; }; + 84730D611248F0B300D3A9C9 /* FEFlood.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEFlood.cpp; path = filters/FEFlood.cpp; sourceTree = "<group>"; }; + 84730D621248F0B300D3A9C9 /* FEFlood.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEFlood.h; path = filters/FEFlood.h; sourceTree = "<group>"; }; + 84730D631248F0B300D3A9C9 /* FELighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FELighting.cpp; path = filters/FELighting.cpp; sourceTree = "<group>"; }; + 84730D641248F0B300D3A9C9 /* FELighting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FELighting.h; path = filters/FELighting.h; sourceTree = "<group>"; }; + 84730D651248F0B300D3A9C9 /* FEMerge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEMerge.cpp; path = filters/FEMerge.cpp; sourceTree = "<group>"; }; + 84730D661248F0B300D3A9C9 /* FEMerge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEMerge.h; path = filters/FEMerge.h; sourceTree = "<group>"; }; + 84730D671248F0B300D3A9C9 /* FEMorphology.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEMorphology.cpp; path = filters/FEMorphology.cpp; sourceTree = "<group>"; }; + 84730D681248F0B300D3A9C9 /* FEMorphology.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEMorphology.h; path = filters/FEMorphology.h; sourceTree = "<group>"; }; + 84730D691248F0B300D3A9C9 /* FEOffset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEOffset.cpp; path = filters/FEOffset.cpp; sourceTree = "<group>"; }; + 84730D6A1248F0B300D3A9C9 /* FEOffset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEOffset.h; path = filters/FEOffset.h; sourceTree = "<group>"; }; + 84730D6B1248F0B300D3A9C9 /* FESpecularLighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FESpecularLighting.cpp; path = filters/FESpecularLighting.cpp; sourceTree = "<group>"; }; + 84730D6C1248F0B300D3A9C9 /* FESpecularLighting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESpecularLighting.h; path = filters/FESpecularLighting.h; sourceTree = "<group>"; }; + 84730D6D1248F0B300D3A9C9 /* FETile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FETile.cpp; path = filters/FETile.cpp; sourceTree = "<group>"; }; + 84730D6E1248F0B300D3A9C9 /* FETile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FETile.h; path = filters/FETile.h; sourceTree = "<group>"; }; + 84730D6F1248F0B300D3A9C9 /* FETurbulence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FETurbulence.cpp; path = filters/FETurbulence.cpp; sourceTree = "<group>"; }; + 84730D701248F0B300D3A9C9 /* FETurbulence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FETurbulence.h; path = filters/FETurbulence.h; sourceTree = "<group>"; }; + 84730D731248F0B300D3A9C9 /* LightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LightSource.cpp; path = filters/LightSource.cpp; sourceTree = "<group>"; }; + 84730D741248F0B300D3A9C9 /* LightSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LightSource.h; path = filters/LightSource.h; sourceTree = "<group>"; }; + 84730D751248F0B300D3A9C9 /* PointLightSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PointLightSource.h; path = filters/PointLightSource.h; sourceTree = "<group>"; }; + 84730D761248F0B300D3A9C9 /* SpotLightSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotLightSource.h; path = filters/SpotLightSource.h; sourceTree = "<group>"; }; 8476C9E311DF6A0B00555B02 /* SVGPathSegListBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListBuilder.cpp; sourceTree = "<group>"; }; 8476C9E411DF6A0B00555B02 /* SVGPathSegListBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListBuilder.h; sourceTree = "<group>"; }; 8476C9E711DF6A2900555B02 /* SVGPathBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathBuilder.cpp; sourceTree = "<group>"; }; @@ -8670,7 +8770,7 @@ 976D6C70122B8A3D001FD1F7 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileThreadTask.h; path = fileapi/FileThreadTask.h; sourceTree = "<group>"; }; 976D6C71122B8A3D001FD1F7 /* FileWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileWriter.cpp; path = fileapi/FileWriter.cpp; sourceTree = "<group>"; }; 976D6C72122B8A3D001FD1F7 /* FileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileWriter.h; path = fileapi/FileWriter.h; sourceTree = "<group>"; }; - 976D6C74122B8A3D001FD1F7 /* FileWriterClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileWriterClient.h; path = fileapi/FileWriterClient.h; sourceTree = "<group>"; }; + 976D6C74122B8A3D001FD1F7 /* AsyncFileWriterClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AsyncFileWriterClient.h; path = fileapi/AsyncFileWriterClient.h; sourceTree = "<group>"; }; 976D6C75122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadableBlobRegistry.cpp; path = fileapi/ThreadableBlobRegistry.cpp; sourceTree = "<group>"; }; 976D6C76122B8A3D001FD1F7 /* ThreadableBlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadableBlobRegistry.h; path = fileapi/ThreadableBlobRegistry.h; sourceTree = "<group>"; }; 977B371F1228721700B81FF8 /* HTMLElementStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLElementStack.cpp; path = parser/HTMLElementStack.cpp; sourceTree = "<group>"; }; @@ -8817,7 +8917,6 @@ A7D20F60107F406900A80392 /* JSWebGLActiveInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLActiveInfo.cpp; sourceTree = "<group>"; }; A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLActiveInfo.h; sourceTree = "<group>"; }; A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLActiveInfo.h; path = canvas/WebGLActiveInfo.h; sourceTree = "<group>"; }; - A7D27FC30E0A599F0079AD2B /* SVGFETile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFETile.cpp; sourceTree = "<group>"; }; A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardHelper.h; sourceTree = "<group>"; }; A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerScriptLoader.h; path = workers/WorkerScriptLoader.h; sourceTree = "<group>"; }; A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WorkerScriptLoader.cpp; path = workers/WorkerScriptLoader.cpp; sourceTree = "<group>"; }; @@ -9844,32 +9943,8 @@ B237C8A60D344D110013F707 /* SVGFontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFontData.h; sourceTree = "<group>"; }; B24055630B5BE640002A28C0 /* DOMSVGElementInstanceInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGElementInstanceInternal.h; sourceTree = "<group>"; }; B24055640B5BE640002A28C0 /* DOMSVGElementInstanceListInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGElementInstanceListInternal.h; sourceTree = "<group>"; }; - B25598D70D00D8B900BB825C /* SVGDistantLightSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGDistantLightSource.h; sourceTree = "<group>"; }; - B25598E00D00D8B900BB825C /* SVGFEConvolveMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEConvolveMatrix.cpp; sourceTree = "<group>"; }; - B25598E10D00D8B900BB825C /* SVGFEConvolveMatrix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEConvolveMatrix.h; sourceTree = "<group>"; }; - B25598E20D00D8B900BB825C /* SVGFEDiffuseLighting.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEDiffuseLighting.cpp; sourceTree = "<group>"; }; - B25598E30D00D8B900BB825C /* SVGFEDiffuseLighting.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEDiffuseLighting.h; sourceTree = "<group>"; }; - B25598E40D00D8B900BB825C /* SVGFEDisplacementMap.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEDisplacementMap.cpp; sourceTree = "<group>"; }; - B25598E50D00D8B900BB825C /* SVGFEDisplacementMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEDisplacementMap.h; sourceTree = "<group>"; }; - B25598E60D00D8B900BB825C /* SVGFEFlood.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEFlood.cpp; sourceTree = "<group>"; }; - B25598E70D00D8B900BB825C /* SVGFEFlood.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEFlood.h; sourceTree = "<group>"; }; B25598EA0D00D8B900BB825C /* SVGFEImage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEImage.cpp; sourceTree = "<group>"; }; B25598EB0D00D8B900BB825C /* SVGFEImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEImage.h; sourceTree = "<group>"; }; - B25598EC0D00D8B900BB825C /* SVGFEMerge.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEMerge.cpp; sourceTree = "<group>"; }; - B25598ED0D00D8B900BB825C /* SVGFEMerge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEMerge.h; sourceTree = "<group>"; }; - B25598EE0D00D8B900BB825C /* SVGFEMorphology.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEMorphology.cpp; sourceTree = "<group>"; }; - B25598EF0D00D8B900BB825C /* SVGFEMorphology.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEMorphology.h; sourceTree = "<group>"; }; - B25598F00D00D8B900BB825C /* SVGFEOffset.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEOffset.cpp; sourceTree = "<group>"; }; - B25598F10D00D8B900BB825C /* SVGFEOffset.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFEOffset.h; sourceTree = "<group>"; }; - B25598F20D00D8B900BB825C /* SVGFESpecularLighting.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFESpecularLighting.cpp; sourceTree = "<group>"; }; - B25598F30D00D8B900BB825C /* SVGFESpecularLighting.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFESpecularLighting.h; sourceTree = "<group>"; }; - B25598F40D00D8B900BB825C /* SVGFETile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFETile.h; sourceTree = "<group>"; }; - B25598F50D00D8B900BB825C /* SVGFETurbulence.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFETurbulence.cpp; sourceTree = "<group>"; }; - B25598F60D00D8B900BB825C /* SVGFETurbulence.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGFETurbulence.h; sourceTree = "<group>"; }; - B25598F90D00D8B900BB825C /* SVGLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLightSource.cpp; sourceTree = "<group>"; }; - B25598FA0D00D8B900BB825C /* SVGLightSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGLightSource.h; sourceTree = "<group>"; }; - B25598FB0D00D8B900BB825C /* SVGPointLightSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPointLightSource.h; sourceTree = "<group>"; }; - B25598FC0D00D8B900BB825C /* SVGSpotLightSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGSpotLightSource.h; sourceTree = "<group>"; }; B255990B0D00D8B900BB825C /* SVGImage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGImage.cpp; sourceTree = "<group>"; }; B255990C0D00D8B900BB825C /* SVGImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGImage.h; sourceTree = "<group>"; }; B255990D0D00D8B900BB825C /* EmptyClients.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EmptyClients.h; sourceTree = "<group>"; }; @@ -11159,8 +11234,6 @@ E415F1830D9A1A830033CE97 /* ElementTimeControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementTimeControl.h; sourceTree = "<group>"; }; E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyNames.cpp; sourceTree = "<group>"; }; E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueKeywords.cpp; sourceTree = "<group>"; }; - E440A2D41191A50B000820B0 /* SVGFELighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFELighting.cpp; sourceTree = "<group>"; }; - E440A2D61191A523000820B0 /* SVGFELighting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFELighting.h; sourceTree = "<group>"; }; E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLAudioElement.cpp; sourceTree = "<group>"; }; E44613900CD6331000FADA75 /* HTMLAudioElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLAudioElement.h; sourceTree = "<group>"; }; E44613910CD6331000FADA75 /* HTMLAudioElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLAudioElement.idl; sourceTree = "<group>"; }; @@ -11252,6 +11325,58 @@ F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D30902DE4476018635CA /* XMLDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocumentParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D30A02DE4476018635CA /* XMLDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocumentParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTextInputType.cpp; sourceTree = "<group>"; }; + F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTextInputType.h; sourceTree = "<group>"; }; + F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonInputType.cpp; sourceTree = "<group>"; }; + F55B3D7C1251F12D003EF269 /* ButtonInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonInputType.h; sourceTree = "<group>"; }; + F55B3D7D1251F12D003EF269 /* CheckboxInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckboxInputType.cpp; sourceTree = "<group>"; }; + F55B3D7E1251F12D003EF269 /* CheckboxInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckboxInputType.h; sourceTree = "<group>"; }; + F55B3D7F1251F12D003EF269 /* ColorInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorInputType.cpp; sourceTree = "<group>"; }; + F55B3D801251F12D003EF269 /* ColorInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorInputType.h; sourceTree = "<group>"; }; + F55B3D811251F12D003EF269 /* DateInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateInputType.cpp; sourceTree = "<group>"; }; + F55B3D821251F12D003EF269 /* DateInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInputType.h; sourceTree = "<group>"; }; + F55B3D831251F12D003EF269 /* DateTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateTimeInputType.cpp; sourceTree = "<group>"; }; + F55B3D841251F12D003EF269 /* DateTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeInputType.h; sourceTree = "<group>"; }; + F55B3D851251F12D003EF269 /* DateTimeLocalInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateTimeLocalInputType.cpp; sourceTree = "<group>"; }; + F55B3D861251F12D003EF269 /* DateTimeLocalInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeLocalInputType.h; sourceTree = "<group>"; }; + F55B3D871251F12D003EF269 /* EmailInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmailInputType.cpp; sourceTree = "<group>"; }; + F55B3D881251F12D003EF269 /* EmailInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailInputType.h; sourceTree = "<group>"; }; + F55B3D891251F12D003EF269 /* FileInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileInputType.cpp; sourceTree = "<group>"; }; + F55B3D8A1251F12D003EF269 /* FileInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileInputType.h; sourceTree = "<group>"; }; + F55B3D8B1251F12D003EF269 /* HiddenInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HiddenInputType.cpp; sourceTree = "<group>"; }; + F55B3D8C1251F12D003EF269 /* HiddenInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HiddenInputType.h; sourceTree = "<group>"; }; + F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageInputType.cpp; sourceTree = "<group>"; }; + F55B3D8E1251F12D003EF269 /* ImageInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageInputType.h; sourceTree = "<group>"; }; + F55B3D8F1251F12D003EF269 /* IsIndexInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IsIndexInputType.cpp; sourceTree = "<group>"; }; + F55B3D901251F12D003EF269 /* IsIndexInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IsIndexInputType.h; sourceTree = "<group>"; }; + F55B3D911251F12D003EF269 /* MonthInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MonthInputType.cpp; sourceTree = "<group>"; }; + F55B3D921251F12D003EF269 /* MonthInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MonthInputType.h; sourceTree = "<group>"; }; + F55B3D931251F12D003EF269 /* NumberInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NumberInputType.cpp; sourceTree = "<group>"; }; + F55B3D941251F12D003EF269 /* NumberInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberInputType.h; sourceTree = "<group>"; }; + F55B3D951251F12D003EF269 /* PasswordInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PasswordInputType.cpp; sourceTree = "<group>"; }; + F55B3D961251F12D003EF269 /* PasswordInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasswordInputType.h; sourceTree = "<group>"; }; + F55B3D971251F12D003EF269 /* RadioInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RadioInputType.cpp; sourceTree = "<group>"; }; + F55B3D981251F12D003EF269 /* RadioInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioInputType.h; sourceTree = "<group>"; }; + F55B3D991251F12D003EF269 /* RangeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RangeInputType.cpp; sourceTree = "<group>"; }; + F55B3D9A1251F12D003EF269 /* RangeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RangeInputType.h; sourceTree = "<group>"; }; + F55B3D9B1251F12D003EF269 /* ResetInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResetInputType.cpp; sourceTree = "<group>"; }; + F55B3D9C1251F12D003EF269 /* ResetInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResetInputType.h; sourceTree = "<group>"; }; + F55B3D9D1251F12D003EF269 /* SearchInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SearchInputType.cpp; sourceTree = "<group>"; }; + F55B3D9E1251F12D003EF269 /* SearchInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchInputType.h; sourceTree = "<group>"; }; + F55B3D9F1251F12D003EF269 /* SubmitInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubmitInputType.cpp; sourceTree = "<group>"; }; + F55B3DA01251F12D003EF269 /* SubmitInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubmitInputType.h; sourceTree = "<group>"; }; + F55B3DA11251F12D003EF269 /* TelephoneInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneInputType.cpp; sourceTree = "<group>"; }; + F55B3DA21251F12D003EF269 /* TelephoneInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneInputType.h; sourceTree = "<group>"; }; + F55B3DA31251F12D003EF269 /* TextFieldInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextFieldInputType.cpp; sourceTree = "<group>"; }; + F55B3DA41251F12D003EF269 /* TextFieldInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextFieldInputType.h; sourceTree = "<group>"; }; + F55B3DA51251F12D003EF269 /* TextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextInputType.cpp; sourceTree = "<group>"; }; + F55B3DA61251F12D003EF269 /* TextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputType.h; sourceTree = "<group>"; }; + F55B3DA71251F12D003EF269 /* TimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeInputType.cpp; sourceTree = "<group>"; }; + F55B3DA81251F12D003EF269 /* TimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeInputType.h; sourceTree = "<group>"; }; + F55B3DA91251F12D003EF269 /* URLInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLInputType.cpp; sourceTree = "<group>"; }; + F55B3DAA1251F12D003EF269 /* URLInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLInputType.h; sourceTree = "<group>"; }; + F55B3DAB1251F12D003EF269 /* WeekInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeekInputType.cpp; sourceTree = "<group>"; }; + F55B3DAC1251F12D003EF269 /* WeekInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeekInputType.h; sourceTree = "<group>"; }; F58784F002DE375901EA4122 /* CursorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CursorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrListImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F587851602DE375901EA4122 /* DeprecatedPtrListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedPtrListImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -13520,6 +13645,8 @@ children = ( 2E2D99E510E2BC1C00496337 /* DOMBlob.h */, 2E2D99E610E2BC1C00496337 /* DOMBlob.mm */, + 769456591214DB630007CBAE /* DOMDOMTokenList.h */, + 7694565A1214DB630007CBAE /* DOMDOMTokenList.mm */, BC00EFFE0E0A185500FD04E3 /* DOMFile.h */, BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */, 2E3BC106117D479800B9409A /* DOMFileError.h */, @@ -14126,9 +14253,17 @@ 97C1F5511228558800EDE616 /* parser */, B0149E7911A4B21500196A7B /* AsyncImageResizer.cpp */, B0149E7A11A4B21500196A7B /* AsyncImageResizer.h */, + F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */, + F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */, + F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */, + F55B3D7C1251F12D003EF269 /* ButtonInputType.h */, + F55B3D7D1251F12D003EF269 /* CheckboxInputType.cpp */, + F55B3D7E1251F12D003EF269 /* CheckboxInputType.h */, 93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */, 93C441EE0F813A1A00C1A634 /* CollectionCache.h */, 93C441FF0F813AE100C1A634 /* CollectionType.h */, + F55B3D7F1251F12D003EF269 /* ColorInputType.cpp */, + F55B3D801251F12D003EF269 /* ColorInputType.h */, BC77D2380FF298080070887B /* DataGridColumn.cpp */, BC77CFC10FF175550070887B /* DataGridColumn.h */, BC77CF9E0FF172B30070887B /* DataGridColumn.idl */, @@ -14138,15 +14273,30 @@ BCBCAE360FF19385000762AE /* DataGridDataSource.h */, F5D3A57A106B83B300545297 /* DateComponents.cpp */, F5D3A57B106B83B300545297 /* DateComponents.h */, + F55B3D811251F12D003EF269 /* DateInputType.cpp */, + F55B3D821251F12D003EF269 /* DateInputType.h */, + F55B3D831251F12D003EF269 /* DateTimeInputType.cpp */, + F55B3D841251F12D003EF269 /* DateTimeInputType.h */, + F55B3D851251F12D003EF269 /* DateTimeLocalInputType.cpp */, + F55B3D861251F12D003EF269 /* DateTimeLocalInputType.h */, BC7DAAEC0FF9615D00CE0138 /* DOMDataGridDataSource.cpp */, BC7DAAED0FF9615D00CE0138 /* DOMDataGridDataSource.h */, 2ED609BA1145B07100C8684E /* DOMFormData.cpp */, 2ED609BB1145B07100C8684E /* DOMFormData.h */, 2E0888C3114883A900AF4265 /* DOMFormData.idl */, + 76FC2B0812370DA0006A991A /* DOMTokenList.cpp */, + 76FC2B0912370DA0006A991A /* DOMTokenList.h */, + 76FC2B0A12370DA0006A991A /* DOMTokenList.idl */, + F55B3D871251F12D003EF269 /* EmailInputType.cpp */, + F55B3D881251F12D003EF269 /* EmailInputType.h */, + F55B3D891251F12D003EF269 /* FileInputType.cpp */, + F55B3D8A1251F12D003EF269 /* FileInputType.h */, A8136D370973A8E700D74463 /* FormDataList.cpp */, A8136D360973A8E700D74463 /* FormDataList.h */, 97205AAD123928CA00B17380 /* FTPDirectoryDocument.cpp */, 97205AAE123928CA00B17380 /* FTPDirectoryDocument.h */, + F55B3D8B1251F12D003EF269 /* HiddenInputType.cpp */, + F55B3D8C1251F12D003EF269 /* HiddenInputType.h */, BC97E239109144950010D361 /* HTMLAllCollection.cpp */, BC97E238109144950010D361 /* HTMLAllCollection.h */, BC97E23C109146F10010D361 /* HTMLAllCollection.idl */, @@ -14399,30 +14549,64 @@ A77979150D6B9D0C003851B9 /* ImageData.idl */, 97205AB11239291000B17380 /* ImageDocument.cpp */, 97205AB21239291000B17380 /* ImageDocument.h */, + F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */, + F55B3D8E1251F12D003EF269 /* ImageInputType.h */, B0149E7B11A4B21500196A7B /* ImageResizerThread.cpp */, B0149E7C11A4B21500196A7B /* ImageResizerThread.h */, + 37E3524A12450C5200BAF5D9 /* InputType.cpp */, + 37E3524C12450C6600BAF5D9 /* InputType.h */, + F55B3D8F1251F12D003EF269 /* IsIndexInputType.cpp */, + F55B3D901251F12D003EF269 /* IsIndexInputType.h */, A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */, A456FA2511AD4A830020B420 /* LabelsNodeList.h */, 97205AB31239291000B17380 /* MediaDocument.cpp */, 97205AB41239291000B17380 /* MediaDocument.h */, E446139B0CD6331000FADA75 /* MediaError.h */, E446139C0CD6331000FADA75 /* MediaError.idl */, + F55B3D911251F12D003EF269 /* MonthInputType.cpp */, + F55B3D921251F12D003EF269 /* MonthInputType.h */, + F55B3D931251F12D003EF269 /* NumberInputType.cpp */, + F55B3D941251F12D003EF269 /* NumberInputType.h */, + F55B3D951251F12D003EF269 /* PasswordInputType.cpp */, + F55B3D961251F12D003EF269 /* PasswordInputType.h */, 97205AB91239292700B17380 /* PluginDocument.cpp */, 97205ABA1239292700B17380 /* PluginDocument.h */, + F55B3D971251F12D003EF269 /* RadioInputType.cpp */, + F55B3D981251F12D003EF269 /* RadioInputType.h */, + F55B3D991251F12D003EF269 /* RangeInputType.cpp */, + F55B3D9A1251F12D003EF269 /* RangeInputType.h */, + F55B3D9B1251F12D003EF269 /* ResetInputType.cpp */, + F55B3D9C1251F12D003EF269 /* ResetInputType.h */, + F55B3D9D1251F12D003EF269 /* SearchInputType.cpp */, + F55B3D9E1251F12D003EF269 /* SearchInputType.h */, A5AFB34D115151A700B045CB /* StepRange.cpp */, A5AFB34E115151A700B045CB /* StepRange.h */, + F55B3D9F1251F12D003EF269 /* SubmitInputType.cpp */, + F55B3DA01251F12D003EF269 /* SubmitInputType.h */, + F55B3DA11251F12D003EF269 /* TelephoneInputType.cpp */, + F55B3DA21251F12D003EF269 /* TelephoneInputType.h */, 97BC84B112371180000C6161 /* TextDocument.cpp */, 97BC84B212371180000C6161 /* TextDocument.h */, + F55B3DA31251F12D003EF269 /* TextFieldInputType.cpp */, + F55B3DA41251F12D003EF269 /* TextFieldInputType.h */, + F55B3DA51251F12D003EF269 /* TextInputType.cpp */, + F55B3DA61251F12D003EF269 /* TextInputType.h */, BCEF45E80E687767001C1287 /* TextMetrics.h */, BCEF453F0E676AC1001C1287 /* TextMetrics.idl */, + F55B3DA71251F12D003EF269 /* TimeInputType.cpp */, + F55B3DA81251F12D003EF269 /* TimeInputType.h */, E446139D0CD6331000FADA75 /* TimeRanges.cpp */, E446139E0CD6331000FADA75 /* TimeRanges.h */, E446139F0CD6331000FADA75 /* TimeRanges.idl */, + F55B3DA91251F12D003EF269 /* URLInputType.cpp */, + F55B3DAA1251F12D003EF269 /* URLInputType.h */, 15C7708B100D3C6A005BA267 /* ValidityState.cpp */, 15C7708A100D3C6A005BA267 /* ValidityState.h */, 15C77089100D3C6A005BA267 /* ValidityState.idl */, E44613B40CD6344E00FADA75 /* VoidCallback.h */, E44613A00CD6331000FADA75 /* VoidCallback.idl */, + F55B3DAB1251F12D003EF269 /* WeekInputType.cpp */, + F55B3DAC1251F12D003EF269 /* WeekInputType.h */, ); path = html; sourceTree = "<group>"; @@ -14433,6 +14617,7 @@ isa = PBXGroup; children = ( 976D6C58122B8A3D001FD1F7 /* AsyncFileWriter.h */, + 976D6C74122B8A3D001FD1F7 /* AsyncFileWriterClient.h */, 976D6C59122B8A3D001FD1F7 /* Blob.cpp */, 976D6C5A122B8A3D001FD1F7 /* Blob.h */, 976D6C5C122B8A3D001FD1F7 /* BlobBuilder.cpp */, @@ -14478,7 +14663,6 @@ 976D6C71122B8A3D001FD1F7 /* FileWriter.cpp */, 976D6C72122B8A3D001FD1F7 /* FileWriter.h */, 893C47A61238908B002B3D86 /* FileWriterCallback.h */, - 976D6C74122B8A3D001FD1F7 /* FileWriterClient.h */, 8987854D122CA064003AABDA /* Flags.h */, 8987854E122CA064003AABDA /* LocalFileSystem.cpp */, 8987854F122CA064003AABDA /* LocalFileSystem.h */, @@ -14565,6 +14749,7 @@ A75E8B7F0E1DE2B0007F2481 /* filters */ = { isa = PBXGroup; children = ( + 84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */, A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */, A75E8B810E1DE2D6007F2481 /* FEBlend.h */, A75E8B820E1DE2D6007F2481 /* FEColorMatrix.cpp */, @@ -14573,15 +14758,41 @@ A75E8B850E1DE2D6007F2481 /* FEComponentTransfer.h */, A75E8B860E1DE2D6007F2481 /* FEComposite.cpp */, A75E8B870E1DE2D6007F2481 /* FEComposite.h */, + 84730D5B1248F0B300D3A9C9 /* FEConvolveMatrix.cpp */, + 84730D5C1248F0B300D3A9C9 /* FEConvolveMatrix.h */, + 84730D5D1248F0B300D3A9C9 /* FEDiffuseLighting.cpp */, + 84730D5E1248F0B300D3A9C9 /* FEDiffuseLighting.h */, + 84730D5F1248F0B300D3A9C9 /* FEDisplacementMap.cpp */, + 84730D601248F0B300D3A9C9 /* FEDisplacementMap.h */, + 84730D611248F0B300D3A9C9 /* FEFlood.cpp */, + 84730D621248F0B300D3A9C9 /* FEFlood.h */, 84801952108BAFB300CB2B1F /* FEGaussianBlur.cpp */, 84801953108BAFB300CB2B1F /* FEGaussianBlur.h */, + 84730D631248F0B300D3A9C9 /* FELighting.cpp */, + 84730D641248F0B300D3A9C9 /* FELighting.h */, + 84730D651248F0B300D3A9C9 /* FEMerge.cpp */, + 84730D661248F0B300D3A9C9 /* FEMerge.h */, + 84730D671248F0B300D3A9C9 /* FEMorphology.cpp */, + 84730D681248F0B300D3A9C9 /* FEMorphology.h */, + 84730D691248F0B300D3A9C9 /* FEOffset.cpp */, + 84730D6A1248F0B300D3A9C9 /* FEOffset.h */, + 84730D6B1248F0B300D3A9C9 /* FESpecularLighting.cpp */, + 84730D6C1248F0B300D3A9C9 /* FESpecularLighting.h */, + 84730D6D1248F0B300D3A9C9 /* FETile.cpp */, + 84730D6E1248F0B300D3A9C9 /* FETile.h */, + 84730D6F1248F0B300D3A9C9 /* FETurbulence.cpp */, + 84730D701248F0B300D3A9C9 /* FETurbulence.h */, 845E72F70FD261EE00A87D79 /* Filter.h */, 08C925170FCC7C4A00480DEC /* FilterEffect.cpp */, 08C925180FCC7C4A00480DEC /* FilterEffect.h */, + 84730D731248F0B300D3A9C9 /* LightSource.cpp */, + 84730D741248F0B300D3A9C9 /* LightSource.h */, + 84730D751248F0B300D3A9C9 /* PointLightSource.h */, 84A81F3B0FC7DFF000955300 /* SourceAlpha.cpp */, 84A81F3C0FC7DFF000955300 /* SourceAlpha.h */, 84A81F3F0FC7E02700955300 /* SourceGraphic.cpp */, 84A81F400FC7E02700955300 /* SourceGraphic.h */, + 84730D761248F0B300D3A9C9 /* SpotLightSource.h */, ); name = filters; sourceTree = "<group>"; @@ -14607,6 +14818,8 @@ BC77D1680FF19F550070887B /* JSDataGridColumnList.h */, 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */, 2E0888D31148848A00AF4265 /* JSDOMFormData.h */, + 7694563A1214D97C0007CBAE /* JSDOMTokenList.cpp */, + 7694563B1214D97C0007CBAE /* JSDOMTokenList.h */, 49EECEF4105070C400099FAB /* JSFloat32Array.cpp */, 49EECEF5105070C400099FAB /* JSFloat32Array.h */, BC97E410109154FA0010D361 /* JSHTMLAllCollection.cpp */, @@ -15857,39 +16070,12 @@ B255989C0D00D8B800BB825C /* filters */ = { isa = PBXGroup; children = ( - B25598D70D00D8B900BB825C /* SVGDistantLightSource.h */, - B25598E00D00D8B900BB825C /* SVGFEConvolveMatrix.cpp */, - B25598E10D00D8B900BB825C /* SVGFEConvolveMatrix.h */, - B25598E20D00D8B900BB825C /* SVGFEDiffuseLighting.cpp */, - B25598E30D00D8B900BB825C /* SVGFEDiffuseLighting.h */, - B25598E40D00D8B900BB825C /* SVGFEDisplacementMap.cpp */, - B25598E50D00D8B900BB825C /* SVGFEDisplacementMap.h */, - B25598E60D00D8B900BB825C /* SVGFEFlood.cpp */, - B25598E70D00D8B900BB825C /* SVGFEFlood.h */, B25598EA0D00D8B900BB825C /* SVGFEImage.cpp */, B25598EB0D00D8B900BB825C /* SVGFEImage.h */, - E440A2D41191A50B000820B0 /* SVGFELighting.cpp */, - E440A2D61191A523000820B0 /* SVGFELighting.h */, - B25598EC0D00D8B900BB825C /* SVGFEMerge.cpp */, - B25598ED0D00D8B900BB825C /* SVGFEMerge.h */, - B25598EE0D00D8B900BB825C /* SVGFEMorphology.cpp */, - B25598EF0D00D8B900BB825C /* SVGFEMorphology.h */, - B25598F00D00D8B900BB825C /* SVGFEOffset.cpp */, - B25598F10D00D8B900BB825C /* SVGFEOffset.h */, - B25598F20D00D8B900BB825C /* SVGFESpecularLighting.cpp */, - B25598F30D00D8B900BB825C /* SVGFESpecularLighting.h */, - A7D27FC30E0A599F0079AD2B /* SVGFETile.cpp */, - B25598F40D00D8B900BB825C /* SVGFETile.h */, - B25598F50D00D8B900BB825C /* SVGFETurbulence.cpp */, - B25598F60D00D8B900BB825C /* SVGFETurbulence.h */, 845E72F90FD2623900A87D79 /* SVGFilter.cpp */, 845E72FA0FD2623900A87D79 /* SVGFilter.h */, 081EBF380FD34F4100DA7559 /* SVGFilterBuilder.cpp */, 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */, - B25598F90D00D8B900BB825C /* SVGLightSource.cpp */, - B25598FA0D00D8B900BB825C /* SVGLightSource.h */, - B25598FB0D00D8B900BB825C /* SVGPointLightSource.h */, - B25598FC0D00D8B900BB825C /* SVGSpotLightSource.h */, ); path = filters; sourceTree = "<group>"; @@ -17618,8 +17804,8 @@ 93831B560D087D6000E5C984 /* ExceptionCode.cpp */, 935FBCF109BA143B00E230B1 /* ExceptionCode.h */, A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */, - 8482B7441198C32E00BFB005 /* HashChangeEvent.idl */, 2442BBF81194C9D300D49469 /* HashChangeEvent.h */, + 8482B7441198C32E00BFB005 /* HashChangeEvent.idl */, 08700BE60F086C5300919419 /* InputElement.cpp */, 08591AA40F085C4E009BACB1 /* InputElement.h */, 85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */, @@ -17876,6 +18062,7 @@ 89D08DA012228451001241DF /* AsyncFileSystem.h in Headers */, 89D08DA112228451001241DF /* AsyncFileSystemCallbacks.h in Headers */, 976D6C77122B8A3D001FD1F7 /* AsyncFileWriter.h in Headers */, + 976D6C93122B8A3D001FD1F7 /* AsyncFileWriterClient.h in Headers */, B0149E7E11A4B21500196A7B /* AsyncImageResizer.h in Headers */, 8A413AE01207BBA50082016E /* AsyncScriptRunner.h in Headers */, 37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */, @@ -17894,6 +18081,7 @@ BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */, BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */, B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */, + F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */, BC9462D8107A7B4C00857193 /* BeforeLoadEvent.h in Headers */, 51721FBB11D2790700638B42 /* BeforeProcessEvent.h in Headers */, AB23A32809BBA7D00067CC53 /* BeforeTextInsertedEvent.h in Headers */, @@ -17921,6 +18109,7 @@ 93309DDB099E64920056E581 /* BreakBlockquoteCommand.h in Headers */, 599E759011055A1F00D904FA /* Bridge.h in Headers */, 59B5977511086579007159E8 /* BridgeJSC.h in Headers */, + F55B3DB01251F12D003EF269 /* ButtonInputType.h in Headers */, 1A569CF80D7E2B82007C3983 /* c_class.h in Headers */, 1A569CFA0D7E2B82007C3983 /* c_instance.h in Headers */, 1A569CFC0D7E2B82007C3983 /* c_runtime.h in Headers */, @@ -17953,6 +18142,7 @@ 6550B6A0099DF0270090D781 /* CharacterData.h in Headers */, B2C3DA260D006C1D00EF6F26 /* CharacterNames.h in Headers */, B2C3DA2A0D006C1D00EF6F26 /* CharsetData.h in Headers */, + F55B3DB21251F12D003EF269 /* CheckboxInputType.h in Headers */, A00B721A11DE6428008AB9FF /* CheckedInt.h in Headers */, 93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */, A81872200977D3C0005826D9 /* ChildNodeList.h in Headers */, @@ -17971,6 +18161,7 @@ 93C442000F813AE100C1A634 /* CollectionType.h in Headers */, B27535670B053814002CE64F /* Color.h in Headers */, B22279630D00BF220071B782 /* ColorDistance.h in Headers */, + F55B3DB41251F12D003EF269 /* ColorInputType.h in Headers */, EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */, 9382DF5810A8D5C900925652 /* ColorSpace.h in Headers */, BCDD454E1236C95C009A7985 /* ColumnInfo.h in Headers */, @@ -18082,6 +18273,9 @@ BC22746F0E83664500E7F975 /* DataRef.h in Headers */, BC64641C11D7F416006455B0 /* DatasetDOMStringMap.h in Headers */, F5D3A57D106B83B300545297 /* DateComponents.h in Headers */, + F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */, + F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */, + F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */, A8C228A111D5722E00D5A7D3 /* DecodedDataDocumentParser.h in Headers */, 4162A451101145AE00DFF3ED /* DedicatedWorkerContext.h in Headers */, 41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */, @@ -18103,6 +18297,7 @@ 59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */, 89878553122CA064003AABDA /* DirectoryEntry.h in Headers */, 89878555122CA064003AABDA /* DirectoryReader.h in Headers */, + 84730D771248F0B300D3A9C9 /* DistantLightSource.h in Headers */, B2F34FE60E82F81400F627CD /* DNS.h in Headers */, A8185F4009765766005826D9 /* Document.h in Headers */, A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */, @@ -18176,6 +18371,7 @@ 85E711960AC5D5350053270F /* DOMDocumentTypeInternal.h in Headers */, 8518DCE90A9CC80D0091B7A6 /* DOMDOMImplementation.h in Headers */, 85E711970AC5D5350053270F /* DOMDOMImplementationInternal.h in Headers */, + 7694565B1214DB630007CBAE /* DOMDOMTokenList.h in Headers */, 85ACA9C00A9B5FA500671E90 /* DOMElement.h in Headers */, 85E711980AC5D5350053270F /* DOMElementInternal.h in Headers */, E415F1690D9A165D0033CE97 /* DOMElementTimeControl.h in Headers */, @@ -18837,6 +19033,7 @@ DDE63ED50B7D45A800226998 /* DOMTextEvent.h in Headers */, 85E711D90AC5D5350053270F /* DOMTextInternal.h in Headers */, 188604B40F2E654A000B6443 /* DOMTimer.h in Headers */, + 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */, BC1A37BE097C715F0019F3D8 /* DOMTraversal.h in Headers */, 85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */, 850B41C30AD9E7E700A6ED4F /* DOMTreeWalkerInternal.h in Headers */, @@ -18886,6 +19083,7 @@ 63F5D4F70E8C4B7100C0BD04 /* ElementRareData.h in Headers */, E415F1840D9A1A830033CE97 /* ElementTimeControl.h in Headers */, A8CFF6BE0A156118000A4234 /* EllipsisBox.h in Headers */, + F55B3DBC1251F12D003EF269 /* EmailInputType.h in Headers */, B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */, 5DC87EF011716DF2001C0E6D /* EmptyProtocolDefinitions.h in Headers */, A8EA7EC20A1945D000A8EF5F /* Entity.h in Headers */, @@ -18911,13 +19109,25 @@ A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */, A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */, A75E8B8F0E1DE2D6007F2481 /* FEComposite.h in Headers */, + 84730D791248F0B300D3A9C9 /* FEConvolveMatrix.h in Headers */, + 84730D7B1248F0B300D3A9C9 /* FEDiffuseLighting.h in Headers */, + 84730D7D1248F0B300D3A9C9 /* FEDisplacementMap.h in Headers */, + 84730D7F1248F0B300D3A9C9 /* FEFlood.h in Headers */, 84801955108BAFB300CB2B1F /* FEGaussianBlur.h in Headers */, + 84730D811248F0B300D3A9C9 /* FELighting.h in Headers */, + 84730D831248F0B300D3A9C9 /* FEMerge.h in Headers */, + 84730D851248F0B300D3A9C9 /* FEMorphology.h in Headers */, + 84730D871248F0B300D3A9C9 /* FEOffset.h in Headers */, + 84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */, + 84730D8B1248F0B300D3A9C9 /* FETile.h in Headers */, + 84730D8D1248F0B300D3A9C9 /* FETurbulence.h in Headers */, 976D6C81122B8A3D001FD1F7 /* File.h in Headers */, 893C47A71238908B002B3D86 /* FileCallback.h in Headers */, 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */, 89878562122CA064003AABDA /* FileEntry.h in Headers */, 976D6C83122B8A3D001FD1F7 /* FileError.h in Headers */, 2EDF369F122C94C8002F7D4E /* FileException.h in Headers */, + F55B3DBE1251F12D003EF269 /* FileInputType.h in Headers */, 976D6C86122B8A3D001FD1F7 /* FileList.h in Headers */, 976D6C89122B8A3D001FD1F7 /* FileReader.h in Headers */, 2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */, @@ -18931,7 +19141,6 @@ 976D6C8F122B8A3D001FD1F7 /* FileThreadTask.h in Headers */, 976D6C91122B8A3D001FD1F7 /* FileWriter.h in Headers */, 893C47A81238908B002B3D86 /* FileWriterCallback.h in Headers */, - 976D6C93122B8A3D001FD1F7 /* FileWriterClient.h in Headers */, BC5EB69F0E81DAEB00B25965 /* FillLayer.h in Headers */, 845E72F80FD261EE00A87D79 /* Filter.h in Headers */, 08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */, @@ -19010,6 +19219,7 @@ C50B561712119D23008B46E0 /* GroupSettings.h in Headers */, 7693BAD2106C2DCA007B0823 /* HaltablePlugin.h in Headers */, 8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */, + F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */, BC94D1540C275C8B006BC617 /* History.h in Headers */, 97DCE20210807C750057D394 /* HistoryController.h in Headers */, 51741D110B07259A00ED442C /* HistoryItem.h in Headers */, @@ -19169,6 +19379,7 @@ BCA979171215D055005C485C /* ImageBufferData.h in Headers */, A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */, 97205AB61239291000B17380 /* ImageDocument.h in Headers */, + F55B3DC21251F12D003EF269 /* ImageInputType.h in Headers */, 089582560E857A7E00F82C83 /* ImageLoader.h in Headers */, BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */, B0149E8011A4B21500196A7B /* ImageResizerThread.h in Headers */, @@ -19183,6 +19394,7 @@ BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */, BCEA485A097D93020094C9E4 /* InlineTextBox.h in Headers */, 08591AA50F085C4E009BACB1 /* InputElement.h in Headers */, + 37E3524D12450C6600BAF5D9 /* InputType.h in Headers */, 93309DEA099E64920056E581 /* InsertIntoTextNodeCommand.h in Headers */, 93309DEC099E64920056E581 /* InsertLineBreakCommand.h in Headers */, D07DEABA0A36554A00CA30F8 /* InsertListCommand.h in Headers */, @@ -19217,6 +19429,7 @@ B27535740B053814002CE64F /* IntRect.h in Headers */, B27535750B053814002CE64F /* IntSize.h in Headers */, B27535760B053814002CE64F /* IntSizeHash.h in Headers */, + F55B3DC41251F12D003EF269 /* IsIndexInputType.h in Headers */, 59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */, 59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */, E16982681134680700894115 /* JavaRuntimeObject.h in Headers */, @@ -19306,6 +19519,7 @@ BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */, C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */, BC64649811D82349006455B0 /* JSDOMStringMap.h in Headers */, + 7694563D1214D97C0007CBAE /* JSDOMTokenList.h in Headers */, BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */, 652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */, BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */, @@ -19698,6 +19912,7 @@ BCE65BEB0EACDF16007E4533 /* Length.h in Headers */, BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */, BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */, + 84730D911248F0B300D3A9C9 /* LightSource.h in Headers */, B22279650D00BF220071B782 /* LinearGradientAttributes.h in Headers */, AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */, 89B5EAA211E8003D00F2367E /* LineEnding.h in Headers */, @@ -19744,6 +19959,7 @@ 8987856A122CA064003AABDA /* MetadataCallback.h in Headers */, BC772C4F0C4EB3040083285F /* MIMETypeRegistry.h in Headers */, C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */, + F55B3DC61251F12D003EF269 /* MonthInputType.h in Headers */, 85031B460A44EFC700F992E0 /* MouseEvent.h in Headers */, 935C476309AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h in Headers */, 85031B480A44EFC700F992E0 /* MouseRelatedEvent.h in Headers */, @@ -19781,6 +19997,7 @@ 1A569D100D7E2B82007C3983 /* npruntime_internal.h in Headers */, 1A569D110D7E2B82007C3983 /* npruntime_priv.h in Headers */, 1A27CF97118A354C0041D632 /* nptypes.h in Headers */, + F55B3DC81251F12D003EF269 /* NumberInputType.h in Headers */, 1A569D120D7E2B82007C3983 /* objc_class.h in Headers */, 1A569D140D7E2B82007C3983 /* objc_header.h in Headers */, 1A569D150D7E2B82007C3983 /* objc_instance.h in Headers */, @@ -19808,6 +20025,7 @@ 0885068011DA045B00182B98 /* PaintPhase.h in Headers */, A80E6CFB0A1989CA007FB8C5 /* Pair.h in Headers */, BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */, + F55B3DCA1251F12D003EF269 /* PasswordInputType.h in Headers */, 4B2708C70AF19EE40065127F /* Pasteboard.h in Headers */, A7D3C5240B576B4B002CA450 /* PasteboardHelper.h in Headers */, B27535800B053814002CE64F /* Path.h in Headers */, @@ -19837,6 +20055,7 @@ 1AA8799011CBE846003C664F /* PluginStrategy.h in Headers */, 0AFDAC3D10F5448C00E1F3D2 /* PluginViewBase.h in Headers */, B2B1F7170D00CAA8004AEA64 /* PointerEventsHitRules.h in Headers */, + 84730D921248F0B300D3A9C9 /* PointLightSource.h in Headers */, 97059978107D975200A50A7C /* PolicyCallback.h in Headers */, 9705997A107D975200A50A7C /* PolicyChecker.h in Headers */, 5174E20A10A1F44F00F95E6F /* PopStateEvent.h in Headers */, @@ -19859,9 +20078,11 @@ E4D687790ED7AE4F006EA978 /* PurgeableBuffer.h in Headers */, 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */, B22279720D00BF220071B782 /* RadialGradientAttributes.h in Headers */, + F55B3DCC1251F12D003EF269 /* RadioInputType.h in Headers */, 93F1991808245E59001E9ABC /* Range.h in Headers */, 93D9D53C0DA27E180077216C /* RangeBoundaryPoint.h in Headers */, D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */, + F55B3DCE1251F12D003EF269 /* RangeInputType.h in Headers */, A84D827C11D333ED00972990 /* RawDataDocumentParser.h in Headers */, BC4368E80C226E32005EFB5F /* Rect.h in Headers */, 979F43D41075E44A0000F83B /* RedirectScheduler.h in Headers */, @@ -19983,6 +20204,7 @@ A89CCC530F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h in Headers */, 93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */, BCB16C2F0979C3BD00467741 /* Request.h in Headers */, + F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */, 934F71420D5A6F4400018D69 /* ResourceError.h in Headers */, 934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */, 514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */, @@ -20045,6 +20267,7 @@ 5D925B680F64D4DD00B847F0 /* ScrollBehavior.h in Headers */, 93C09C860B0657AA005ABD4D /* ScrollTypes.h in Headers */, BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */, + F55B3DD21251F12D003EF269 /* SearchInputType.h in Headers */, AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */, D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */, 33C0CCD5112C5E6200CE057D /* SecureTextInput.h in Headers */, @@ -20092,6 +20315,7 @@ 93309E12099E64920056E581 /* SplitElementCommand.h in Headers */, 93309E14099E64920056E581 /* SplitTextNodeCommand.h in Headers */, 93309E16099E64920056E581 /* SplitTextNodeContainingElementCommand.h in Headers */, + 84730D931248F0B300D3A9C9 /* SpotLightSource.h in Headers */, 51EC92590CE90DB400F90308 /* SQLError.h in Headers */, B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */, 1A22464A0CC98DDB00C05240 /* SQLiteDatabase.h in Headers */, @@ -20154,6 +20378,7 @@ BC5EB8100E81F2CE00B25965 /* StyleTransformData.h in Headers */, BC5EB69A0E81DA6300B25965 /* StyleVisualData.h in Headers */, D000ED2811C1B9CD00C47726 /* SubframeLoader.h in Headers */, + F55B3DD41251F12D003EF269 /* SubmitInputType.h in Headers */, 656D37480ADBA5DE00A4554D /* SubresourceLoader.h in Headers */, 1A3178930B20A81600316987 /* SubresourceLoaderClient.h in Headers */, 659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */, @@ -20184,7 +20409,6 @@ B22279A80D00BF220071B782 /* SVGCursorElement.h in Headers */, B22279AE0D00BF220071B782 /* SVGDefsElement.h in Headers */, B22279B10D00BF220071B782 /* SVGDescElement.h in Headers */, - B25599710D00D8BA00BB825C /* SVGDistantLightSource.h in Headers */, B22279B40D00BF220071B782 /* SVGDocument.h in Headers */, B28C6A280D00C44800334AA4 /* SVGDocumentExtensions.h in Headers */, B22279B70D00BF220071B782 /* SVGElement.h in Headers */, @@ -20199,14 +20423,10 @@ B22279CB0D00BF220071B782 /* SVGFEColorMatrixElement.h in Headers */, B22279CE0D00BF220071B782 /* SVGFEComponentTransferElement.h in Headers */, B22279D10D00BF220071B782 /* SVGFECompositeElement.h in Headers */, - B255997B0D00D8BA00BB825C /* SVGFEConvolveMatrix.h in Headers */, 1921327511C0E6BB00456238 /* SVGFEConvolveMatrixElement.h in Headers */, - B255997D0D00D8BA00BB825C /* SVGFEDiffuseLighting.h in Headers */, B22279D40D00BF220071B782 /* SVGFEDiffuseLightingElement.h in Headers */, - B255997F0D00D8BA00BB825C /* SVGFEDisplacementMap.h in Headers */, B22279D70D00BF220071B782 /* SVGFEDisplacementMapElement.h in Headers */, B22279DA0D00BF220071B782 /* SVGFEDistantLightElement.h in Headers */, - B25599810D00D8BA00BB825C /* SVGFEFlood.h in Headers */, B22279DD0D00BF220071B782 /* SVGFEFloodElement.h in Headers */, B22279E00D00BF220071B782 /* SVGFEFuncAElement.h in Headers */, B22279E30D00BF220071B782 /* SVGFEFuncBElement.h in Headers */, @@ -20216,21 +20436,14 @@ B25599850D00D8BA00BB825C /* SVGFEImage.h in Headers */, B22279EF0D00BF220071B782 /* SVGFEImageElement.h in Headers */, B22279F20D00BF220071B782 /* SVGFELightElement.h in Headers */, - E440A2D71191A523000820B0 /* SVGFELighting.h in Headers */, - B25599870D00D8BA00BB825C /* SVGFEMerge.h in Headers */, B22279F40D00BF220071B782 /* SVGFEMergeElement.h in Headers */, B22279F70D00BF220071B782 /* SVGFEMergeNodeElement.h in Headers */, - B25599890D00D8BA00BB825C /* SVGFEMorphology.h in Headers */, 84224194107E78A700766A87 /* SVGFEMorphologyElement.h in Headers */, - B255998B0D00D8BA00BB825C /* SVGFEOffset.h in Headers */, B22279FA0D00BF220071B782 /* SVGFEOffsetElement.h in Headers */, B22279FD0D00BF220071B782 /* SVGFEPointLightElement.h in Headers */, - B255998D0D00D8BA00BB825C /* SVGFESpecularLighting.h in Headers */, B2227A000D00BF220071B782 /* SVGFESpecularLightingElement.h in Headers */, B2227A030D00BF220071B782 /* SVGFESpotLightElement.h in Headers */, - B255998E0D00D8BA00BB825C /* SVGFETile.h in Headers */, B2227A060D00BF220071B782 /* SVGFETileElement.h in Headers */, - B25599900D00D8BA00BB825C /* SVGFETurbulence.h in Headers */, B2227A090D00BF220071B782 /* SVGFETurbulenceElement.h in Headers */, 845E72FC0FD2623900A87D79 /* SVGFilter.h in Headers */, 081EBF3B0FD34F4100DA7559 /* SVGFilterBuilder.h in Headers */, @@ -20259,7 +20472,6 @@ B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */, B2227A330D00BF220071B782 /* SVGLength.h in Headers */, B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */, - B25599940D00D8BA00BB825C /* SVGLightSource.h in Headers */, B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */, B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */, B2227A3E0D00BF220071B782 /* SVGList.h in Headers */, @@ -20303,7 +20515,6 @@ 84300BD6120C9AAC0021954A /* SVGPathStringSource.h in Headers */, 84C5B2FB1216DC810088B53A /* SVGPathTraversalStateBuilder.h in Headers */, B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */, - B25599950D00D8BA00BB825C /* SVGPointLightSource.h in Headers */, B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */, B2227A8F0D00BF220071B782 /* SVGPolyElement.h in Headers */, B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */, @@ -20324,7 +20535,6 @@ B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */, 08DAB9C31103D9C1003E7ABA /* SVGShadowTreeElements.h in Headers */, E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */, - B25599960D00D8BA00BB825C /* SVGSpotLightSource.h in Headers */, B2227AA90D00BF220071B782 /* SVGStopElement.h in Headers */, B2227AAC0D00BF220071B782 /* SVGStringList.h in Headers */, B2227AAF0D00BF220071B782 /* SVGStylable.h in Headers */, @@ -20363,6 +20573,7 @@ 93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */, A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */, BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */, + F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */, 6550B6A6099DF0270090D781 /* Text.h in Headers */, 93309E17099E64920056E581 /* TextAffinity.h in Headers */, B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */, @@ -20382,7 +20593,9 @@ C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */, B2C3DA490D006C1D00EF6F26 /* TextEncodingRegistry.h in Headers */, 933A14300B7D188600A53FFD /* TextEvent.h in Headers */, + F55B3DD81251F12D003EF269 /* TextFieldInputType.h in Headers */, 93309E18099E64920056E581 /* TextGranularity.h in Headers */, + F55B3DDA1251F12D003EF269 /* TextInputType.h in Headers */, 93309E1C099E64920056E581 /* TextIterator.h in Headers */, BCEF45E90E687767001C1287 /* TextMetrics.h in Headers */, 930FC68A1072B9280045293E /* TextRenderingMode.h in Headers */, @@ -20401,6 +20614,7 @@ 51DF6D7E0B92A16D00C2DC85 /* ThreadCheck.h in Headers */, E1FF57A30F01255B00891EBB /* ThreadGlobalData.h in Headers */, 185BCF290F3279CE000EA262 /* ThreadTimers.h in Headers */, + F55B3DDC1251F12D003EF269 /* TimeInputType.h in Headers */, 7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */, 9305B24D098F1B6B00C28855 /* Timer.h in Headers */, E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */, @@ -20427,6 +20641,7 @@ B2C3DA4D0D006C1D00EF6F26 /* UnicodeRange.h in Headers */, E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */, D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */, + F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */, 656581B209D14EE6000E61D7 /* UserAgentStyleSheets.h in Headers */, 003F1FEA11E6AB43008258D9 /* UserContentTypes.h in Headers */, BCACF3BD1072921A00C0C8A3 /* UserContentURLPattern.h in Headers */, @@ -20487,6 +20702,7 @@ 7637C543112E7B7E003D6CDC /* WebSocketHandshakeRequest.h in Headers */, 767F99C011A119560080C51D /* WebSocketHandshakeResponse.h in Headers */, 0FCF332D0F2B9A25004B6795 /* WebTiledLayer.h in Headers */, + F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */, 85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */, 9380F47409A11AB4001FDB34 /* Widget.h in Headers */, 939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */, @@ -20879,6 +21095,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 1ABA76C911D20E47004C201C /* ColorData.cpp in Sources */, + 1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */, + 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */, + 1ABA76CC11D20E5B004C201C /* DocTypeStrings.cpp in Sources */, B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */, 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */, 29A812280FBB9C1D00510293 /* AccessibilityARIAGrid.cpp in Sources */, @@ -20940,6 +21160,7 @@ BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */, BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */, B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */, + F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */, 5172204B11D2960500638B42 /* BeforeProcessEvent.cpp in Sources */, AB23A32709BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp in Sources */, 85031B3C0A44EFC700F992E0 /* BeforeUnloadEvent.cpp in Sources */, @@ -20958,6 +21179,7 @@ BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */, 93309DDA099E64920056E581 /* BreakBlockquoteCommand.cpp in Sources */, 59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */, + F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */, 1A569CF70D7E2B82007C3983 /* c_class.cpp in Sources */, 1A569CF90D7E2B82007C3983 /* c_instance.cpp in Sources */, 1A569CFB0D7E2B82007C3983 /* c_runtime.cpp in Sources */, @@ -20985,6 +21207,7 @@ 514185EF0CD65F0400763C99 /* ChangeVersionWrapper.cpp in Sources */, 6550B69F099DF0270090D781 /* CharacterData.cpp in Sources */, 9326DC0C09DAD5D600AFC847 /* CharsetData.cpp in Sources */, + F55B3DB11251F12D003EF269 /* CheckboxInputType.cpp in Sources */, 93F925440F7EF5B8007E37C9 /* CheckedRadioButtons.cpp in Sources */, A81872250977D3C0005826D9 /* ChildNodeList.cpp in Sources */, 14D8238B0AF92DF60004F057 /* Chrome.cpp in Sources */, @@ -20999,6 +21222,7 @@ B27535660B053814002CE64F /* Color.cpp in Sources */, 0FCF33240F2B9715004B6795 /* ColorCG.cpp in Sources */, B22279620D00BF220071B782 /* ColorDistance.cpp in Sources */, + F55B3DB31251F12D003EF269 /* ColorInputType.cpp in Sources */, B27535770B053814002CE64F /* ColorMac.mm in Sources */, 6550B6A1099DF0270090D781 /* Comment.cpp in Sources */, 37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */, @@ -21087,6 +21311,9 @@ BC77D1FD0FF28D9B0070887B /* DataGridColumnList.cpp in Sources */, BC64641D11D7F416006455B0 /* DatasetDOMStringMap.cpp in Sources */, F5D3A57C106B83B300545297 /* DateComponents.cpp in Sources */, + F55B3DB51251F12D003EF269 /* DateInputType.cpp in Sources */, + F55B3DB71251F12D003EF269 /* DateTimeInputType.cpp in Sources */, + F55B3DB91251F12D003EF269 /* DateTimeLocalInputType.cpp in Sources */, A8C228A211D5722E00D5A7D3 /* DecodedDataDocumentParser.cpp in Sources */, 4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */, 41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */, @@ -21148,6 +21375,7 @@ 85089CDC0A98C42800A275AA /* DOMDocumentFragment.mm in Sources */, 85CA975D0A962E5400690CCF /* DOMDocumentType.mm in Sources */, 8518DCEA0A9CC80D0091B7A6 /* DOMDOMImplementation.mm in Sources */, + 7694565C1214DB630007CBAE /* DOMDOMTokenList.mm in Sources */, 85ACA9C10A9B5FA500671E90 /* DOMElement.mm in Sources */, 85CA96B90A9621A600690CCF /* DOMEntity.mm in Sources */, 85089CDE0A98C42800A275AA /* DOMEntityReference.mm in Sources */, @@ -21393,6 +21621,7 @@ 85ACA99D0A9B575900671E90 /* DOMText.mm in Sources */, 933A14AA0B7D1D0900A53FFD /* DOMTextEvent.mm in Sources */, 188604B30F2E654A000B6443 /* DOMTimer.cpp in Sources */, + 76FC2B0B12370DA0006A991A /* DOMTokenList.cpp in Sources */, 85526CD30AB0B7DA000302EA /* DOMTreeWalker.mm in Sources */, 85C7F4920AAF79DC004014DD /* DOMUIEvent.mm in Sources */, BC1A37BF097C715F0019F3D8 /* DOMUtility.mm in Sources */, @@ -21423,6 +21652,7 @@ ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */, A8C4A80809D563270003AC8D /* Element.cpp in Sources */, A8CFF6CB0A1561CD000A4234 /* EllipsisBox.cpp in Sources */, + F55B3DBB1251F12D003EF269 /* EmailInputType.cpp in Sources */, A8EA7EC30A1945D000A8EF5F /* Entity.cpp in Sources */, A8EA7EC10A1945D000A8EF5F /* EntityReference.cpp in Sources */, 8987855B122CA064003AABDA /* Entry.cpp in Sources */, @@ -21442,11 +21672,23 @@ A75E8B8A0E1DE2D6007F2481 /* FEColorMatrix.cpp in Sources */, A75E8B8C0E1DE2D6007F2481 /* FEComponentTransfer.cpp in Sources */, A75E8B8E0E1DE2D6007F2481 /* FEComposite.cpp in Sources */, + 84730D781248F0B300D3A9C9 /* FEConvolveMatrix.cpp in Sources */, + 84730D7A1248F0B300D3A9C9 /* FEDiffuseLighting.cpp in Sources */, + 84730D7C1248F0B300D3A9C9 /* FEDisplacementMap.cpp in Sources */, + 84730D7E1248F0B300D3A9C9 /* FEFlood.cpp in Sources */, 84801954108BAFB300CB2B1F /* FEGaussianBlur.cpp in Sources */, + 84730D801248F0B300D3A9C9 /* FELighting.cpp in Sources */, + 84730D821248F0B300D3A9C9 /* FEMerge.cpp in Sources */, + 84730D841248F0B300D3A9C9 /* FEMorphology.cpp in Sources */, + 84730D861248F0B300D3A9C9 /* FEOffset.cpp in Sources */, + 84730D881248F0B300D3A9C9 /* FESpecularLighting.cpp in Sources */, + 84730D8A1248F0B300D3A9C9 /* FETile.cpp in Sources */, + 84730D8C1248F0B300D3A9C9 /* FETurbulence.cpp in Sources */, 976D6C80122B8A3D001FD1F7 /* File.cpp in Sources */, 934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */, 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */, 89878561122CA064003AABDA /* FileEntry.cpp in Sources */, + F55B3DBD1251F12D003EF269 /* FileInputType.cpp in Sources */, 976D6C85122B8A3D001FD1F7 /* FileList.cpp in Sources */, 976D6C88122B8A3D001FD1F7 /* FileReader.cpp in Sources */, 2EDF369C122C94B4002F7D4E /* FileReaderSync.cpp in Sources */, @@ -21525,6 +21767,7 @@ 0F580B050F12A2550051D689 /* GraphicsLayerCA.mm in Sources */, B2A015AA0AF6CD53006BCE0E /* GraphicsTypes.cpp in Sources */, C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */, + F55B3DBF1251F12D003EF269 /* HiddenInputType.cpp in Sources */, BC94D1530C275C8B006BC617 /* History.cpp in Sources */, 97DCE20110807C750057D394 /* HistoryController.cpp in Sources */, 51741D120B07259A00ED442C /* HistoryItem.cpp in Sources */, @@ -21671,6 +21914,7 @@ B275355E0B053814002CE64F /* ImageCG.cpp in Sources */, A77979190D6B9D0C003851B9 /* ImageData.cpp in Sources */, 97205AB51239291000B17380 /* ImageDocument.cpp in Sources */, + F55B3DC11251F12D003EF269 /* ImageInputType.cpp in Sources */, 089582550E857A7E00F82C83 /* ImageLoader.cpp in Sources */, B275357B0B053814002CE64F /* ImageMac.mm in Sources */, B0149E7F11A4B21500196A7B /* ImageResizerThread.cpp in Sources */, @@ -21684,6 +21928,7 @@ A8CFF5E40A155A05000A4234 /* InlineFlowBox.cpp in Sources */, BCEA4859097D93020094C9E4 /* InlineTextBox.cpp in Sources */, 08700BE70F086C5300919419 /* InputElement.cpp in Sources */, + 37E3524B12450C5200BAF5D9 /* InputType.cpp in Sources */, 93309DE9099E64920056E581 /* InsertIntoTextNodeCommand.cpp in Sources */, 93309DEB099E64920056E581 /* InsertLineBreakCommand.cpp in Sources */, D07DEAB90A36554A00CA30F8 /* InsertListCommand.cpp in Sources */, @@ -21717,6 +21962,7 @@ B275357D0B053814002CE64F /* IntRectMac.mm in Sources */, B27535620B053814002CE64F /* IntSizeCG.cpp in Sources */, B275357E0B053814002CE64F /* IntSizeMac.mm in Sources */, + F55B3DC31251F12D003EF269 /* IsIndexInputType.cpp in Sources */, 59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */, 59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */, E1698264113467F300894115 /* JavaRuntimeObject.cpp in Sources */, @@ -21831,6 +22077,7 @@ C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */, BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */, BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */, + 7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */, 1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */, BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */, BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */, @@ -22291,6 +22538,7 @@ 512DD8F40D91E6AF000F89EE /* LegacyWebArchive.cpp in Sources */, 51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */, BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */, + 84730D901248F0B300D3A9C9 /* LightSource.cpp in Sources */, 89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */, A7AD2F870EC89D07008AB002 /* LinkHash.cpp in Sources */, BCB16C2C0979C3BD00467741 /* loader.cpp in Sources */, @@ -22332,6 +22580,7 @@ BC772C4E0C4EB3040083285F /* MIMETypeRegistry.cpp in Sources */, BC772C5E0C4EB3440083285F /* MIMETypeRegistryMac.mm in Sources */, C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */, + F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */, 85031B450A44EFC700F992E0 /* MouseEvent.cpp in Sources */, 93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */, 85031B470A44EFC700F992E0 /* MouseRelatedEvent.cpp in Sources */, @@ -22357,6 +22606,7 @@ 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */, 1A569D0A0D7E2B82007C3983 /* NP_jsobject.cpp in Sources */, 1A569D0D0D7E2B82007C3983 /* npruntime.cpp in Sources */, + F55B3DC71251F12D003EF269 /* NumberInputType.cpp in Sources */, 1A569D130D7E2B82007C3983 /* objc_class.mm in Sources */, 1A569D160D7E2B82007C3983 /* objc_instance.mm in Sources */, 1A569D180D7E2B82007C3983 /* objc_runtime.mm in Sources */, @@ -22378,6 +22628,7 @@ 1C26497C0D7E24EC00BD10F2 /* PageMac.cpp in Sources */, E1284AEA10447DEE00EAEB52 /* PageTransitionEvent.cpp in Sources */, 51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */, + F55B3DC91251F12D003EF269 /* PasswordInputType.cpp in Sources */, 4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */, B275357F0B053814002CE64F /* Path.cpp in Sources */, B27535630B053814002CE64F /* PathCG.cpp in Sources */, @@ -22414,7 +22665,9 @@ 514C76740CE923A1007EF3CD /* ProtectionSpace.cpp in Sources */, E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */, 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */, + F55B3DCB1251F12D003EF269 /* RadioInputType.cpp in Sources */, 93F19AB908245E59001E9ABC /* Range.cpp in Sources */, + F55B3DCD1251F12D003EF269 /* RangeInputType.cpp in Sources */, 979F43D31075E44A0000F83B /* RedirectScheduler.cpp in Sources */, 85031B4B0A44EFC700F992E0 /* RegisteredEventListener.cpp in Sources */, B2C3DA2C0D006C1D00EF6F26 /* RegularExpression.cpp in Sources */, @@ -22532,6 +22785,7 @@ A89CCC520F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.cpp in Sources */, 93309E09099E64920056E581 /* ReplaceSelectionCommand.cpp in Sources */, BCB16C2E0979C3BD00467741 /* Request.cpp in Sources */, + F55B3DCF1251F12D003EF269 /* ResetInputType.cpp in Sources */, 934F713E0D5A6F2800018D69 /* ResourceErrorBase.cpp in Sources */, 514C76500CE9234E007EF3CD /* ResourceErrorMac.mm in Sources */, 514C76780CE923A1007EF3CD /* ResourceHandle.cpp in Sources */, @@ -22586,6 +22840,7 @@ 5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */, BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */, 9353676B09AED88B00D35CD6 /* ScrollViewMac.mm in Sources */, + F55B3DD11251F12D003EF269 /* SearchInputType.cpp in Sources */, AB7170A00B31193B0017123E /* SearchPopupMenuMac.mm in Sources */, 33C0CCD4112C5E6200CE057D /* SecureTextInput.cpp in Sources */, BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */, @@ -22687,6 +22942,7 @@ BC5EB80F0E81F2CE00B25965 /* StyleTransformData.cpp in Sources */, BC5EB6990E81DA6300B25965 /* StyleVisualData.cpp in Sources */, D000ED2711C1B9CD00C47726 /* SubframeLoader.cpp in Sources */, + F55B3DD31251F12D003EF269 /* SubmitInputType.cpp in Sources */, 93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */, 93B2D8180F9920EE006AE6B2 /* SuddenTermination.mm in Sources */, 62C1217C11AB9E77003C462C /* SuspendableTimer.cpp in Sources */, @@ -22724,14 +22980,10 @@ B22279CA0D00BF220071B782 /* SVGFEColorMatrixElement.cpp in Sources */, B22279CD0D00BF220071B782 /* SVGFEComponentTransferElement.cpp in Sources */, B22279D00D00BF220071B782 /* SVGFECompositeElement.cpp in Sources */, - B255997A0D00D8BA00BB825C /* SVGFEConvolveMatrix.cpp in Sources */, 1921327411C0E6BB00456238 /* SVGFEConvolveMatrixElement.cpp in Sources */, - B255997C0D00D8BA00BB825C /* SVGFEDiffuseLighting.cpp in Sources */, B22279D30D00BF220071B782 /* SVGFEDiffuseLightingElement.cpp in Sources */, - B255997E0D00D8BA00BB825C /* SVGFEDisplacementMap.cpp in Sources */, B22279D60D00BF220071B782 /* SVGFEDisplacementMapElement.cpp in Sources */, B22279D90D00BF220071B782 /* SVGFEDistantLightElement.cpp in Sources */, - B25599800D00D8BA00BB825C /* SVGFEFlood.cpp in Sources */, B22279DC0D00BF220071B782 /* SVGFEFloodElement.cpp in Sources */, B22279DF0D00BF220071B782 /* SVGFEFuncAElement.cpp in Sources */, B22279E20D00BF220071B782 /* SVGFEFuncBElement.cpp in Sources */, @@ -22741,21 +22993,14 @@ B25599840D00D8BA00BB825C /* SVGFEImage.cpp in Sources */, B22279EE0D00BF220071B782 /* SVGFEImageElement.cpp in Sources */, B22279F10D00BF220071B782 /* SVGFELightElement.cpp in Sources */, - E440A2D51191A50B000820B0 /* SVGFELighting.cpp in Sources */, - B25599860D00D8BA00BB825C /* SVGFEMerge.cpp in Sources */, B22279F30D00BF220071B782 /* SVGFEMergeElement.cpp in Sources */, B22279F60D00BF220071B782 /* SVGFEMergeNodeElement.cpp in Sources */, - B25599880D00D8BA00BB825C /* SVGFEMorphology.cpp in Sources */, 84224193107E78A700766A87 /* SVGFEMorphologyElement.cpp in Sources */, - B255998A0D00D8BA00BB825C /* SVGFEOffset.cpp in Sources */, B22279F90D00BF220071B782 /* SVGFEOffsetElement.cpp in Sources */, B22279FC0D00BF220071B782 /* SVGFEPointLightElement.cpp in Sources */, - B255998C0D00D8BA00BB825C /* SVGFESpecularLighting.cpp in Sources */, B22279FF0D00BF220071B782 /* SVGFESpecularLightingElement.cpp in Sources */, B2227A020D00BF220071B782 /* SVGFESpotLightElement.cpp in Sources */, - A7D27FC40E0A599F0079AD2B /* SVGFETile.cpp in Sources */, B2227A050D00BF220071B782 /* SVGFETileElement.cpp in Sources */, - B255998F0D00D8BA00BB825C /* SVGFETurbulence.cpp in Sources */, B2227A080D00BF220071B782 /* SVGFETurbulenceElement.cpp in Sources */, 845E72FB0FD2623900A87D79 /* SVGFilter.cpp in Sources */, 081EBF3A0FD34F4100DA7559 /* SVGFilterBuilder.cpp in Sources */, @@ -22784,7 +23029,6 @@ B2227A2F0D00BF220071B782 /* SVGLangSpace.cpp in Sources */, B2227A320D00BF220071B782 /* SVGLength.cpp in Sources */, B2227A350D00BF220071B782 /* SVGLengthList.cpp in Sources */, - B25599930D00D8BA00BB825C /* SVGLightSource.cpp in Sources */, B2227A380D00BF220071B782 /* SVGLinearGradientElement.cpp in Sources */, B2227A3B0D00BF220071B782 /* SVGLineElement.cpp in Sources */, B2227A400D00BF220071B782 /* SVGLocatable.cpp in Sources */, @@ -22878,6 +23122,7 @@ B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */, 6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */, BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */, + F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */, 6550B6A5099DF0270090D781 /* Text.cpp in Sources */, B2AFFC970D00A5DF0030074D /* TextBoundaries.mm in Sources */, B2C3DA370D006C1D00EF6F26 /* TextBreakIteratorICU.cpp in Sources */, @@ -22895,6 +23140,8 @@ C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */, B2C3DA480D006C1D00EF6F26 /* TextEncodingRegistry.cpp in Sources */, 933A142E0B7D188600A53FFD /* TextEvent.cpp in Sources */, + F55B3DD71251F12D003EF269 /* TextFieldInputType.cpp in Sources */, + F55B3DD91251F12D003EF269 /* TextInputType.cpp in Sources */, 93309E1B099E64920056E581 /* TextIterator.cpp in Sources */, 93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */, B2C3DA4A0D006C1D00EF6F26 /* TextStream.cpp in Sources */, @@ -22907,6 +23154,7 @@ 51DF6D800B92A18E00C2DC85 /* ThreadCheck.mm in Sources */, E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */, 185BCF280F3279CE000EA262 /* ThreadTimers.cpp in Sources */, + F55B3DDB1251F12D003EF269 /* TimeInputType.cpp in Sources */, 7553CFE9108F473F00EA281E /* TimelineRecordFactory.cpp in Sources */, 93309EA4099EB78C0056E581 /* Timer.cpp in Sources */, E44613AF0CD6331000FADA75 /* TimeRanges.cpp in Sources */, @@ -22927,6 +23175,7 @@ 49EECDEE10503C2400099FAB /* Uint8Array.cpp in Sources */, B2C3DA4C0D006C1D00EF6F26 /* UnicodeRange.cpp in Sources */, D086FE9909D53AAB005BC74D /* UnlinkCommand.cpp in Sources */, + F55B3DDD1251F12D003EF269 /* URLInputType.cpp in Sources */, 65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */, BCACF3BC1072921A00C0C8A3 /* UserContentURLPattern.cpp in Sources */, 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */, @@ -22971,6 +23220,7 @@ 7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */, 767F99BE11A1194A0080C51D /* WebSocketHandshakeResponse.cpp in Sources */, 0FCF332C0F2B9A25004B6795 /* WebTiledLayer.mm in Sources */, + F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */, 85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */, 935C477309AC4D7700A6AAB4 /* WheelEventMac.mm in Sources */, 9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */, diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cpp index 907bb15..30cce3a 100644 --- a/WebCore/accessibility/AXObjectCache.cpp +++ b/WebCore/accessibility/AXObjectCache.cpp @@ -465,6 +465,16 @@ void AXObjectCache::selectedChildrenChanged(RenderObject* renderer) // to find the container which should send out the notification. postNotification(renderer, AXSelectedChildrenChanged, false); } + +void AXObjectCache::nodeTextChangeNotification(RenderObject* renderer, AXTextChange textChange, unsigned offset, unsigned count) +{ + if (!renderer) + return; + + // Delegate on the right platform + AccessibilityObject* obj = getOrCreate(renderer); + nodeTextChangePlatformNotification(obj, textChange, offset, count); +} #endif #if HAVE(ACCESSIBILITY) @@ -495,9 +505,12 @@ void AXObjectCache::handleAriaRoleChanged(RenderObject* renderer) static_cast<AccessibilityRenderObject*>(obj)->updateAccessibilityRole(); } #endif - + VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData& textMarkerData) { + if (!isNodeInUse(textMarkerData.node)) + return VisiblePosition(); + VisiblePosition visiblePos = VisiblePosition(textMarkerData.node, textMarkerData.offset, textMarkerData.affinity); Position deepPos = visiblePos.deepEquivalent(); if (deepPos.isNull()) @@ -549,7 +562,9 @@ void AXObjectCache::textMarkerDataForVisiblePosition(TextMarkerData& textMarkerD textMarkerData.axID = obj.get()->axObjectID(); textMarkerData.node = domNode; textMarkerData.offset = deepPos.deprecatedEditingOffset(); - textMarkerData.affinity = visiblePos.affinity(); + textMarkerData.affinity = visiblePos.affinity(); + + cache->setNodeInUse(domNode); } } // namespace WebCore diff --git a/WebCore/accessibility/AXObjectCache.h b/WebCore/accessibility/AXObjectCache.h index 28a5917..2ee56ee 100644 --- a/WebCore/accessibility/AXObjectCache.h +++ b/WebCore/accessibility/AXObjectCache.h @@ -100,9 +100,14 @@ public: AXID platformGenerateAXID() const; AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); } + // This is a weak reference cache for knowing if Nodes used by TextMarkers are valid. + void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } + void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } + bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } + // Text marker utilities. - static void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&); - static VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&); + void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&); + VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&); enum AXNotification { AXActiveDescendantChanged, @@ -125,12 +130,23 @@ public: void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously); void postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType = PostAsynchronously); + enum AXTextChange { + AXTextInserted, + AXTextDeleted, + }; + + void nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned offset, unsigned count); + + bool nodeHasRole(Node*, const AtomicString& role); + protected: void postPlatformNotification(AccessibilityObject*, AXNotification); + void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, unsigned count); private: HashMap<AXID, RefPtr<AccessibilityObject> > m_objects; HashMap<RenderObject*, AXID> m_renderObjectMapping; + HashSet<Node*> m_textMarkerNodes; static bool gAccessibilityEnabled; static bool gAccessibilityEnhancedUserInterfaceEnabled; @@ -156,6 +172,8 @@ inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { } inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { } inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { } inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { } +inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, unsigned) { } +inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, unsigned) { } inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { } inline void AXObjectCache::handleScrolledToAnchor(const Node*) { } inline void AXObjectCache::contentChanged(RenderObject*) { } diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h index cefaa94..b7b85fe 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.h +++ b/WebCore/accessibility/AccessibilityRenderObject.h @@ -311,7 +311,22 @@ private: mutable AccessibilityRole m_roleForMSAA; }; - + +inline AccessibilityRenderObject* toAccessibilityRenderObject(AccessibilityObject* object) +{ + ASSERT(!object || object->isAccessibilityRenderObject()); + return static_cast<AccessibilityRenderObject*>(object); +} + +inline const AccessibilityRenderObject* toAccessibilityRenderObject(const AccessibilityObject* object) +{ + ASSERT(!object || object->isAccessibilityRenderObject()); + return static_cast<const AccessibilityRenderObject*>(object); +} + +// This will catch anyone doing an unnecessary cast. +void toAccessibilityRenderObject(const AccessibilityRenderObject*); + } // namespace WebCore #endif // AccessibilityRenderObject_h diff --git a/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp b/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp index 3ff0837..b02fe00 100644 --- a/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp +++ b/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp @@ -28,20 +28,11 @@ #include "AXObjectCache.h" #include "AccessibilityObject.h" #include "Chrome.h" -#include "ChromeClientChromium.h" +#include "ChromeClient.h" #include "FrameView.h" namespace WebCore { -static ChromeClientChromium* toChromeClientChromium(FrameView* view) -{ - Page* page = view->frame() ? view->frame()->page() : 0; - if (!page) - return 0; - - return static_cast<ChromeClientChromium*>(page->chrome()->client()); -} - void AXObjectCache::detachWrapper(AccessibilityObject* obj) { // In Chromium, AccessibilityObjects are wrapped lazily. @@ -56,22 +47,24 @@ void AXObjectCache::attachWrapper(AccessibilityObject*) void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotification notification) { - if (!obj || !obj->document() || !obj->documentFrameView()) + if (!obj || !obj->document() || !obj->documentFrameView() || !obj->documentFrameView()->frame() || !obj->documentFrameView()->frame()->page()) return; - ChromeClientChromium* client = toChromeClientChromium(obj->documentFrameView()); + ChromeClient* client = obj->documentFrameView()->frame()->page()->chrome()->client(); if (!client) return; - // TODO: Remove after the new postAccessibilityNotification is used downstream. switch (notification) { - case AXCheckedStateChanged: - client->didChangeAccessibilityObjectState(obj); + case AXActiveDescendantChanged: + if (!obj->document()->focusedNode() || (obj->node() != obj->document()->focusedNode())) + break; + + // Calling handleFocusedUIElementChanged will focus the new active + // descendant and send the AXFocusedUIElementChanged notification. + handleFocusedUIElementChanged(0, obj->document()->focusedNode()->renderer()); break; + case AXCheckedStateChanged: case AXChildrenChanged: - client->didChangeAccessibilityObjectChildren(obj); - break; - case AXActiveDescendantChanged: case AXFocusedUIElementChanged: case AXLayoutComplete: case AXLiveRegionChanged: @@ -90,12 +83,31 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific client->postAccessibilityNotification(obj, notification); } -void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) +void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, unsigned) { } -void AXObjectCache::handleScrolledToAnchor(const Node*) +void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject* newFocusedRenderer) +{ + if (!newFocusedRenderer) + return; + + Page* page = newFocusedRenderer->document()->page(); + if (!page) + return; + + AccessibilityObject* focusedObject = focusedUIElementForPage(page); + if (!focusedObject) + return; + + postPlatformNotification(focusedObject, AXFocusedUIElementChanged); +} + +void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode) { + // The anchor node may not be accessible. Post the notification for the + // first accessible object. + postPlatformNotification(AccessibilityObject::firstAccessibleObjectFromNode(anchorNode), AXScrolledToAnchor); } } // namespace WebCore diff --git a/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp b/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp index c30b006..a4ea87c 100644 --- a/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp +++ b/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp @@ -22,6 +22,10 @@ #include "AccessibilityObject.h" #include "AccessibilityObjectWrapperAtk.h" +#include "AccessibilityRenderObject.h" +#include "GOwnPtr.h" +#include "Range.h" +#include "TextIterator.h" namespace WebCore { @@ -50,6 +54,39 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AX } } +static void emitTextChanged(AccessibilityRenderObject* object, AXObjectCache::AXTextChange textChange, unsigned offset, unsigned count) +{ + // Get the axObject for the parent object + AtkObject* wrapper = object->parentObjectUnignored()->wrapper(); + if (!wrapper || !ATK_IS_TEXT(wrapper)) + return; + + // Select the right signal to be emitted + CString detail; + switch (textChange) { + case AXObjectCache::AXTextInserted: + detail = "text-changed::insert"; + break; + case AXObjectCache::AXTextDeleted: + detail = "text-changed::delete"; + break; + } + + if (!detail.isNull()) + g_signal_emit_by_name(wrapper, detail.data(), offset, count); +} + +void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject* object, AXTextChange textChange, unsigned offset, unsigned count) +{ + // Sanity check + if (count < 1 || !object || !object->isAccessibilityRenderObject()) + return; + + Node* node = object->node(); + RefPtr<Range> range = Range::create(node->document(), Position(node->parentNode(), 0), Position(node, 0)); + emitTextChanged(toAccessibilityRenderObject(object), textChange, offset + TextIterator::rangeLength(range.get()), count); +} + void AXObjectCache::handleFocusedUIElementChanged(RenderObject* oldFocusedRender, RenderObject* newFocusedRender) { RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedRender); diff --git a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp index 7f9fd1a..9772b43 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp @@ -73,8 +73,12 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO if (role == StaticTextRole) return IgnoreObject; + // Include all list items, regardless they have or not inline children + if (role == ListItemRole) + return IncludeObject; + // Bullets/numbers for list items shouldn't be exposed as AtkObjects. - if (roleValue() == ListMarkerRole) + if (role == ListMarkerRole) return IgnoreObject; return DefaultBehavior; diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 01dddd1..3575afe 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -55,6 +55,7 @@ #include "InlineTextBox.h" #include "IntRect.h" #include "NotImplemented.h" +#include "RenderListItem.h" #include "RenderListMarker.h" #include "RenderText.h" #include "TextEncoding.h" @@ -878,9 +879,13 @@ gchar* textForObject(AccessibilityRenderObject* accObject) g_string_append(str, "\n"); range = accObject->doAXRangeForLine(++lineNumber); } - } else if (accObject->renderer()) { + } else { + RenderObject* renderer = accObject->renderer(); + if (!renderer) + return g_string_free(str, FALSE); + // For RenderBlocks, piece together the text from the RenderText objects they contain. - for (RenderObject* obj = accObject->renderer()->firstChild(); obj; obj = obj->nextSibling()) { + for (RenderObject* obj = renderer->firstChild(); obj; obj = obj->nextSibling()) { if (obj->isBR()) { g_string_append(str, "\n"); continue; @@ -907,7 +912,17 @@ gchar* textForObject(AccessibilityRenderObject* accObject) box = box->nextTextBox(); } } + + // Insert the text of the marker for list item in the right place, if present + if (renderer->isListItem()) { + String markerText = toRenderListItem(renderer)->markerTextWithSuffix(); + if (renderer->style()->direction() == LTR) + g_string_prepend(str, markerText.utf8().data()); + else + g_string_append(str, markerText.utf8().data()); + } } + return g_string_free(str, FALSE); } @@ -939,10 +954,9 @@ static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, g // Prefix a item number/bullet if needed if (coreObject->roleValue() == ListItemRole) { RenderObject* objRenderer = static_cast<AccessibilityRenderObject*>(coreObject)->renderer(); - RenderObject* markerRenderer = objRenderer ? objRenderer->firstChild() : 0; - if (markerRenderer && markerRenderer->isListMarker()) { - String markerTxt = toRenderListMarker(markerRenderer)->text(); - ret = markerTxt.length() > 0 ? markerTxt + " " + ret : ret; + if (objRenderer && objRenderer->isListItem()) { + String markerText = toRenderListItem(objRenderer)->markerTextWithSuffix(); + ret = objRenderer->style()->direction() == LTR ? markerText + ret : ret + markerText; } } @@ -1185,8 +1199,29 @@ static AtkAttributeSet* attributeSetDifference(AtkAttributeSet* a1, AtkAttribute static guint accessibilityObjectLength(const AccessibilityObject* object) { - GOwnPtr<gchar> text(webkit_accessible_text_get_text(ATK_TEXT(object->wrapper()), 0, -1)); - return g_utf8_strlen(text.get(), -1); + // Non render objects are not taken into account + if (!object->isAccessibilityRenderObject()) + return 0; + + // For those objects implementing the AtkText interface we use the + // well known API to always get the text in a consistent way + AtkObject* atkObj = ATK_OBJECT(object->wrapper()); + if (ATK_IS_TEXT(atkObj)) { + GOwnPtr<gchar> text(webkit_accessible_text_get_text(ATK_TEXT(atkObj), 0, -1)); + return g_utf8_strlen(text.get(), -1); + } + + // Even if we don't expose list markers to Assistive + // Technologies, we need to have a way to measure their length + // for those cases when it's needed to take it into account + // separately (as in getAccessibilityObjectForOffset) + RenderObject* renderer = static_cast<const AccessibilityRenderObject*>(object)->renderer(); + if (renderer && renderer->isListMarker()) { + RenderListMarker* marker = toRenderListMarker(renderer); + return marker->text().length() + marker->suffix().length(); + } + + return 0; } static const AccessibilityObject* getAccessibilityObjectForOffset(const AccessibilityObject* object, guint offset, gint* startOffset, gint* endOffset) @@ -1321,12 +1356,7 @@ static void webkit_accessible_text_get_range_extents(AtkText* text, gint startOf static gint webkit_accessible_text_get_character_count(AtkText* text) { - AccessibilityObject* coreObject = core(text); - - if (coreObject->isTextControl()) - return coreObject->textLength(); - else - return coreObject->textUnderElement().length(); + return accessibilityObjectLength(core(text)); } static gint webkit_accessible_text_get_offset_at_point(AtkText* text, gint x, gint y, AtkCoordType coords) @@ -2026,8 +2056,21 @@ static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject) interfaceMask |= 1 << WAI_TEXT; if (!coreObject->isReadOnly()) interfaceMask |= 1 << WAI_EDITABLE_TEXT; - } else if (role != TableRole && static_cast<AccessibilityRenderObject*>(coreObject)->renderer()->childrenInline()) - interfaceMask |= 1 << WAI_TEXT; + } else { + AccessibilityRenderObject* axRenderObject = static_cast<AccessibilityRenderObject*>(coreObject); + RenderObject* renderer = axRenderObject->renderer(); + if (role != TableRole && renderer && renderer->childrenInline()) + interfaceMask |= 1 << WAI_TEXT; + else if (role == ListItemRole) { + // Add the TEXT interface for list items whose + // first accessible child has a text renderer + AccessibilityObject::AccessibilityChildrenVector children = axRenderObject->children(); + if (children.size()) { + AccessibilityObject* axRenderChild = children.at(0).get(); + interfaceMask |= getInterfaceMaskFromObject(axRenderChild); + } + } + } // Image if (coreObject->isImage()) diff --git a/WebCore/accessibility/mac/AXObjectCacheMac.mm b/WebCore/accessibility/mac/AXObjectCacheMac.mm index a02bc75..fbb485d 100644 --- a/WebCore/accessibility/mac/AXObjectCacheMac.mm +++ b/WebCore/accessibility/mac/AXObjectCacheMac.mm @@ -108,12 +108,20 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific return; } + // NSAccessibilityPostNotification will call this method, (but not when running DRT), so ASSERT here to make sure it does not crash. + // https://bugs.webkit.org/show_bug.cgi?id=46662 + ASSERT([obj->wrapper() accessibilityIsIgnored] || true); + NSAccessibilityPostNotification(obj->wrapper(), macNotification); // Used by DRT to know when notifications are posted. [obj->wrapper() accessibilityPostedNotification:macNotification]; } +void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, unsigned) +{ +} + void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { [[WebCoreViewFactory sharedFactory] accessibilityHandleFocusChanged]; diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index e3e28d7..cb983eb 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -200,6 +200,22 @@ typedef unsigned NSUInteger; m_object = 0; } +- (BOOL)updateObjectBackingStore +{ + // Calling updateBackingStore() can invalidate this element so self must be retained. + // If it does become invalidated, m_object will be nil. + [[self retain] autorelease]; + + if (!m_object) + return NO; + + m_object->updateBackingStore(); + if (!m_object) + return NO; + + return YES; +} + - (AccessibilityObject*)accessibilityObject { return m_object; @@ -214,35 +230,49 @@ typedef unsigned NSUInteger; return NSAccessibilityUnignoredDescendant(widget->platformWidget()); } -static WebCoreTextMarker* textMarkerForVisiblePosition(const VisiblePosition& visiblePos) +static WebCoreTextMarker* textMarkerForVisiblePosition(AXObjectCache* cache, const VisiblePosition& visiblePos) { + ASSERT(cache); + TextMarkerData textMarkerData; - AXObjectCache::textMarkerDataForVisiblePosition(textMarkerData, visiblePos); + cache->textMarkerDataForVisiblePosition(textMarkerData, visiblePos); if (!textMarkerData.axID) return nil; return [[WebCoreViewFactory sharedFactory] textMarkerWithBytes:&textMarkerData length:sizeof(textMarkerData)]; } -static VisiblePosition visiblePositionForTextMarker(WebCoreTextMarker* textMarker) +- (WebCoreTextMarker *)textMarkerForVisiblePosition:(const VisiblePosition &)visiblePos +{ + return textMarkerForVisiblePosition(m_object->axObjectCache(), visiblePos); +} + +static VisiblePosition visiblePositionForTextMarker(AXObjectCache* cache, WebCoreTextMarker* textMarker) { + ASSERT(cache); + if (!textMarker) return VisiblePosition(); TextMarkerData textMarkerData; if (![[WebCoreViewFactory sharedFactory] getBytes:&textMarkerData fromTextMarker:textMarker length:sizeof(textMarkerData)]) return VisiblePosition(); - return AXObjectCache::visiblePositionForTextMarkerData(textMarkerData); + return cache->visiblePositionForTextMarkerData(textMarkerData); +} + +- (VisiblePosition)visiblePositionForTextMarker:(WebCoreTextMarker *)textMarker +{ + return visiblePositionForTextMarker(m_object->axObjectCache(), textMarker); } -static VisiblePosition visiblePositionForStartOfTextMarkerRange(WebCoreTextMarkerRange* textMarkerRange) +static VisiblePosition visiblePositionForStartOfTextMarkerRange(AXObjectCache *cache, WebCoreTextMarkerRange* textMarkerRange) { - return visiblePositionForTextMarker([[WebCoreViewFactory sharedFactory] startOfTextMarkerRange:textMarkerRange]); + return visiblePositionForTextMarker(cache, [[WebCoreViewFactory sharedFactory] startOfTextMarkerRange:textMarkerRange]); } -static VisiblePosition visiblePositionForEndOfTextMarkerRange(WebCoreTextMarkerRange* textMarkerRange) +static VisiblePosition visiblePositionForEndOfTextMarkerRange(AXObjectCache *cache, WebCoreTextMarkerRange* textMarkerRange) { - return visiblePositionForTextMarker([[WebCoreViewFactory sharedFactory] endOfTextMarkerRange:textMarkerRange]); + return visiblePositionForTextMarker(cache, [[WebCoreViewFactory sharedFactory] endOfTextMarkerRange:textMarkerRange]); } static WebCoreTextMarkerRange* textMarkerRangeFromMarkers(WebCoreTextMarker* textMarker1, WebCoreTextMarker* textMarker2) @@ -512,11 +542,11 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) return nil; // extract the start and end VisiblePosition - VisiblePosition startVisiblePosition = visiblePositionForStartOfTextMarkerRange(textMarkerRange); + VisiblePosition startVisiblePosition = visiblePositionForStartOfTextMarkerRange(m_object->axObjectCache(), textMarkerRange); if (startVisiblePosition.isNull()) return nil; - VisiblePosition endVisiblePosition = visiblePositionForEndOfTextMarkerRange(textMarkerRange); + VisiblePosition endVisiblePosition = visiblePositionForEndOfTextMarkerRange(m_object->axObjectCache(), textMarkerRange); if (endVisiblePosition.isNull()) return nil; @@ -562,20 +592,21 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) return [attrString autorelease]; } -static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePosition startPosition, VisiblePosition endPosition) +static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache *cache, VisiblePosition startPosition, VisiblePosition endPosition) { - WebCoreTextMarker* startTextMarker = textMarkerForVisiblePosition(startPosition); - WebCoreTextMarker* endTextMarker = textMarkerForVisiblePosition(endPosition); + WebCoreTextMarker* startTextMarker = textMarkerForVisiblePosition(cache, startPosition); + WebCoreTextMarker* endTextMarker = textMarkerForVisiblePosition(cache, endPosition); return textMarkerRangeFromMarkers(startTextMarker, endTextMarker); } -- (NSArray*)accessibilityActionNames +- (WebCoreTextMarkerRange *)textMarkerRangeFromVisiblePositions:(VisiblePosition)startPosition endPosition:(VisiblePosition)endPosition { - if (!m_object) - return nil; + return textMarkerRangeFromVisiblePositions(m_object->axObjectCache(), startPosition, endPosition); +} - m_object->updateBackingStore(); - if (!m_object) +- (NSArray*)accessibilityActionNames +{ + if (![self updateObjectBackingStore]) return nil; static NSArray* actionElementActions = [[NSArray alloc] initWithObjects: NSAccessibilityPressAction, NSAccessibilityShowMenuAction, nil]; @@ -638,11 +669,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi - (NSArray*)accessibilityAttributeNames { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; if (m_object->isAttachment()) @@ -982,7 +1009,8 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi { if (!textMarkerRange) return VisiblePositionRange(); - return VisiblePositionRange(visiblePositionForStartOfTextMarkerRange(textMarkerRange), visiblePositionForEndOfTextMarkerRange(textMarkerRange)); + AXObjectCache* cache = m_object->axObjectCache(); + return VisiblePositionRange(visiblePositionForStartOfTextMarkerRange(cache, textMarkerRange), visiblePositionForEndOfTextMarkerRange(cache, textMarkerRange)); } - (NSArray*)renderWidgetChildren @@ -1028,7 +1056,7 @@ static NSMutableArray* convertToNSArray(const AccessibilityObject::Accessibility VisibleSelection selection = m_object->selection(); if (selection.isNone()) return nil; - return textMarkerRangeFromVisiblePositions(selection.visibleStart(), selection.visibleEnd()); + return [self textMarkerRangeFromVisiblePositions:selection.visibleStart() endPosition:selection.visibleEnd()]; } - (NSValue*)position @@ -1354,11 +1382,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) // or maybe pointers to member functions - (id)accessibilityAttributeValue:(NSString*)attributeName { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; if ([attributeName isEqualToString: NSAccessibilityRoleAttribute]) @@ -1784,9 +1808,9 @@ static NSString* roleValueToNSString(AccessibilityRole value) return nil; if ([attributeName isEqualToString: @"AXStartTextMarker"]) - return textMarkerForVisiblePosition(startOfDocument(renderer->document())); + return [self textMarkerForVisiblePosition:startOfDocument(renderer->document())]; if ([attributeName isEqualToString: @"AXEndTextMarker"]) - return textMarkerForVisiblePosition(endOfDocument(renderer->document())); + return [self textMarkerForVisiblePosition:endOfDocument(renderer->document())]; if ([attributeName isEqualToString:NSAccessibilityBlockQuoteLevelAttribute]) return [NSNumber numberWithInt:blockquoteLevel(renderer)]; @@ -1889,11 +1913,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (id)accessibilityFocusedUIElement { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; RefPtr<AccessibilityObject> focusedObj = m_object->focusedUIElement(); @@ -1906,11 +1926,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (id)accessibilityHitTest:(NSPoint)point { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; RefPtr<AccessibilityObject> axObject = m_object->doAccessibilityHitTest(IntPoint(point)); @@ -1921,11 +1937,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (BOOL)accessibilityIsAttributeSettable:(NSString*)attributeName { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; if ([attributeName isEqualToString: @"AXSelectedTextMarkerRange"]) @@ -1971,11 +1983,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) // Registering an object is also required for observing notifications. Only registered objects can be observed. - (BOOL)accessibilityIsIgnored { - if (!m_object) - return YES; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return YES; if (m_object->isAttachment()) @@ -1985,11 +1993,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (NSArray* )accessibilityParameterizedAttributeNames { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; if (m_object->isAttachment()) @@ -2073,11 +2077,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (void)accessibilityPerformPressAction { - if (!m_object) - return; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return; if (m_object->isAttachment()) @@ -2088,11 +2088,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (void)accessibilityPerformIncrementAction { - if (!m_object) - return; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return; if (m_object->isAttachment()) @@ -2103,11 +2099,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (void)accessibilityPerformDecrementAction { - if (!m_object) - return; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return; if (m_object->isAttachment()) @@ -2158,11 +2150,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (void)accessibilityPerformAction:(NSString*)action { - if (!m_object) - return; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return; if ([action isEqualToString:NSAccessibilityPressAction]) @@ -2180,11 +2168,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName { - if (!m_object) - return; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return; WebCoreTextMarkerRange* textMarkerRange = nil; @@ -2290,7 +2274,7 @@ static RenderObject* rendererForView(NSView* view) { PlainTextRange textRange = PlainTextRange(range.location, range.length); VisiblePositionRange visiblePosRange = m_object->visiblePositionRangeForRange(textRange); - return [self doAXAttributedStringForTextMarkerRange:textMarkerRangeFromVisiblePositions(visiblePosRange.start, visiblePosRange.end)]; + return [self doAXAttributedStringForTextMarkerRange:[self textMarkerRangeFromVisiblePositions:visiblePosRange.start endPosition:visiblePosRange.end]]; } // The RTF representation of the text associated with this accessibility object that is @@ -2317,8 +2301,7 @@ static RenderObject* rendererForView(NSView* view) if (!m_object || !attribute || !parameter) return nil; - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; // common parameter type check/casting. Nil checks in handlers catch wrong type case. @@ -2353,7 +2336,7 @@ static RenderObject* rendererForView(NSView* view) // dispatch if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; AccessibilityObject* axObject = m_object->accessibilityObjectForPosition(visiblePos); if (!axObject) return nil; @@ -2362,17 +2345,17 @@ static RenderObject* rendererForView(NSView* view) if ([attribute isEqualToString:@"AXTextMarkerRangeForUIElement"]) { VisiblePositionRange vpRange = uiElement.get()->visiblePositionRange(); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXLineForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; return [NSNumber numberWithUnsignedInt:m_object->lineForPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXTextMarkerRangeForLine"]) { VisiblePositionRange vpRange = m_object->visiblePositionRangeForLine([number intValue]); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXStringForTextMarkerRange"]) { @@ -2382,7 +2365,7 @@ static RenderObject* rendererForView(NSView* view) if ([attribute isEqualToString:@"AXTextMarkerForPosition"]) { IntPoint webCorePoint = IntPoint(point); - return pointSet ? textMarkerForVisiblePosition(m_object->visiblePositionForPoint(webCorePoint)) : nil; + return pointSet ? [self textMarkerForVisiblePosition:m_object->visiblePositionForPoint(webCorePoint)] : nil; } if ([attribute isEqualToString:@"AXBoundsForTextMarkerRange"]) { @@ -2421,102 +2404,102 @@ static RenderObject* rendererForView(NSView* view) || ![[WebCoreViewFactory sharedFactory] objectIsTextMarker:textMarker2]) return nil; - VisiblePosition visiblePos1 = visiblePositionForTextMarker(textMarker1); - VisiblePosition visiblePos2 = visiblePositionForTextMarker(textMarker2); + VisiblePosition visiblePos1 = [self visiblePositionForTextMarker:(textMarker1)]; + VisiblePosition visiblePos2 = [self visiblePositionForTextMarker:(textMarker2)]; VisiblePositionRange vpRange = m_object->visiblePositionRangeForUnorderedPositions(visiblePos1, visiblePos2); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXNextTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->nextVisiblePosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->nextVisiblePosition(visiblePos)]; } if ([attribute isEqualToString:@"AXPreviousTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->previousVisiblePosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->previousVisiblePosition(visiblePos)]; } if ([attribute isEqualToString:@"AXLeftWordTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->positionOfLeftWord(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXRightWordTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->positionOfRightWord(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXLeftLineTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->leftLineVisiblePositionRange(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXRightLineTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->rightLineVisiblePositionRange(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXSentenceTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->sentenceForPosition(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXParagraphTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->paragraphForPosition(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXNextWordEndTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->nextWordEnd(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->nextWordEnd(visiblePos)]; } if ([attribute isEqualToString:@"AXPreviousWordStartTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->previousWordStart(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->previousWordStart(visiblePos)]; } if ([attribute isEqualToString:@"AXNextLineEndTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->nextLineEndPosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->nextLineEndPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXPreviousLineStartTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->previousLineStartPosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->previousLineStartPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXNextSentenceEndTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->nextSentenceEndPosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->nextSentenceEndPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXPreviousSentenceStartTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->previousSentenceStartPosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->previousSentenceStartPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXNextParagraphEndTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->nextParagraphEndPosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->nextParagraphEndPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXPreviousParagraphStartTextMarkerForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); - return textMarkerForVisiblePosition(m_object->previousParagraphStartPosition(visiblePos)); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; + return [self textMarkerForVisiblePosition:m_object->previousParagraphStartPosition(visiblePos)]; } if ([attribute isEqualToString:@"AXStyleTextMarkerRangeForTextMarker"]) { - VisiblePosition visiblePos = visiblePositionForTextMarker(textMarker); + VisiblePosition visiblePos = [self visiblePositionForTextMarker:(textMarker)]; VisiblePositionRange vpRange = m_object->styleRangeForPosition(visiblePos); - return (id)textMarkerRangeFromVisiblePositions(vpRange.start, vpRange.end); + return [self textMarkerRangeFromVisiblePositions:vpRange.start endPosition:vpRange.end]; } if ([attribute isEqualToString:@"AXLengthForTextMarkerRange"]) { @@ -2530,12 +2513,12 @@ static RenderObject* rendererForView(NSView* view) // Used only by DumpRenderTree (so far). if ([attribute isEqualToString:@"AXStartTextMarkerForTextMarkerRange"]) { VisiblePositionRange visiblePosRange = [self visiblePositionRangeForTextMarkerRange:textMarkerRange]; - return textMarkerForVisiblePosition(visiblePosRange.start); + return [self textMarkerForVisiblePosition:visiblePosRange.start]; } if ([attribute isEqualToString:@"AXEndTextMarkerForTextMarkerRange"]) { VisiblePositionRange visiblePosRange = [self visiblePositionRangeForTextMarkerRange:textMarkerRange]; - return textMarkerForVisiblePosition(visiblePosRange.end); + return [self textMarkerForVisiblePosition:visiblePosRange.end]; } if (m_object->isDataTable()) { @@ -2614,11 +2597,7 @@ static RenderObject* rendererForView(NSView* view) // API that AppKit uses for faster access - (NSUInteger)accessibilityIndexOfChild:(id)child { - if (!m_object) - return NSNotFound; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return NSNotFound; // Tree objects return their rows as their children. We can use the original method @@ -2643,11 +2622,7 @@ static RenderObject* rendererForView(NSView* view) - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute { - if (!m_object) - return 0; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return 0; if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { @@ -2668,11 +2643,7 @@ static RenderObject* rendererForView(NSView* view) - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount { - if (!m_object) - return nil; - - m_object->updateBackingStore(); - if (!m_object) + if (![self updateObjectBackingStore]) return nil; if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { diff --git a/WebCore/accessibility/win/AXObjectCacheWin.cpp b/WebCore/accessibility/win/AXObjectCacheWin.cpp index 21e61d9..b20b51a 100644 --- a/WebCore/accessibility/win/AXObjectCacheWin.cpp +++ b/WebCore/accessibility/win/AXObjectCacheWin.cpp @@ -103,6 +103,10 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific NotifyWinEvent(msaaEvent, page->chrome()->platformPageClient(), OBJID_CLIENT, -static_cast<LONG>(obj->axObjectID())); } +void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, unsigned) +{ +} + AXID AXObjectCache::platformGenerateAXID() const { static AXID lastUsedID = 0; diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index a15fd6d..9a96f22 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -36,6 +36,10 @@ #include "SharedWorkerRepository.h" #include "WebSocket.h" +#if ENABLE(FILE_SYSTEM) +#include "AsyncFileSystem.h" +#endif + namespace WebCore { bool RuntimeEnabledFeatures::isLocalStorageEnabled = true; @@ -57,6 +61,11 @@ bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false; #if ENABLE(FILE_SYSTEM) bool RuntimeEnabledFeatures::isFileSystemEnabled = false; + +bool RuntimeEnabledFeatures::fileSystemEnabled() +{ + return isFileSystemEnabled && AsyncFileSystem::isAvailable(); +} #endif #if ENABLE(VIDEO) diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h index 91768b0..88350c7 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -138,7 +138,7 @@ public: static void setSpeechInputEnabled(bool isEnabled) { isSpeechInputEnabled = isEnabled; } static bool speechInputEnabled() { return isSpeechInputEnabled; } - static bool speechEnabled() { return isSpeechInputEnabled; } + static bool webkitspeechEnabled() { return isSpeechInputEnabled; } #if ENABLE(XHR_RESPONSE_BLOB) static bool xhrResponseBlobEnabled() { return isXHRResponseBlobEnabled; } @@ -148,7 +148,7 @@ public: #endif #if ENABLE(FILE_SYSTEM) - static bool fileSystemEnabled() { return isFileSystemEnabled; } + static bool fileSystemEnabled(); static void setFileSystemEnabled(bool isEnabled) { isFileSystemEnabled = isEnabled; } static bool requestFileSystemEnabled() { return isFileSystemEnabled; } #endif diff --git a/WebCore/bindings/gobject/GNUmakefile.am b/WebCore/bindings/gobject/GNUmakefile.am index 12835cc..d808e18 100644 --- a/WebCore/bindings/gobject/GNUmakefile.am +++ b/WebCore/bindings/gobject/GNUmakefile.am @@ -49,6 +49,8 @@ webkitgtk_gdom_built_sources += \ DerivedSources/webkit/WebKitDOMDOMStringListPrivate.h \ DerivedSources/webkit/WebKitDOMDOMStringMap.cpp \ DerivedSources/webkit/WebKitDOMDOMStringMapPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMTokenList.cpp \ + DerivedSources/webkit/WebKitDOMDOMTokenListPrivate.h \ DerivedSources/webkit/WebKitDOMDOMWindow.cpp \ DerivedSources/webkit/WebKitDOMDOMWindowPrivate.h \ DerivedSources/webkit/WebKitDOMElement.cpp \ @@ -263,6 +265,7 @@ webkitgtk_built_h_api += \ DerivedSources/webkit/WebKitDOMDOMImplementation.h \ DerivedSources/webkit/WebKitDOMDOMStringList.h \ DerivedSources/webkit/WebKitDOMDOMStringMap.h \ + DerivedSources/webkit/WebKitDOMDOMTokenList.h \ DerivedSources/webkit/WebKitDOMElement.h \ DerivedSources/webkit/WebKitDOMEntityReference.h \ DerivedSources/webkit/WebKitDOMEvent.h \ diff --git a/WebCore/bindings/js/JSClipboardCustom.cpp b/WebCore/bindings/js/JSClipboardCustom.cpp index 2a8d309..17c6640 100644 --- a/WebCore/bindings/js/JSClipboardCustom.cpp +++ b/WebCore/bindings/js/JSClipboardCustom.cpp @@ -101,7 +101,7 @@ JSValue JSClipboard::setDragImage(ExecState* exec) { Clipboard* clipboard = impl(); - if (!clipboard->isForDragging()) + if (!clipboard->isForDragAndDrop()) return jsUndefined(); // FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments. diff --git a/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp index 225a626..f1c1bc0 100644 --- a/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp +++ b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp @@ -35,54 +35,124 @@ using namespace JSC; namespace WebCore { -JSValue JSDeviceMotionEvent::xAcceleration(ExecState* exec) const +static PassRefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSValue value, ExecState* exec) { - DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); - if (!imp->deviceMotionData()->canProvideXAcceleration()) - return jsNull(); - return jsNumber(exec, imp->deviceMotionData()->xAcceleration()); + if (value.isUndefinedOrNull()) + return 0; + + // Given the above test, this will always yield an object. + JSObject* object = value.toObject(exec); + + JSValue xValue = object->get(exec, Identifier(exec, "x")); + if (exec->hadException()) + return 0; + bool canProvideX = !xValue.isUndefinedOrNull(); + double x = xValue.toNumber(exec); + if (exec->hadException()) + return 0; + + JSValue yValue = object->get(exec, Identifier(exec, "y")); + if (exec->hadException()) + return 0; + bool canProvideY = !yValue.isUndefinedOrNull(); + double y = yValue.toNumber(exec); + if (exec->hadException()) + return 0; + + JSValue zValue = object->get(exec, Identifier(exec, "z")); + if (exec->hadException()) + return 0; + bool canProvideZ = !zValue.isUndefinedOrNull(); + double z = zValue.toNumber(exec); + if (exec->hadException()) + return 0; + + if (!canProvideX && !canProvideY && !canProvideZ) + return 0; + + return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z); } -JSValue JSDeviceMotionEvent::yAcceleration(ExecState* exec) const +static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSValue value, ExecState* exec) { - DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); - if (!imp->deviceMotionData()->canProvideYAcceleration()) - return jsNull(); - return jsNumber(exec, imp->deviceMotionData()->yAcceleration()); + if (value.isUndefinedOrNull()) + return 0; + + // Given the above test, this will always yield an object. + JSObject* object = value.toObject(exec); + + JSValue alphaValue = object->get(exec, Identifier(exec, "alpha")); + if (exec->hadException()) + return 0; + bool canProvideAlpha = !alphaValue.isUndefinedOrNull(); + double alpha = alphaValue.toNumber(exec); + if (exec->hadException()) + return 0; + + JSValue betaValue = object->get(exec, Identifier(exec, "beta")); + if (exec->hadException()) + return 0; + bool canProvideBeta = !betaValue.isUndefinedOrNull(); + double beta = betaValue.toNumber(exec); + if (exec->hadException()) + return 0; + + JSValue gammaValue = object->get(exec, Identifier(exec, "gamma")); + if (exec->hadException()) + return 0; + bool canProvideGamma = !gammaValue.isUndefinedOrNull(); + double gamma = gammaValue.toNumber(exec); + if (exec->hadException()) + return 0; + + if (!canProvideAlpha && !canProvideBeta && !canProvideGamma) + return 0; + + return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } -JSValue JSDeviceMotionEvent::zAcceleration(ExecState* exec) const +static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState* exec) { - DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); - if (!imp->deviceMotionData()->canProvideZAcceleration()) - return jsNull(); - return jsNumber(exec, imp->deviceMotionData()->zAcceleration()); + JSObject* object = constructEmptyObject(exec); + object->putDirect(Identifier(exec, "x"), acceleration->canProvideX() ? jsNumber(exec, acceleration->x()) : jsNull()); + object->putDirect(Identifier(exec, "y"), acceleration->canProvideY() ? jsNumber(exec, acceleration->y()) : jsNull()); + object->putDirect(Identifier(exec, "z"), acceleration->canProvideZ() ? jsNumber(exec, acceleration->z()) : jsNull()); + return object; +} + +static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState* exec) +{ + JSObject* object = constructEmptyObject(exec); + object->putDirect(Identifier(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(exec, rotationRate->alpha()) : jsNull()); + object->putDirect(Identifier(exec, "beta"), rotationRate->canProvideBeta() ? jsNumber(exec, rotationRate->beta()) : jsNull()); + object->putDirect(Identifier(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(exec, rotationRate->gamma()) : jsNull()); + return object; } -JSValue JSDeviceMotionEvent::xRotationRate(ExecState* exec) const +JSValue JSDeviceMotionEvent::acceleration(ExecState* exec) const { DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); - if (!imp->deviceMotionData()->canProvideXRotationRate()) + if (!imp->deviceMotionData()->acceleration()) return jsNull(); - return jsNumber(exec, imp->deviceMotionData()->xRotationRate()); + return createAccelerationObject(imp->deviceMotionData()->acceleration(), exec); } -JSValue JSDeviceMotionEvent::yRotationRate(ExecState* exec) const +JSValue JSDeviceMotionEvent::accelerationIncludingGravity(ExecState* exec) const { DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); - if (!imp->deviceMotionData()->canProvideYRotationRate()) + if (!imp->deviceMotionData()->accelerationIncludingGravity()) return jsNull(); - return jsNumber(exec, imp->deviceMotionData()->yRotationRate()); + return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity(), exec); } -JSValue JSDeviceMotionEvent::zRotationRate(ExecState* exec) const +JSValue JSDeviceMotionEvent::rotationRate(ExecState* exec) const { DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); - if (!imp->deviceMotionData()->canProvideZRotationRate()) + if (!imp->deviceMotionData()->rotationRate()) return jsNull(); - return jsNumber(exec, imp->deviceMotionData()->zRotationRate()); + return createRotationRateObject(imp->deviceMotionData()->rotationRate(), exec); } - + JSValue JSDeviceMotionEvent::interval(ExecState* exec) const { DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); @@ -90,35 +160,30 @@ JSValue JSDeviceMotionEvent::interval(ExecState* exec) const return jsNull(); return jsNumber(exec, imp->deviceMotionData()->interval()); } - + JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState* exec) { const String& type = ustringToString(exec->argument(0).toString(exec)); bool bubbles = exec->argument(1).toBoolean(exec); bool cancelable = exec->argument(2).toBoolean(exec); + // If any of the parameters are null or undefined, mark them as not provided. // Otherwise, use the standard JavaScript conversion. - bool xAccelerationProvided = !exec->argument(3).isUndefinedOrNull(); - double xAcceleration = exec->argument(3).toNumber(exec); - bool yAccelerationProvided = !exec->argument(4).isUndefinedOrNull(); - double yAcceleration = exec->argument(4).toNumber(exec); - bool zAccelerationProvided = !exec->argument(5).isUndefinedOrNull(); - double zAcceleration = exec->argument(5).toNumber(exec); - bool xRotationRateProvided = !exec->argument(6).isUndefinedOrNull(); - double xRotationRate = exec->argument(6).toNumber(exec); - bool yRotationRateProvided = !exec->argument(7).isUndefinedOrNull(); - double yRotationRate = exec->argument(7).toNumber(exec); - bool zRotationRateProvided = !exec->argument(8).isUndefinedOrNull(); - double zRotationRate = exec->argument(8).toNumber(exec); - bool intervalProvided = !exec->argument(9).isUndefinedOrNull(); - double interval = exec->argument(9).toNumber(exec); - RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(xAccelerationProvided, xAcceleration, - yAccelerationProvided, yAcceleration, - zAccelerationProvided, zAcceleration, - xRotationRateProvided, xRotationRate, - yRotationRateProvided, yRotationRate, - zRotationRateProvided, zRotationRate, - intervalProvided, interval); + RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(exec->argument(3), exec); + if (exec->hadException()) + return jsUndefined(); + + RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(exec->argument(4), exec); + if (exec->hadException()) + return jsUndefined(); + + RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(exec->argument(5), exec); + if (exec->hadException()) + return jsUndefined(); + + bool intervalProvided = !exec->argument(6).isUndefinedOrNull(); + double interval = exec->argument(6).toNumber(exec); + RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, intervalProvided, interval); DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl()); imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get()); return jsUndefined(); diff --git a/WebCore/bindings/js/JSDirectoryEntryCustom.cpp b/WebCore/bindings/js/JSDirectoryEntryCustom.cpp index 35a6c32..a0e0455 100644 --- a/WebCore/bindings/js/JSDirectoryEntryCustom.cpp +++ b/WebCore/bindings/js/JSDirectoryEntryCustom.cpp @@ -66,7 +66,7 @@ JSValue JSDirectoryEntry::getFile(ExecState* exec) JSValue jsExclusive = object->get(exec, Identifier(exec, "exclusive")); flags->setExclusive(jsExclusive.toBoolean(exec)); } else - flags = adoptRef(toFlags(exec->argument(1))); + flags = toFlags(exec->argument(1)); if (exec->hadException()) return jsUndefined(); RefPtr<EntryCallback> successCallback; @@ -112,7 +112,7 @@ JSValue JSDirectoryEntry::getDirectory(ExecState* exec) JSValue jsExclusive = object->get(exec, Identifier(exec, "exclusive")); flags->setExclusive(jsExclusive.toBoolean(exec)); } else - flags = adoptRef(toFlags(exec->argument(1))); + flags = toFlags(exec->argument(1)); if (exec->hadException()) return jsUndefined(); RefPtr<EntryCallback> successCallback; diff --git a/WebCore/bindings/js/JSElementCustom.cpp b/WebCore/bindings/js/JSElementCustom.cpp index 8a1df5c..f691620 100644 --- a/WebCore/bindings/js/JSElementCustom.cpp +++ b/WebCore/bindings/js/JSElementCustom.cpp @@ -60,6 +60,7 @@ void JSElement::markChildren(MarkStack& markStack) JSGlobalData& globalData = *Heap::heap(this)->globalData(); markDOMObjectWrapper(markStack, globalData, element->attributeMap()); + markDOMObjectWrapper(markStack, globalData, element->optionalClassList()); markDOMObjectWrapper(markStack, globalData, element->optionalDataset()); if (element->isStyledElement()) diff --git a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp index 1df1af0..ee79a38 100644 --- a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp +++ b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp @@ -58,6 +58,8 @@ JSValue JSInspectorFrontendHost::platform(ExecState* execState) DEFINE_STATIC_LOCAL(const String, platform, ("windows")); #elif OS(LINUX) DEFINE_STATIC_LOCAL(const String, platform, ("linux")); +#elif OS(FREEBSD) + DEFINE_STATIC_LOCAL(const String, platform, ("freebsd")); #else DEFINE_STATIC_LOCAL(const String, platform, ("unknown")); #endif diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp index 9baf809..2e4d536 100644 --- a/WebCore/bindings/js/ScriptFunctionCall.cpp +++ b/WebCore/bindings/js/ScriptFunctionCall.cpp @@ -43,14 +43,7 @@ using namespace JSC; namespace WebCore { -ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name) - : m_exec(thisObject.scriptState()) - , m_thisObject(thisObject) - , m_name(name) -{ -} - -void ScriptFunctionCall::appendArgument(const ScriptObject& argument) +void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument) { if (argument.scriptState() != m_exec) { ASSERT_NOT_REACHED(); @@ -59,74 +52,81 @@ void ScriptFunctionCall::appendArgument(const ScriptObject& argument) m_arguments.append(argument.jsObject()); } -void ScriptFunctionCall::appendArgument(const ScriptString& argument) +void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument) { m_arguments.append(jsString(m_exec, argument.ustring())); } -void ScriptFunctionCall::appendArgument(const ScriptValue& argument) +void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument) { m_arguments.append(argument.jsValue()); } -void ScriptFunctionCall::appendArgument(const String& argument) +void ScriptCallArgumentHandler::appendArgument(const String& argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsString(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(const JSC::UString& argument) +void ScriptCallArgumentHandler::appendArgument(const JSC::UString& argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsString(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(const char* argument) +void ScriptCallArgumentHandler::appendArgument(const char* argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsString(m_exec, UString(argument))); } -void ScriptFunctionCall::appendArgument(JSC::JSValue argument) +void ScriptCallArgumentHandler::appendArgument(JSC::JSValue argument) { m_arguments.append(argument); } -void ScriptFunctionCall::appendArgument(long argument) +void ScriptCallArgumentHandler::appendArgument(long argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsNumber(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(long long argument) +void ScriptCallArgumentHandler::appendArgument(long long argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsNumber(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(unsigned int argument) +void ScriptCallArgumentHandler::appendArgument(unsigned int argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsNumber(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(unsigned long argument) +void ScriptCallArgumentHandler::appendArgument(unsigned long argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsNumber(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(int argument) +void ScriptCallArgumentHandler::appendArgument(int argument) { JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsNumber(m_exec, argument)); } -void ScriptFunctionCall::appendArgument(bool argument) +void ScriptCallArgumentHandler::appendArgument(bool argument) { m_arguments.append(jsBoolean(argument)); } +ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name) + : ScriptCallArgumentHandler(thisObject.scriptState()) + , m_thisObject(thisObject) + , m_name(name) +{ +} + ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) { JSObject* thisObject = m_thisObject.jsObject(); @@ -197,4 +197,36 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept return ScriptObject(m_exec, asObject(result)); } +ScriptCallback::ScriptCallback(ScriptState* state, ScriptValue function) + : ScriptCallArgumentHandler(state) + , m_function(function) +{ +} + +ScriptValue ScriptCallback::call() +{ + bool hadException; + return call(hadException); +} + +ScriptValue ScriptCallback::call(bool& hadException) +{ + JSLock lock(SilenceAssertionsOnly); + + CallData callData; + CallType callType = getCallData(m_function.jsValue(), callData); + if (callType == CallTypeNone) + return ScriptValue(); + + JSValue result = JSC::call(m_exec, m_function.jsValue(), callType, callData, m_function.jsValue(), m_arguments); + hadException = m_exec->hadException(); + + if (hadException) { + reportException(m_exec, m_exec->exception()); + return ScriptValue(); + } + + return ScriptValue(result); +} + } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptFunctionCall.h b/WebCore/bindings/js/ScriptFunctionCall.h index 9742e8f..037a336 100644 --- a/WebCore/bindings/js/ScriptFunctionCall.h +++ b/WebCore/bindings/js/ScriptFunctionCall.h @@ -46,10 +46,9 @@ namespace WebCore { class ScriptValue; class ScriptString; - class ScriptFunctionCall { + class ScriptCallArgumentHandler { public: - ScriptFunctionCall(const ScriptObject& thisObject, const String& name); - virtual ~ScriptFunctionCall() {}; + ScriptCallArgumentHandler(ScriptState* state) : m_exec(state) { } void appendArgument(const ScriptObject&); void appendArgument(const ScriptString&); @@ -64,15 +63,10 @@ namespace WebCore { void appendArgument(unsigned long); void appendArgument(int); void appendArgument(bool); - ScriptValue call(bool& hadException, bool reportExceptions = true); - ScriptValue call(); - ScriptObject construct(bool& hadException, bool reportExceptions = true); protected: - ScriptState* m_exec; - ScriptObject m_thisObject; - String m_name; JSC::MarkedArgumentBuffer m_arguments; + ScriptState* m_exec; private: // MarkedArgumentBuffer must be stack allocated, so prevent heap @@ -81,6 +75,29 @@ namespace WebCore { void* operator new[](size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast<void*>(0xbadbeef); } }; + class ScriptFunctionCall : public ScriptCallArgumentHandler { + public: + ScriptFunctionCall(const ScriptObject& thisObject, const String& name); + ScriptValue call(bool& hadException, bool reportExceptions = true); + ScriptValue call(); + ScriptObject construct(bool& hadException, bool reportExceptions = true); + + protected: + ScriptObject m_thisObject; + String m_name; + }; + + class ScriptCallback : public ScriptCallArgumentHandler { + public: + ScriptCallback(ScriptState*, ScriptValue); + + ScriptValue call(); + ScriptValue call(bool& hadException); + + private: + ScriptValue m_function; + }; + } // namespace WebCore #endif // ScriptFunctionCall diff --git a/WebCore/bindings/objc/ObjCEventListener.h b/WebCore/bindings/objc/ObjCEventListener.h index 434ef45..5a2941f 100644 --- a/WebCore/bindings/objc/ObjCEventListener.h +++ b/WebCore/bindings/objc/ObjCEventListener.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2008, 2010 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 @@ -28,8 +28,8 @@ #define ObjCEventListener_h #include "EventListener.h" - -#include <wtf/PassRefPtr.h> +#include <wtf/Forward.h> +#include <wtf/RetainPtr.h> @protocol DOMEventListener; @@ -37,7 +37,8 @@ namespace WebCore { class ObjCEventListener : public EventListener { public: - static PassRefPtr<ObjCEventListener> wrap(id <DOMEventListener>); + typedef id<DOMEventListener> ObjCListener; + static PassRefPtr<ObjCEventListener> wrap(ObjCListener); static const ObjCEventListener* cast(const EventListener* listener) { @@ -46,17 +47,15 @@ namespace WebCore { : 0; } - virtual bool operator==(const EventListener& other); - private: - static ObjCEventListener* find(id <DOMEventListener>); + static ObjCEventListener* find(ObjCListener); - ObjCEventListener(id <DOMEventListener>); + ObjCEventListener(ObjCListener); virtual ~ObjCEventListener(); - + virtual bool operator==(const EventListener&); virtual void handleEvent(ScriptExecutionContext*, Event*); - id <DOMEventListener> m_listener; + RetainPtr<ObjCListener> m_listener; }; } // namespace WebCore diff --git a/WebCore/bindings/objc/ObjCEventListener.mm b/WebCore/bindings/objc/ObjCEventListener.mm index c1b8aa5..6e2a9fa 100644 --- a/WebCore/bindings/objc/ObjCEventListener.mm +++ b/WebCore/bindings/objc/ObjCEventListener.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 James G. Speth (speth@end.com) * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) * @@ -40,7 +40,7 @@ namespace WebCore { typedef HashMap<id, ObjCEventListener*> ListenerMap; static ListenerMap* listenerMap; -ObjCEventListener* ObjCEventListener::find(id <DOMEventListener> listener) +ObjCEventListener* ObjCEventListener::find(ObjCListener listener) { ListenerMap* map = listenerMap; if (!map) @@ -48,7 +48,7 @@ ObjCEventListener* ObjCEventListener::find(id <DOMEventListener> listener) return map->get(listener); } -PassRefPtr<ObjCEventListener> ObjCEventListener::wrap(id <DOMEventListener> listener) +PassRefPtr<ObjCEventListener> ObjCEventListener::wrap(ObjCListener listener) { RefPtr<ObjCEventListener> wrapper = find(listener); if (wrapper) @@ -56,9 +56,9 @@ PassRefPtr<ObjCEventListener> ObjCEventListener::wrap(id <DOMEventListener> list return adoptRef(new ObjCEventListener(listener)); } -ObjCEventListener::ObjCEventListener(id <DOMEventListener> listener) +ObjCEventListener::ObjCEventListener(ObjCListener listener) : EventListener(ObjCEventListenerType) - , m_listener([listener retain]) + , m_listener(listener) { ListenerMap* map = listenerMap; if (!map) { @@ -70,13 +70,13 @@ ObjCEventListener::ObjCEventListener(id <DOMEventListener> listener) ObjCEventListener::~ObjCEventListener() { - listenerMap->remove(m_listener); - [m_listener release]; + listenerMap->remove(m_listener.get()); } void ObjCEventListener::handleEvent(ScriptExecutionContext*, Event* event) { - [m_listener handleEvent:kit(event)]; + ObjCListener listener = m_listener.get(); + [listener handleEvent:kit(event)]; } bool ObjCEventListener::operator==(const EventListener& listener) diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 1a114a4..803542e 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -240,7 +240,7 @@ sub IndexGetterReturnsStrings { my $type = shift; - return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "CSSVariablesDeclaration" or $type eq "DOMStringList"; + return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "CSSVariablesDeclaration" or $type eq "DOMStringList" or $type eq "DOMTokenList"; return 0; } diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index f74f2b1..3353f0f 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -2510,6 +2510,7 @@ sub HasCustomToV8Implementation { return 1 if $interfaceName eq "CanvasPixelArray"; return 1 if $interfaceName eq "DOMStringMap"; return 1 if $interfaceName eq "DOMWindow"; + return 1 if $interfaceName eq "DOMTokenList"; return 1 if $interfaceName eq "Element"; return 1 if $interfaceName eq "HTMLDocument"; return 1 if $interfaceName eq "HTMLElement"; diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp index fb97d59..e4be0d8 100644 --- a/WebCore/bindings/v8/NPV8Object.cpp +++ b/WebCore/bindings/v8/NPV8Object.cpp @@ -34,6 +34,7 @@ #include "OwnArrayPtr.h" #include "PlatformString.h" #include "ScriptController.h" +#include "UserGestureIndicator.h" #include "V8GCController.h" #include "V8Helpers.h" #include "V8NPUtils.h" @@ -278,8 +279,17 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (!popupsAllowed) filename = "npscript"; + // Set popupsAllowed flag to the current execution frame, so WebKit can get + // right gesture status for popups initiated from plugins. + Frame* frame = proxy->frame(); + ASSERT(frame); + bool oldAllowPopups = frame->script()->allowPopupsFromPlugin(); + frame->script()->setAllowPopupsFromPlugin(popupsAllowed); + String script = String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length); v8::Local<v8::Value> v8result = proxy->evaluate(ScriptSourceCode(script, KURL(ParsedURLString, filename)), 0); + // Restore the old flag. + frame->script()->setAllowPopupsFromPlugin(oldAllowPopups); if (v8result.IsEmpty()) return false; diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index 5023254..8018a18 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -121,6 +121,7 @@ ScriptController::ScriptController(Frame* frame) , m_inExecuteScript(false) , m_processingTimerCallback(false) , m_paused(false) + , m_allowPopupsFromPlugin(false) , m_proxy(new V8Proxy(frame)) #if ENABLE(NETSCAPE_PLUGIN_API) , m_windowScriptNPObject(0) @@ -203,7 +204,8 @@ bool ScriptController::processingUserGesture() // This is the <a href="javascript:window.open('...')> case -> we let it through. return true; } - + if (activeFrame->script()->allowPopupsFromPlugin()) + return true; // This is the <script>window.open(...)</script> case or a timer callback -> block it. // Based on JSC version, use returned value of UserGestureIndicator::processingUserGesture for all other situations. return UserGestureIndicator::processingUserGesture(); diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h index 3bc42ef..8ac9064 100644 --- a/WebCore/bindings/v8/ScriptController.h +++ b/WebCore/bindings/v8/ScriptController.h @@ -193,6 +193,9 @@ public: void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*); static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds); + void setAllowPopupsFromPlugin(bool allowPopupsFromPlugin) { m_allowPopupsFromPlugin = allowPopupsFromPlugin; } + bool allowPopupsFromPlugin() const { return m_allowPopupsFromPlugin; } + private: Frame* m_frame; const String* m_sourceURL; @@ -201,6 +204,7 @@ private: bool m_processingTimerCallback; bool m_paused; + bool m_allowPopupsFromPlugin; OwnPtr<V8Proxy> m_proxy; typedef HashMap<Widget*, NPObject*> PluginObjectMap; diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp index e6b22ee..29dbb02 100644 --- a/WebCore/bindings/v8/ScriptFunctionCall.cpp +++ b/WebCore/bindings/v8/ScriptFunctionCall.cpp @@ -45,14 +45,7 @@ namespace WebCore { -ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name) - : m_scriptState(thisObject.scriptState()) - , m_thisObject(thisObject) - , m_name(name) -{ -} - -void ScriptFunctionCall::appendArgument(const ScriptObject& argument) +void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument) { if (argument.scriptState() != m_scriptState) { ASSERT_NOT_REACHED(); @@ -61,64 +54,71 @@ void ScriptFunctionCall::appendArgument(const ScriptObject& argument) m_arguments.append(argument); } -void ScriptFunctionCall::appendArgument(const ScriptString& argument) +void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8String(argument)); } -void ScriptFunctionCall::appendArgument(const ScriptValue& argument) +void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument) { m_arguments.append(argument); } -void ScriptFunctionCall::appendArgument(const String& argument) +void ScriptCallArgumentHandler::appendArgument(const String& argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8String(argument)); } -void ScriptFunctionCall::appendArgument(const char* argument) +void ScriptCallArgumentHandler::appendArgument(const char* argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8String(argument)); } -void ScriptFunctionCall::appendArgument(long argument) +void ScriptCallArgumentHandler::appendArgument(long argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8::Number::New(argument)); } -void ScriptFunctionCall::appendArgument(long long argument) +void ScriptCallArgumentHandler::appendArgument(long long argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8::Number::New(argument)); } -void ScriptFunctionCall::appendArgument(unsigned int argument) +void ScriptCallArgumentHandler::appendArgument(unsigned int argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8::Number::New(argument)); } -void ScriptFunctionCall::appendArgument(unsigned long argument) +void ScriptCallArgumentHandler::appendArgument(unsigned long argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8::Number::New(argument)); } -void ScriptFunctionCall::appendArgument(int argument) +void ScriptCallArgumentHandler::appendArgument(int argument) { ScriptScope scope(m_scriptState); m_arguments.append(v8::Number::New(argument)); } -void ScriptFunctionCall::appendArgument(bool argument) +void ScriptCallArgumentHandler::appendArgument(bool argument) { m_arguments.append(v8Boolean(argument)); } +ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name) + : ScriptCallArgumentHandler(thisObject.scriptState()) + , m_thisObject(thisObject) + , m_name(name) +{ +} + ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) { ScriptScope scope(m_scriptState, reportExceptions); @@ -179,4 +179,40 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept return ScriptObject(m_scriptState, result); } +ScriptCallback::ScriptCallback(ScriptState* state, ScriptValue function) + : ScriptCallArgumentHandler(state) + , m_function(function) +{ +} + +ScriptValue ScriptCallback::call() +{ + bool hadException = false; + return call(hadException); +} + +ScriptValue ScriptCallback::call(bool& hadException) +{ + ASSERT(v8::Context::InContext()); + ASSERT(m_function.v8Value()->IsFunction()); + + v8::TryCatch exceptionCatcher; + v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global(); + v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(m_function.v8Value()); + + OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]); + for (size_t i = 0; i < m_arguments.size(); ++i) + args[i] = m_arguments[i].v8Value(); + + v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(function, object, m_arguments.size(), args.get()); + + if (exceptionCatcher.HasCaught()) { + hadException = true; + m_scriptState->setException(exceptionCatcher.Exception()); + return ScriptValue(); + } + + return ScriptValue(result); +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h index 4cbbf7e..04dddc8 100644 --- a/WebCore/bindings/v8/ScriptFunctionCall.h +++ b/WebCore/bindings/v8/ScriptFunctionCall.h @@ -41,10 +41,9 @@ namespace WebCore { class ScriptState; class ScriptString; - class ScriptFunctionCall { + class ScriptCallArgumentHandler { public: - ScriptFunctionCall(const ScriptObject& thisObject, const String& name); - virtual ~ScriptFunctionCall() {}; + ScriptCallArgumentHandler(ScriptState* scriptState) : m_scriptState(scriptState) { } void appendArgument(const ScriptObject&); void appendArgument(const ScriptString&); @@ -57,15 +56,33 @@ namespace WebCore { void appendArgument(unsigned long); void appendArgument(int); void appendArgument(bool); + + protected: + ScriptState* m_scriptState; + Vector<ScriptValue> m_arguments; + }; + + class ScriptFunctionCall : public ScriptCallArgumentHandler { + public: + ScriptFunctionCall(const ScriptObject& thisObject, const String& name); ScriptValue call(bool& hadException, bool reportExceptions = true); ScriptValue call(); ScriptObject construct(bool& hadException, bool reportExceptions = true); protected: - ScriptState* m_scriptState; ScriptObject m_thisObject; String m_name; - Vector<ScriptValue> m_arguments; + }; + + class ScriptCallback : public ScriptCallArgumentHandler { + public: + ScriptCallback(ScriptState*, ScriptValue); + + ScriptValue call(); + ScriptValue call(bool& hadException); + + private: + ScriptValue m_function; }; } // namespace WebCore diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp index f0f473d..bea1eb8 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -352,11 +352,18 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob if (extensions[i].group && extensions[i].group != extensionGroup) continue; - // Note: we check the loader URL here instead of the document URL - // because we might be currently loading an URL into a blank page. - // See http://code.google.com/p/chromium/issues/detail?id=10924 - if (extensions[i].scheme.length() > 0 && (extensions[i].scheme != m_frame->loader()->activeDocumentLoader()->url().protocol())) - continue; + if (extensions[i].useCallback) { + // Ensure our date extension is always allowed. + if (extensions[i].extension != DateExtension::get() + && !m_frame->loader()->client()->allowScriptExtension(extensions[i].extension->name(), extensionGroup)) + continue; + } else { + // Note: we check the loader URL here instead of the document URL + // because we might be currently loading an URL into a blank page. + // See http://code.google.com/p/chromium/issues/detail?id=10924 + if (extensions[i].scheme.length() > 0 && (extensions[i].scheme != m_frame->loader()->activeDocumentLoader()->url().protocol())) + continue; + } extensionNames[index++] = extensions[i].extension->name(); } diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 27e09e6..be2be07 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -687,11 +687,7 @@ void V8Proxy::didLeaveScriptContext() // If we've just left a script context and indexed database has been // instantiated, we must let its transaction coordinator know so it can terminate // any not-yet-started transactions. - if (IDBPendingTransactionMonitor::hasPendingTransactions()) { - ASSERT(page->group().hasIDBFactory()); - page->group().idbFactory()->abortPendingTransactions(IDBPendingTransactionMonitor::pendingTransactions()); - IDBPendingTransactionMonitor::clearPendingTransactions(); - } + IDBPendingTransactionMonitor::abortPendingTransactions(); #endif // ENABLE(INDEXED_DATABASE) // If we've just left a top level script context and local storage has been // instantiated, we must ensure that any storage locks have been freed. @@ -876,14 +872,21 @@ bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension) void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction) { registerExtensionWithV8(extension); - V8ExtensionInfo info = {schemeRestriction, 0, extension}; + V8ExtensionInfo info = {schemeRestriction, 0, extension, false}; m_extensions.append(info); } void V8Proxy::registerExtension(v8::Extension* extension, int extensionGroup) { registerExtensionWithV8(extension); - V8ExtensionInfo info = {String(), extensionGroup, extension}; + V8ExtensionInfo info = {String(), extensionGroup, extension, false}; + m_extensions.append(info); +} + +void V8Proxy::registerExtension(v8::Extension* extension) +{ + registerExtensionWithV8(extension); + V8ExtensionInfo info = {String(), 0, extension, true}; m_extensions.append(info); } diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h index 4d2404f..169883b 100644 --- a/WebCore/bindings/v8/V8Proxy.h +++ b/WebCore/bindings/v8/V8Proxy.h @@ -128,6 +128,7 @@ namespace WebCore { String scheme; int group; v8::Extension* extension; + bool useCallback; // FIXME: remove }; typedef WTF::Vector<V8ExtensionInfo> V8Extensions; @@ -337,6 +338,11 @@ namespace WebCore { static void registerExtension(v8::Extension*, const String& schemeRestriction); static void registerExtension(v8::Extension*, int extensionGroup); + // Same as above, but new version. + // FIXME: remove the other 2 versions in phase 3 of multipart checkin: + // https://bugs.webkit.org/show_bug.cgi?id=45721 + static void registerExtension(v8::Extension*); + static void registerExtensionWithV8(v8::Extension*); static bool registeredExtensionWithV8(v8::Extension*); diff --git a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp index 69742f8..d85d7a0 100644 --- a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp @@ -101,7 +101,7 @@ v8::Handle<v8::Value> V8Clipboard::setDragImageCallback(const v8::Arguments& arg INC_STATS("DOM.Clipboard.setDragImage()"); Clipboard* clipboard = V8Clipboard::toNative(args.Holder()); - if (!clipboard->isForDragging()) + if (!clipboard->isForDragAndDrop()) return v8::Undefined(); if (args.Length() != 3) diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp index 25e7e0d..11f309b 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp @@ -66,6 +66,7 @@ void V8CustomVoidCallback::handleEvent() bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext) { v8::TryCatch exceptionCatcher; + exceptionCatcher.SetVerbose(true); v8::Local<v8::Function> callbackFunction; if (callback->IsFunction()) { @@ -84,14 +85,7 @@ bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8 v8::Handle<v8::Value> result = callbackFunction->Call(thisObject, argc, argv); callbackReturnValue = !result.IsEmpty() && result->BooleanValue(); - - if (exceptionCatcher.HasCaught()) { - v8::Local<v8::Message> message = exceptionCatcher.Message(); - scriptExecutionContext->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName())); - return true; - } - - return false; + return exceptionCatcher.HasCaught(); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp b/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp index c8a975b..71ff357 100644 --- a/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp @@ -34,6 +34,7 @@ #include "DOMStringMap.h" #include "V8Binding.h" #include "V8DOMWrapper.h" +#include "V8Element.h" namespace WebCore { @@ -101,8 +102,11 @@ v8::Handle<v8::Value> toV8(DOMStringMap* impl) v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl); // Add a hidden reference from the element to the DOMStringMap. Element* element = impl->element(); - if (!wrapper.IsEmpty() && element) - V8DOMWrapper::setHiddenWindowReference(element->document()->frame(), wrapper); + if (!wrapper.IsEmpty() && element) { + v8::Handle<v8::Value> elementValue = toV8(element); + if (!elementValue.IsEmpty() && elementValue->IsObject()) + V8DOMWrapper::setHiddenReference(elementValue.As<v8::Object>(), wrapper); + } return wrapper; } diff --git a/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp b/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp new file mode 100644 index 0000000..171ff5c --- /dev/null +++ b/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "V8DOMTokenList.h" + +#include "DOMTokenList.h" +#include "V8Binding.h" +#include "V8DOMWrapper.h" +#include "V8Element.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(DOMTokenList* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8DOMTokenList::wrap(impl); + // Add a hidden reference from the element to the DOMTokenList. + Element* element = impl->element(); + if (!wrapper.IsEmpty() && element) { + v8::Handle<v8::Value> elementValue = toV8(element); + if (!elementValue.IsEmpty() && elementValue->IsObject()) + V8DOMWrapper::setHiddenReference(elementValue.As<v8::Object>(), wrapper); + } + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp index 67f27c5..f7a03f9 100644 --- a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp @@ -37,67 +37,122 @@ namespace WebCore { -v8::Handle<v8::Value> V8DeviceMotionEvent::xAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +namespace { + +v8::Handle<v8::Value> createAccelerationObject(const DeviceMotionData::Acceleration* acceleration) { - INC_STATS("DOM.DeviceMotionEvent.xAcceleration._get"); - v8::Handle<v8::Object> holder = info.Holder(); - DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); - if (!imp->deviceMotionData()->canProvideXAcceleration()) - return v8::Null(); - return v8::Number::New(imp->deviceMotionData()->xAcceleration()); + v8::Local<v8::Object> object = v8::Object::New(); + object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null()); + object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null()); + object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null()); + return object; } -v8::Handle<v8::Value> V8DeviceMotionEvent::yAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +v8::Handle<v8::Value> createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate) { - INC_STATS("DOM.DeviceMotionEvent.yAcceleration._get"); - v8::Handle<v8::Object> holder = info.Holder(); - DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); - if (!imp->deviceMotionData()->canProvideYAcceleration()) - return v8::Null(); - return v8::Number::New(imp->deviceMotionData()->yAcceleration()); + v8::Local<v8::Object> object = v8::Object::New(); + object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null()); + object->Set(v8::String::New("beta"), rotationRate->canProvideBeta() ? v8::Number::New(rotationRate->beta()) : v8::Null()); + object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null()); + return object; } -v8::Handle<v8::Value> V8DeviceMotionEvent::zAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +RefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(v8::Local<v8::Value> value) { - INC_STATS("DOM.DeviceMotionEvent.zAcceleration._get"); - v8::Handle<v8::Object> holder = info.Holder(); - DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); - if (!imp->deviceMotionData()->canProvideZAcceleration()) - return v8::Null(); - return v8::Number::New(imp->deviceMotionData()->zAcceleration()); + if (isUndefinedOrNull(value)) + return 0; + + // Given the test above, this will always yield an object. + v8::Local<v8::Object> object = value->ToObject(); + + v8::Local<v8::Value> xValue = object->Get(v8::String::New("x")); + if (xValue.IsEmpty()) + return 0; + bool canProvideX = !isUndefinedOrNull(xValue); + double x = xValue->NumberValue(); + + v8::Local<v8::Value> yValue = object->Get(v8::String::New("y")); + if (yValue.IsEmpty()) + return 0; + bool canProvideY = !isUndefinedOrNull(yValue); + double y = yValue->NumberValue(); + + v8::Local<v8::Value> zValue = object->Get(v8::String::New("z")); + if (zValue.IsEmpty()) + return 0; + bool canProvideZ = !isUndefinedOrNull(zValue); + double z = zValue->NumberValue(); + + if (!canProvideX && !canProvideY && !canProvideZ) + return 0; + + return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z); } -v8::Handle<v8::Value> V8DeviceMotionEvent::xRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +RefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(v8::Local<v8::Value> value) { - INC_STATS("DOM.DeviceMotionEvent.xRotationRate._get"); + if (isUndefinedOrNull(value)) + return 0; + + // Given the test above, this will always yield an object. + v8::Local<v8::Object> object = value->ToObject(); + + v8::Local<v8::Value> alphaValue = object->Get(v8::String::New("alpha")); + if (alphaValue.IsEmpty()) + return 0; + bool canProvideAlpha = !isUndefinedOrNull(alphaValue); + double alpha = alphaValue->NumberValue(); + + v8::Local<v8::Value> betaValue = object->Get(v8::String::New("beta")); + if (betaValue.IsEmpty()) + return 0; + bool canProvideBeta = !isUndefinedOrNull(betaValue); + double beta = betaValue->NumberValue(); + + v8::Local<v8::Value> gammaValue = object->Get(v8::String::New("gamma")); + if (gammaValue.IsEmpty()) + return 0; + bool canProvideGamma = !isUndefinedOrNull(gammaValue); + double gamma = gammaValue->NumberValue(); + + if (!canProvideAlpha && !canProvideBeta && !canProvideGamma) + return 0; + + return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); +} + +} // namespace + +v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.DeviceMotionEvent.acceleration._get"); v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); - if (!imp->deviceMotionData()->canProvideXRotationRate()) + if (!imp->deviceMotionData()->acceleration()) return v8::Null(); - return v8::Number::New(imp->deviceMotionData()->xRotationRate()); + return createAccelerationObject(imp->deviceMotionData()->acceleration()); } -v8::Handle<v8::Value> V8DeviceMotionEvent::yRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.DeviceMotionEvent.yRotationRate._get"); + INC_STATS("DOM.DeviceMotionEvent.accelerationIncludingGravity._get"); v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); - if (!imp->deviceMotionData()->canProvideYRotationRate()) + if (!imp->deviceMotionData()->accelerationIncludingGravity()) return v8::Null(); - return v8::Number::New(imp->deviceMotionData()->yRotationRate()); + return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity()); } -v8::Handle<v8::Value> V8DeviceMotionEvent::zRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +v8::Handle<v8::Value> V8DeviceMotionEvent::rotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.DeviceMotionEvent.zRotationRate._get"); + INC_STATS("DOM.DeviceMotionEvent.rotationRate._get"); v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); - if (!imp->deviceMotionData()->canProvideZRotationRate()) + if (!imp->deviceMotionData()->rotationRate()) return v8::Null(); - return v8::Number::New(imp->deviceMotionData()->zRotationRate()); + return createRotationRateObject(imp->deviceMotionData()->rotationRate()); } - v8::Handle<v8::Value> V8DeviceMotionEvent::intervalAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.DeviceMotionEvent.interval._get"); @@ -114,23 +169,12 @@ v8::Handle<v8::Value> V8DeviceMotionEvent::initDeviceMotionEventCallback(const v STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, args[0]); bool bubbles = args[1]->BooleanValue(); bool cancelable = args[2]->BooleanValue(); - // If any of the parameters are null or undefined, mark them as not provided. - // Otherwise, use the standard JavaScript conversion. - bool xAccelerationProvided = !isUndefinedOrNull(args[3]); - double xAcceleration = static_cast<double>(args[3]->NumberValue()); - bool yAccelerationProvided = !isUndefinedOrNull(args[4]); - double yAcceleration = static_cast<double>(args[4]->NumberValue()); - bool zAccelerationProvided = !isUndefinedOrNull(args[5]); - double zAcceleration = static_cast<double>(args[5]->NumberValue()); - bool xRotationRateProvided = !isUndefinedOrNull(args[6]); - double xRotationRate = static_cast<double>(args[6]->NumberValue()); - bool yRotationRateProvided = !isUndefinedOrNull(args[7]); - double yRotationRate = static_cast<double>(args[7]->NumberValue()); - bool zRotationRateProvided = !isUndefinedOrNull(args[8]); - double zRotationRate = static_cast<double>(args[8]->NumberValue()); - bool intervalProvided = !isUndefinedOrNull(args[9]); - double interval = static_cast<double>(args[9]->NumberValue()); - RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(xAccelerationProvided, xAcceleration, yAccelerationProvided, yAcceleration, zAccelerationProvided, zAcceleration, xRotationRateProvided, xRotationRate, yRotationRateProvided, yRotationRate, zRotationRateProvided, zRotationRate, intervalProvided, interval); + RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(args[3]); + RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(args[4]); + RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(args[5]); + bool intervalProvided = !isUndefinedOrNull(args[6]); + double interval = args[6]->NumberValue(); + RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, intervalProvided, interval); imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get()); return v8::Handle<v8::Value>(); } diff --git a/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp b/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp index 72f759a..ce8eaf3 100644 --- a/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp @@ -76,11 +76,11 @@ v8::Handle<v8::Value> V8DeviceOrientationEvent::initDeviceOrientationEventCallba // If alpha, beta or gamma are null or undefined, mark them as not provided. // Otherwise, use the standard JavaScript conversion. bool alphaProvided = !isUndefinedOrNull(args[3]); - double alpha = static_cast<double>(args[3]->NumberValue()); + double alpha = args[3]->NumberValue(); bool betaProvided = !isUndefinedOrNull(args[4]); - double beta = static_cast<double>(args[4]->NumberValue()); + double beta = args[4]->NumberValue(); bool gammaProvided = !isUndefinedOrNull(args[5]); - double gamma = static_cast<double>(args[5]->NumberValue()); + double gamma = args[5]->NumberValue(); RefPtr<DeviceOrientation> orientation = DeviceOrientation::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma); imp->initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get()); return v8::Handle<v8::Value>(); diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp index 286b154..fc8cf98 100644 --- a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp @@ -71,7 +71,7 @@ v8::Handle<v8::Value> V8DirectoryEntry::getDirectoryCallback(const v8::Arguments } } else { EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); - flags = adoptRef(tmp_flags); + flags = tmp_flags; } RefPtr<EntryCallback> successCallback; if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) { @@ -114,7 +114,7 @@ v8::Handle<v8::Value> V8DirectoryEntry::getFileCallback(const v8::Arguments& arg } } else { EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); - flags = adoptRef(tmp_flags); + flags = tmp_flags; } RefPtr<EntryCallback> successCallback; if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) { diff --git a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp index 25b9010..94fa86e 100644 --- a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp @@ -47,6 +47,8 @@ v8::Handle<v8::Value> V8InspectorFrontendHost::platformCallback(const v8::Argume return v8String("mac"); #elif defined(OS_LINUX) return v8String("linux"); +#elif defined(OS_FREEBSD) + return v8String("freebsd"); #elif defined(OS_WIN) return v8String("windows"); #else diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index cfeb503..2355d2a 100644 --- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -32,6 +32,7 @@ #include "V8XMLHttpRequest.h" #include "Frame.h" +#include "InspectorController.h" #include "V8Binding.h" #include "V8Blob.h" #include "V8DOMFormData.h" @@ -113,6 +114,8 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args) INC_STATS("DOM.XMLHttpRequest.send()"); XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder()); + InspectorController::instrumentWillSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url()); + ExceptionCode ec = 0; if (args.Length() < 1) xmlHttpRequest->send(ec); diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index 7e590ff..b1e8fcd 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -381,6 +381,7 @@ typedef enum { , NPPVpluginCoreAnimationLayer = 1003 #endif +<<<<<<< HEAD #ifdef ANDROID /* Used when the plugin returns 0 from NPN_WriteReady and wishes the browser * to wait a certain amount of millis before calling NPN_WriteReady again. @@ -392,6 +393,9 @@ typedef enum { #endif #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +======= +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) +>>>>>>> webkit.org at r68651 , NPPVpluginWindowlessLocalBool = 2002 #endif } NPPVariable; @@ -437,12 +441,16 @@ typedef enum { #endif , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ #endif /* XP_MACOSX */ +<<<<<<< HEAD #ifdef ANDROID , NPNFakeValueToForce32Bits = 0x7FFFFFFF #endif #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +======= +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) +>>>>>>> webkit.org at r68651 , NPNVSupportsWindowlessLocal = 2002 #endif } NPNVariable; diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 6c56458..989d9eb 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -27,7 +27,6 @@ #import "objc_instance.h" #import "runtime_method.h" -#import "FoundationExtras.h" #import "ObjCRuntimeObject.h" #import "WebScriptObject.h" #import <objc/objc-auto.h> @@ -70,9 +69,9 @@ RuntimeObject* ObjcInstance::newRuntimeObject(ExecState* exec) void ObjcInstance::setGlobalException(NSString* exception, JSGlobalObject* exceptionEnvironment) { - HardRelease(s_exception); - HardRetain(exception); - s_exception = exception; + NSString *oldException = s_exception; + s_exception = [exception copy]; + [oldException release]; s_exceptionEnvironment = exceptionEnvironment; } @@ -89,9 +88,8 @@ void ObjcInstance::moveGlobalExceptionToExecState(ExecState* exec) throwError(exec, s_exception); } - HardRelease(s_exception); - s_exception = 0; - + [s_exception release]; + s_exception = nil; s_exceptionEnvironment = 0; } diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index 3746464..1d574ab 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -196,8 +196,8 @@ static const int computedProperties[] = { CSSPropertyWebkitHighlight, CSSPropertyWebkitLineBreak, CSSPropertyWebkitLineClamp, - CSSPropertyWebkitMarginBottomCollapse, - CSSPropertyWebkitMarginTopCollapse, + CSSPropertyWebkitMarginBeforeCollapse, + CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement, CSSPropertyWebkitMarqueeRepetition, @@ -1416,10 +1416,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitFontSizeDelta: // Not a real style property -- used by the editing engine -- so has no computed value. break; - case CSSPropertyWebkitMarginBottomCollapse: - return CSSPrimitiveValue::create(style->marginBottomCollapse()); - case CSSPropertyWebkitMarginTopCollapse: - return CSSPrimitiveValue::create(style->marginTopCollapse()); + case CSSPropertyWebkitMarginAfterCollapse: + return CSSPrimitiveValue::create(style->marginAfterCollapse()); + case CSSPropertyWebkitMarginBeforeCollapse: + return CSSPrimitiveValue::create(style->marginBeforeCollapse()); case CSSPropertyWebkitPerspective: if (!style->hasPerspective()) return CSSPrimitiveValue::createIdentifier(CSSValueNone); diff --git a/WebCore/css/CSSPageRule.idl b/WebCore/css/CSSPageRule.idl index 6b50b6d..989fd8d 100644 --- a/WebCore/css/CSSPageRule.idl +++ b/WebCore/css/CSSPageRule.idl @@ -23,8 +23,7 @@ module css { // Introduced in DOM Level 2: interface CSSPageRule : CSSRule { - attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText - setter raises(DOMException); + attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText; readonly attribute CSSStyleDeclaration style; diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 502bc77..5f3fb7d 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -62,6 +62,7 @@ #include "FloatConversion.h" #include "FontFamilyValue.h" #include "FontValue.h" +#include "HashTools.h" #include "MediaList.h" #include "MediaQueryExp.h" #include "Pair.h" @@ -89,6 +90,7 @@ extern int cssyyparse(void* parser); using namespace std; using namespace WTF; +<<<<<<< HEAD #include "CSSPropertyNames.cpp" #include "CSSValueKeywords.cpp" @@ -96,6 +98,8 @@ using namespace WTF; #include "TimeCounter.h" #endif +======= +>>>>>>> webkit.org at r68651 namespace WebCore { static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; @@ -1488,8 +1492,8 @@ bool CSSParser::parseValue(int propId, bool important) return false; } case CSSPropertyWebkitMarginCollapse: { - const int properties[2] = { CSSPropertyWebkitMarginTopCollapse, - CSSPropertyWebkitMarginBottomCollapse }; + const int properties[2] = { CSSPropertyWebkitMarginBeforeCollapse, + CSSPropertyWebkitMarginAfterCollapse }; if (num == 1) { ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse); if (!parseValue(properties[0], important)) @@ -1506,6 +1510,8 @@ bool CSSParser::parseValue(int propId, bool important) } return false; } + case CSSPropertyWebkitMarginBeforeCollapse: + case CSSPropertyWebkitMarginAfterCollapse: case CSSPropertyWebkitMarginTopCollapse: case CSSPropertyWebkitMarginBottomCollapse: if (id == CSSValueCollapse || id == CSSValueSeparate || id == CSSValueDiscard) diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index a452733..14afdf6 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -352,7 +352,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) break; case InputSpeechButtonPart: #if ENABLE(INPUT_SPEECH) - m_value.ident = CSSValueInputSpeechButton; + m_value.ident = CSSValueWebkitInputSpeechButton; #endif break; } diff --git a/WebCore/css/CSSPropertyLonghand.cpp b/WebCore/css/CSSPropertyLonghand.cpp index a4b3325..acca036 100644 --- a/WebCore/css/CSSPropertyLonghand.cpp +++ b/WebCore/css/CSSPropertyLonghand.cpp @@ -98,7 +98,7 @@ static void initShorthandMap(ShorthandMap& shorthandMap) }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyMargin, marginProperties); - static const int marginCollapseProperties[] = { CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBottomCollapse }; + static const int marginCollapseProperties[] = { CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginAfterCollapse }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitMarginCollapse, marginCollapseProperties); static const int marqueeProperties[] = { diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in index addecca..8584e5f 100644 --- a/WebCore/css/CSSPropertyNames.in +++ b/WebCore/css/CSSPropertyNames.in @@ -232,13 +232,15 @@ z-index -webkit-line-clamp -webkit-logical-width -webkit-logical-height +-webkit-margin-after-collapse +-webkit-margin-before-collapse -webkit-margin-bottom-collapse +-webkit-margin-top-collapse -webkit-margin-collapse -webkit-margin-after -webkit-margin-before -webkit-margin-end -webkit-margin-start --webkit-margin-top-collapse -webkit-marquee -webkit-marquee-direction -webkit-marquee-increment diff --git a/WebCore/css/CSSStyleRule.cpp b/WebCore/css/CSSStyleRule.cpp index 1036e8f..faf60b0 100644 --- a/WebCore/css/CSSStyleRule.cpp +++ b/WebCore/css/CSSStyleRule.cpp @@ -23,7 +23,11 @@ #include "CSSStyleRule.h" #include "CSSMutableStyleDeclaration.h" +#include "CSSParser.h" #include "CSSSelector.h" +#include "CSSStyleSheet.h" +#include "Document.h" +#include "StyleSheet.h" namespace WebCore { @@ -50,9 +54,34 @@ String CSSStyleRule::selectorText() const return str; } -void CSSStyleRule::setSelectorText(const String& /*selectorText*/, ExceptionCode& /*ec*/) +void CSSStyleRule::setSelectorText(const String& selectorText) { - // FIXME: Implement! + Document* doc = 0; + StyleSheet* ownerStyleSheet = m_style->stylesheet(); + if (ownerStyleSheet) { + if (ownerStyleSheet->isCSSStyleSheet()) + doc = static_cast<CSSStyleSheet*>(ownerStyleSheet)->document(); + if (!doc) + doc = ownerStyleSheet->ownerNode() ? ownerStyleSheet->ownerNode()->document() : 0; + } + if (!doc) + doc = m_style->node() ? m_style->node()->document() : 0; + + if (!doc) + return; + + CSSParser p; + CSSSelectorList selectorList; + p.parseSelector(selectorText, doc, selectorList); + if (!selectorList.first()) + return; + + String oldSelectorText = this->selectorText(); + m_selectorList.adopt(selectorList); + if (this->selectorText() == oldSelectorText) + return; + + doc->styleSelectorChanged(DeferRecalcStyle); } String CSSStyleRule::cssText() const diff --git a/WebCore/css/CSSStyleRule.h b/WebCore/css/CSSStyleRule.h index d797c73..171b636 100644 --- a/WebCore/css/CSSStyleRule.h +++ b/WebCore/css/CSSStyleRule.h @@ -41,7 +41,7 @@ public: virtual ~CSSStyleRule(); virtual String selectorText() const; - void setSelectorText(const String&, ExceptionCode&); + void setSelectorText(const String&); CSSMutableStyleDeclaration* style() const { return m_style.get(); } diff --git a/WebCore/css/CSSStyleRule.idl b/WebCore/css/CSSStyleRule.idl index 862acd8..4abfbfc 100644 --- a/WebCore/css/CSSStyleRule.idl +++ b/WebCore/css/CSSStyleRule.idl @@ -23,8 +23,7 @@ module css { // Introduced in DOM Level 2: interface CSSStyleRule : CSSRule { - attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText - setter raises(DOMException); + attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText; readonly attribute CSSStyleDeclaration style; diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 9b51fdb..bf95877 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -1106,6 +1106,10 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document) documentStyle->setVisuallyOrdered(document->visuallyOrdered()); documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1); + Element* docElement = document->documentElement(); + if (docElement && docElement->renderer()) + documentStyle->setBlockFlow(docElement->renderer()->style()->blockFlow()); + FontDescription fontDescription; fontDescription.setUsePrinterFont(document->printing()); if (Settings* settings = document->settings()) { @@ -1344,7 +1348,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl updateFont(); // Clean up our style object's display and text decorations (among other fixups). - adjustRenderStyle(style(), e); + adjustRenderStyle(style(), m_parentStyle, e); // Start loading images referenced by this style. loadPendingImages(); @@ -1562,7 +1566,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, updateFont(); // Clean up our style object's display and text decorations (among other fixups). - adjustRenderStyle(style(), 0); + adjustRenderStyle(style(), parentStyle, 0); // Start loading images referenced by this style. loadPendingImages(); @@ -1646,7 +1650,7 @@ static void addIntrinsicMargins(RenderStyle* style) } } -void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e) +void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) { // Cache our original display. style->setOriginalDisplay(style->display()); @@ -1716,6 +1720,11 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e) style->setDisplay(BLOCK); } + // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely + // clear how that should work. + if (style->display() == INLINE && style->styleType() == NOPSEUDO && parentStyle && style->blockFlow() != parentStyle->blockFlow()) + style->setDisplay(INLINE_BLOCK); + // After performing the display mutation, check table rows. We do not honor position:relative on // table rows or cells. This has been established in CSS2.1 (and caused a crash in containingBlock() // on some sites). @@ -1723,6 +1732,16 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e) style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_CELL) && style->position() == RelativePosition) style->setPosition(StaticPosition); + + // FIXME: Since we don't support block-flow on either tables or flexible boxes yet, disallow setting + // of block-flow to anything other than TopToBottomBlockFlow. + // https://bugs.webkit.org/show_bug.cgi?id=46417 - Tables support + // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support. + if (style->blockFlow() != TopToBottomBlockFlow && (style->display() == TABLE || style->display() == INLINE_TABLE + || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP + || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_CELL + || style->display() == BOX || style->display() == INLINE_BOX)) + style->setBlockFlow(TopToBottomBlockFlow); } // Make sure our z-index value is only applied if the object is positioned. @@ -5139,21 +5158,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } case CSSPropertyWebkitMarginCollapse: { if (isInherit) { - m_style->setMarginTopCollapse(m_parentStyle->marginTopCollapse()); - m_style->setMarginBottomCollapse(m_parentStyle->marginBottomCollapse()); + m_style->setMarginBeforeCollapse(m_parentStyle->marginBeforeCollapse()); + m_style->setMarginAfterCollapse(m_parentStyle->marginAfterCollapse()); } else if (isInitial) { - m_style->setMarginTopCollapse(MCOLLAPSE); - m_style->setMarginBottomCollapse(MCOLLAPSE); + m_style->setMarginBeforeCollapse(MCOLLAPSE); + m_style->setMarginAfterCollapse(MCOLLAPSE); } return; } + case CSSPropertyWebkitMarginBeforeCollapse: case CSSPropertyWebkitMarginTopCollapse: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginTopCollapse, MarginTopCollapse) + HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginBeforeCollapse, MarginBeforeCollapse) return; + case CSSPropertyWebkitMarginAfterCollapse: case CSSPropertyWebkitMarginBottomCollapse: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginBottomCollapse, MarginBottomCollapse) + HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginAfterCollapse, MarginAfterCollapse) return; case CSSPropertyWebkitLineClamp: { HANDLE_INHERIT_AND_INITIAL(lineClamp, LineClamp) diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index b77f23c..2bca2f4 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -181,7 +181,7 @@ public: void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle); void checkForTextSizeAdjust(); - void adjustRenderStyle(RenderStyle*, Element*); + void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*); void addMatchedRule(CSSRuleData* rule) { m_matchedRules.append(rule); } void addMatchedDeclaration(CSSMutableStyleDeclaration* decl); diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index 990bb36..556d0bc 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -568,7 +568,7 @@ button button-bevel default-button inner-spin-button -input-speech-button +-webkit-input-speech-button list-button listbox listitem diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp index b8cc4f7..5ddaf99 100644 --- a/WebCore/css/SVGCSSStyleSelector.cpp +++ b/WebCore/css/SVGCSSStyleSelector.cpp @@ -48,15 +48,17 @@ #define HANDLE_INHERIT(prop, Prop) \ if (isInherit) \ -{\ - svgstyle->set##Prop(m_parentStyle->svgStyle()->prop());\ - return;\ +{ \ + svgstyle->set##Prop(m_parentStyle->svgStyle()->prop()); \ + return; \ } #define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \ HANDLE_INHERIT(prop, Prop) \ -else if (isInitial) \ - svgstyle->set##Prop(SVGRenderStyle::initial##Prop()); +if (isInitial) { \ + svgstyle->set##Prop(SVGRenderStyle::initial##Prop()); \ + return; \ +} namespace WebCore { @@ -90,15 +92,13 @@ static int angleToGlyphOrientation(float angle) return -1; } -static Color colorFromSVGColorCSSValue(CSSValue* value, const Color& fgColor) +static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor) { - ASSERT(value->isSVGColor()); - SVGColor* c = static_cast<SVGColor*>(value); Color color; - if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) + if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) color = fgColor; else - color = c->color(); + color = svgColor->color(); return color; } @@ -468,13 +468,15 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) case CSSPropertyStopColor: { HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor); - svgstyle->setStopColor(colorFromSVGColorCSSValue(value, m_style->color())); + if (value->isSVGColor()) + svgstyle->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), m_style->color())); break; } case CSSPropertyLightingColor: { HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor); - svgstyle->setLightingColor(colorFromSVGColorCSSValue(value, m_style->color())); + if (value->isSVGColor()) + svgstyle->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), m_style->color())); break; } case CSSPropertyFloodOpacity: @@ -497,11 +499,9 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) } case CSSPropertyFloodColor: { - if (isInitial) { - svgstyle->setFloodColor(SVGRenderStyle::initialFloodColor()); - return; - } - svgstyle->setFloodColor(colorFromSVGColorCSSValue(value, m_style->color())); + HANDLE_INHERIT_AND_INITIAL(floodColor, FloodColor); + if (value->isSVGColor()) + svgstyle->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), m_style->color())); break; } case CSSPropertyGlyphOrientationHorizontal: diff --git a/WebCore/css/html.css b/WebCore/css/html.css index d65acb0..5399c1c 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -301,6 +301,11 @@ button { -webkit-appearance: button; } +/* Form controls don't go vertical. */ +input, textarea, keygen, select, button, isindex, meter, progress { + -webkit-block-flow: tb !important; +} + input, textarea, keygen, select, button, isindex, datagrid { margin: 0__qem; font: -webkit-small-control; @@ -373,7 +378,7 @@ input::-webkit-outer-spin-button { } input::-webkit-input-speech-button { - -webkit-appearance: input-speech-button; + -webkit-appearance: -webkit-input-speech-button; display: inline-block; } diff --git a/WebCore/css/makeprop.pl b/WebCore/css/makeprop.pl index 8810e8d..64f5a6b 100644 --- a/WebCore/css/makeprop.pl +++ b/WebCore/css/makeprop.pl @@ -41,15 +41,14 @@ print GPERF << "EOF"; #include \"CSSPropertyNames.h\" %} %struct-type -struct Property { - const char* name; - int id; -}; -%language=ANSI-C +struct Property; +%omit-struct-type +%language=C++ %readonly-tables %global-table %compare-strncmp -%define lookup-function-name findProperty +%define class-name CSSPropertyNamesHash +%define lookup-function-name findPropertyImpl %define hash-function-name propery_hash_function %define word-array-name property_wordlist %includes @@ -72,6 +71,10 @@ print HEADER << "EOF"; #ifndef CSSPropertyNames_h #define CSSPropertyNames_h +#include <string.h> + +namespace WebCore { + enum CSSPropertyID { CSSPropertyInvalid = 0, EOF @@ -105,17 +108,41 @@ print HEADER << "EOF"; const char* getPropertyName(CSSPropertyID); +} // namespace WebCore + #endif // CSSPropertyNames_h EOF close HEADER; -system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?"; +system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNamesHash.h") == 0 || die "calling gperf failed: $?"; -open C, ">>CSSPropertyNames.cpp" || die "Could not open CSSPropertyNames.cpp for writing"; +open C, ">>CSSPropertyNamesHash.h" || die "Could not open CSSPropertyNamesHash.h for writing"; print C << "EOF"; +EOF + +close C; + +my $propertyNamesImpl = "CSSPropertyNames.cpp"; + +open PROPERTYNAMES, ">$propertyNamesImpl" || die "Could not open $propertyNamesImpl for writing"; +print PROPERTYNAMES << "EOF"; +/* This file is automatically generated by make-hash-tools.pl, do not edit */ + + +#include "CSSPropertyNames.h" +#include "HashTools.h" + +namespace WebCore { +#include "CSSPropertyNamesHash.h" + +const Property* findProperty (register const char* str, register unsigned int len) +{ + return CSSPropertyNamesHash::findPropertyImpl(str, len); +} + const char* getPropertyName(CSSPropertyID id) { if (id < firstCSSProperty) @@ -125,7 +152,10 @@ const char* getPropertyName(CSSPropertyID id) return 0; return propertyNameStrings[index]; } + +} // namespace WebCore + EOF -close C; +close PROPERTYNAMES; diff --git a/WebCore/css/makevalues.pl b/WebCore/css/makevalues.pl index 421e470..c9f7f70 100644 --- a/WebCore/css/makevalues.pl +++ b/WebCore/css/makevalues.pl @@ -42,14 +42,13 @@ print GPERF << "EOF"; #include \"CSSValueKeywords.h\" %} %struct-type -struct Value { - const char* name; - int id; -}; -%language=ANSI-C +struct Value; +%omit-struct-type +%language=C++ %readonly-tables %compare-strncmp -%define lookup-function-name findValue +%define class-name CSSValueKeywordsHash +%define lookup-function-name findValueImpl %define hash-function-name value_hash_function %define word-array-name value_word_list %includes @@ -72,6 +71,10 @@ print HEADER << "EOF"; #ifndef CSSValueKeywords_h #define CSSValueKeywords_h +#include <string.h> + +namespace WebCore { + const int CSSValueInvalid = 0; EOF @@ -92,13 +95,16 @@ print HEADER << "EOF"; const char* getValueName(unsigned short id); +} // namespace WebCore + #endif // CSSValueKeywords_h + EOF close HEADER; -system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?"; +system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywordsHash.h") == 0 || die "calling gperf failed: $?"; -open C, ">>CSSValueKeywords.cpp" || die "Could not open CSSValueKeywords.cpp for writing"; +open C, ">>CSSValueKeywordsHash.h" || die "Could not open CSSValueKeywordsHash.h for writing"; print C "static const char * const valueList[] = {\n"; print C "\"\",\n"; foreach my $name (@names) { @@ -107,12 +113,38 @@ foreach my $name (@names) { print C << "EOF"; 0 }; + +EOF + +close C; + +my $valueKeywordsImpl = "CSSValueKeywords.cpp"; + +open VALUEKEYWORDS, ">$valueKeywordsImpl" || die "Could not open $valueKeywordsImpl for writing"; +print VALUEKEYWORDS << "EOF"; +/* This file is automatically generated by make-hash-tools.pl, do not edit */ + +#include "CSSValueKeywords.h" +#include "HashTools.h" + +namespace WebCore { +#include "CSSValueKeywordsHash.h" + +const Value* findValue (register const char* str, register unsigned int len) +{ + return CSSValueKeywordsHash::findValueImpl(str, len); +} + const char* getValueName(unsigned short id) { if (id >= numCSSValueKeywords || id <= 0) return 0; return valueList[id]; } + +} // namespace WebCore + EOF -close C; +close VALUEKEYWORDS; + diff --git a/WebCore/css/themeQtMaemo5.css b/WebCore/css/themeQtMobile.css index c568d5d..ef2d182 100644 --- a/WebCore/css/themeQtMaemo5.css +++ b/WebCore/css/themeQtMobile.css @@ -66,21 +66,46 @@ select:active:disabled { input:not([type]), input[type="text"], input[type="password"], +input[type="email"], +input[type="tel"], +input[type="color"], +input[type="search"], +input[type="date"], +input[type="number"], +input[type="url"], textarea { - border: 1px solid black; + border: 1px solid gray; + background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, #bfbfbf), color-stop(0.2, #ffffff)); + color: #3e3e3e; + -webkit-border-radius:5px; } input:not([type]):disabled, input[type="text"]:disabled, input[type="password"]:disabled, +input[type="email"]:disabled, +input[type="tel"]:disabled, +input[type="color"]:disabled, +input[type="search"]:disabled, +input[type="date"]:disabled, +input[type="number"]:disabled, +input[type="url"]:disabled, textarea:disabled { - border: 1px solid grey; - background-color:ButtonHighlight; + border: 1px solid gray; + background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, #e5e5e5), color-stop(0.2, #ffffff)); + color: #e5e5e5; } input:not([type]):active, input[type="text"]:active, input[type="password"]:active, +input[type="email"]:active, +input[type="tel"]:active, +input[type="color"]:active, +input[type="search"]:active, +input[type="date"]:active, +input[type="number"]:active, +input[type="url"]:active, textarea:active { - background-color:ButtonShadow; + background: ButtonShadow; } diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp index 59daa59..f497394 100644 --- a/WebCore/dom/Attr.cpp +++ b/WebCore/dom/Attr.cpp @@ -117,13 +117,21 @@ String Attr::nodeValue() const return value(); } -void Attr::setValue(const AtomicString& value, ExceptionCode&) +void Attr::setValue(const AtomicString& value) { m_ignoreChildrenChanged++; removeChildren(); m_attribute->setValue(value); createTextChild(); m_ignoreChildrenChanged--; +} + +void Attr::setValue(const AtomicString& value, ExceptionCode&) +{ + if (m_element && m_element->isIdAttributeName(m_attribute->name())) + m_element->updateId(m_element->getIdAttribute(), value); + + setValue(value); if (m_element) m_element->attributeChanged(m_attribute.get()); @@ -167,7 +175,10 @@ void Attr::childrenChanged(bool changedByParser, Node* beforeChange, Node* after if (n->isTextNode()) val += static_cast<Text *>(n)->data(); } - + + if (m_element && m_element->isIdAttributeName(m_attribute->name())) + m_element->updateId(m_attribute->value(), val); + m_attribute->setValue(val.impl()); if (m_element) m_element->attributeChanged(m_attribute.get()); diff --git a/WebCore/dom/Attr.h b/WebCore/dom/Attr.h index 2e02a02..e76d2fa 100644 --- a/WebCore/dom/Attr.h +++ b/WebCore/dom/Attr.h @@ -48,6 +48,7 @@ public: const AtomicString& value() const { return m_attribute->value(); } void setValue(const AtomicString&, ExceptionCode&); + void setValue(const AtomicString&); Attribute* attr() const { return m_attribute.get(); } const QualifiedName& qualifiedName() const { return m_attribute->name(); } diff --git a/WebCore/dom/CharacterData.cpp b/WebCore/dom/CharacterData.cpp index 7accbfb..bc9ec56 100644 --- a/WebCore/dom/CharacterData.cpp +++ b/WebCore/dom/CharacterData.cpp @@ -24,6 +24,7 @@ #include "EventNames.h" #include "ExceptionCode.h" +#include "InspectorController.h" #include "MutationEvent.h" #include "RenderText.h" @@ -197,6 +198,9 @@ void CharacterData::dispatchModifiedEvent(StringImpl* prevValue) if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER)) dispatchEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, prevValue, m_data)); dispatchSubtreeModifiedEvent(); +#if ENABLE(INSPECTOR) + InspectorController::characterDataModified(this); +#endif } void CharacterData::checkCharDataOperation(unsigned offset, ExceptionCode& ec) diff --git a/WebCore/dom/Clipboard.cpp b/WebCore/dom/Clipboard.cpp index d644bcc..6956257 100644 --- a/WebCore/dom/Clipboard.cpp +++ b/WebCore/dom/Clipboard.cpp @@ -33,12 +33,12 @@ namespace WebCore { -Clipboard::Clipboard(ClipboardAccessPolicy policy, bool isForDragging) +Clipboard::Clipboard(ClipboardAccessPolicy policy, ClipboardType clipboardType) : m_policy(policy) , m_dropEffect("uninitialized") , m_effectAllowed("uninitialized") , m_dragStarted(false) - , m_forDragging(isForDragging) + , m_clipboardType(clipboardType) , m_dragImage(0) { } @@ -127,7 +127,7 @@ void Clipboard::setDestinationOperation(DragOperation op) void Clipboard::setDropEffect(const String &effect) { - if (!m_forDragging) + if (!isForDragAndDrop()) return; // The attribute must ignore any attempts to set it to a value other than none, copy, link, and move. @@ -140,7 +140,7 @@ void Clipboard::setDropEffect(const String &effect) void Clipboard::setEffectAllowed(const String &effect) { - if (!m_forDragging) + if (!isForDragAndDrop()) return; if (dragOpFromIEOp(effect) == DragOperationPrivate) { diff --git a/WebCore/dom/Clipboard.h b/WebCore/dom/Clipboard.h index 0562280..b8eadfb 100644 --- a/WebCore/dom/Clipboard.h +++ b/WebCore/dom/Clipboard.h @@ -40,12 +40,17 @@ namespace WebCore { // State available during IE's events for drag and drop and copy/paste class Clipboard : public RefCounted<Clipboard> { public: + // Whether this clipboard is serving a drag-drop or copy-paste request. + enum ClipboardType { + CopyAndPaste, + DragAndDrop, + }; static PassRefPtr<Clipboard> create(ClipboardAccessPolicy, DragData*, Frame*); virtual ~Clipboard() { } - // Is this operation a drag-drop or a copy-paste? - bool isForDragging() const { return m_forDragging; } + bool isForCopyAndPaste() const { return m_clipboardType == CopyAndPaste; } + bool isForDragAndDrop() const { return m_clipboardType == DragAndDrop; } String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_dropEffect; } void setDropEffect(const String&); @@ -88,7 +93,7 @@ namespace WebCore { void setDragHasStarted() { m_dragStarted = true; } protected: - Clipboard(ClipboardAccessPolicy, bool isForDragging); + Clipboard(ClipboardAccessPolicy, ClipboardType); ClipboardAccessPolicy policy() const { return m_policy; } bool dragStarted() const { return m_dragStarted; } @@ -98,9 +103,9 @@ namespace WebCore { String m_dropEffect; String m_effectAllowed; bool m_dragStarted; + ClipboardType m_clipboardType; protected: - bool m_forDragging; IntPoint m_dragLoc; CachedResourceHandle<CachedImage> m_dragImage; RefPtr<Node> m_dragImageElement; diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index 2dd50bb..e18f6fe 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -154,7 +154,9 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce if (child->parentNode()) break; +#if ENABLE(INSPECTOR) InspectorController::willInsertDOMNode(child, this); +#endif insertBeforeCommon(next.get(), child); @@ -223,7 +225,9 @@ void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node* nextChil for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); +#if ENABLE(INSPECTOR) InspectorController::willInsertDOMNode(child, this); +#endif insertBeforeCommon(next.get(), child); @@ -298,7 +302,9 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce ASSERT(!child->nextSibling()); ASSERT(!child->previousSibling()); +#if ENABLE(INSPECTOR) InspectorController::willInsertDOMNode(child.get(), this); +#endif // Add child after "prev". forbidEventDispatch(); @@ -577,7 +583,9 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo break; } +#if ENABLE(INSPECTOR) InspectorController::willInsertDOMNode(child, this); +#endif // Append child to the end of the list forbidEventDispatch(); @@ -617,7 +625,9 @@ void ContainerNode::parserAddChild(PassRefPtr<Node> newChild) ASSERT(newChild); ASSERT(!newChild->parent()); // Use appendChild if you need to handle reparenting (and want DOM mutation events). +#if ENABLE(INSPECTOR) InspectorController::willInsertDOMNode(newChild.get(), this); +#endif forbidEventDispatch(); Node* last = m_lastChild; @@ -990,7 +1000,9 @@ static void notifyChildInserted(Node* child) { ASSERT(!eventDispatchForbidden()); +#if ENABLE(INSPECTOR) InspectorController::didInsertDOMNode(child); +#endif RefPtr<Node> c = child; RefPtr<Document> document = child->document(); @@ -1024,7 +1036,9 @@ static void dispatchChildRemovalEvents(Node* child) { ASSERT(!eventDispatchForbidden()); +#if ENABLE(INSPECTOR) InspectorController::willRemoveDOMNode(child); +#endif RefPtr<Node> c = child; RefPtr<Document> document = child->document(); diff --git a/WebCore/dom/DeviceMotionClient.h b/WebCore/dom/DeviceMotionClient.h index d19f92f..45bf11a 100644 --- a/WebCore/dom/DeviceMotionClient.h +++ b/WebCore/dom/DeviceMotionClient.h @@ -38,6 +38,7 @@ public: virtual void startUpdating() = 0; virtual void stopUpdating() = 0; virtual DeviceMotionData* currentDeviceMotion() const = 0; + virtual void deviceMotionControllerDestroyed() = 0; }; } // namespace WebCore diff --git a/WebCore/dom/DeviceMotionController.cpp b/WebCore/dom/DeviceMotionController.cpp index 73b948e..3385167 100644 --- a/WebCore/dom/DeviceMotionController.cpp +++ b/WebCore/dom/DeviceMotionController.cpp @@ -40,6 +40,11 @@ DeviceMotionController::DeviceMotionController(DeviceMotionClient* client) m_client->setController(this); } +DeviceMotionController::~DeviceMotionController() +{ + m_client->deviceMotionControllerDestroyed(); +} + void DeviceMotionController::timerFired(Timer<DeviceMotionController>* timer) { ASSERT_UNUSED(timer, timer == &m_timer); diff --git a/WebCore/dom/DeviceMotionController.h b/WebCore/dom/DeviceMotionController.h index 2670e04..422be73 100644 --- a/WebCore/dom/DeviceMotionController.h +++ b/WebCore/dom/DeviceMotionController.h @@ -38,6 +38,7 @@ class DeviceMotionClient; class DeviceMotionController { public: DeviceMotionController(DeviceMotionClient*); + ~DeviceMotionController(); void addListener(DOMWindow*); void removeListener(DOMWindow*); diff --git a/WebCore/dom/DeviceMotionData.cpp b/WebCore/dom/DeviceMotionData.cpp index cf4b466..7344c1c 100644 --- a/WebCore/dom/DeviceMotionData.cpp +++ b/WebCore/dom/DeviceMotionData.cpp @@ -28,59 +28,63 @@ namespace WebCore { +PassRefPtr<DeviceMotionData::Acceleration> DeviceMotionData::Acceleration::create(bool canProvideX, double x, + bool canProvideY, double y, + bool canProvideZ, double z) +{ + return adoptRef(new DeviceMotionData::Acceleration(canProvideX, x, canProvideY, y, canProvideZ, z)); +} + +DeviceMotionData::Acceleration::Acceleration(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z) + : m_x(x) + , m_y(y) + , m_z(z) + , m_canProvideX(canProvideX) + , m_canProvideY(canProvideY) + , m_canProvideZ(canProvideZ) + +{ +} + +PassRefPtr<DeviceMotionData::RotationRate> DeviceMotionData::RotationRate::create(bool canProvideAlpha, double alpha, + bool canProvideBeta, double beta, + bool canProvideGamma, double gamma) +{ + return adoptRef(new DeviceMotionData::RotationRate(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)); +} + +DeviceMotionData::RotationRate::RotationRate(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) + : m_alpha(alpha) + , m_beta(beta) + , m_gamma(gamma) + , m_canProvideAlpha(canProvideAlpha) + , m_canProvideBeta(canProvideBeta) + , m_canProvideGamma(canProvideGamma) +{ +} + PassRefPtr<DeviceMotionData> DeviceMotionData::create() { return adoptRef(new DeviceMotionData); } -PassRefPtr<DeviceMotionData> DeviceMotionData::create(bool canProvideXAcceleration, double xAcceleration, - bool canProvideYAcceleration, double yAcceleration, - bool canProvideZAcceleration, double zAcceleration, - bool canProvideXRotationRate, double xRotationRate, - bool canProvideYRotationRate, double yRotationRate, - bool canProvideZRotationRate, double zRotationRate, - bool canProvideInterval, double interval) +PassRefPtr<DeviceMotionData> DeviceMotionData::create(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity, + PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval) { - return adoptRef(new DeviceMotionData(canProvideXAcceleration, xAcceleration, - canProvideYAcceleration, yAcceleration, - canProvideZAcceleration, zAcceleration, - canProvideXRotationRate, xRotationRate, - canProvideYRotationRate, yRotationRate, - canProvideZRotationRate, zRotationRate, - canProvideInterval, interval)); + return adoptRef(new DeviceMotionData(acceleration, accelerationIncludingGravity, rotationRate, canProvideInterval, interval)); } DeviceMotionData::DeviceMotionData() - : m_canProvideXAcceleration(false) - , m_canProvideYAcceleration(false) - , m_canProvideZAcceleration(false) - , m_canProvideXRotationRate(false) - , m_canProvideYRotationRate(false) - , m_canProvideZRotationRate(false) - , m_canProvideInterval(false) + : m_canProvideInterval(false) { } -DeviceMotionData::DeviceMotionData(bool canProvideXAcceleration, double xAcceleration, - bool canProvideYAcceleration, double yAcceleration, - bool canProvideZAcceleration, double zAcceleration, - bool canProvideXRotationRate, double xRotationRate, - bool canProvideYRotationRate, double yRotationRate, - bool canProvideZRotationRate, double zRotationRate, - bool canProvideInterval, double interval) - : m_canProvideXAcceleration(canProvideXAcceleration) - , m_canProvideYAcceleration(canProvideYAcceleration) - , m_canProvideZAcceleration(canProvideZAcceleration) - , m_canProvideXRotationRate(canProvideXRotationRate) - , m_canProvideYRotationRate(canProvideYRotationRate) - , m_canProvideZRotationRate(canProvideZRotationRate) +DeviceMotionData::DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity, + PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval) + : m_acceleration(acceleration) + , m_accelerationIncludingGravity(accelerationIncludingGravity) + , m_rotationRate(rotationRate) , m_canProvideInterval(canProvideInterval) - , m_xAcceleration(xAcceleration) - , m_yAcceleration(yAcceleration) - , m_zAcceleration(zAcceleration) - , m_xRotationRate(xRotationRate) - , m_yRotationRate(yRotationRate) - , m_zRotationRate(zRotationRate) , m_interval(interval) { } diff --git a/WebCore/dom/DeviceMotionData.h b/WebCore/dom/DeviceMotionData.h index cd90246..1d53b53 100644 --- a/WebCore/dom/DeviceMotionData.h +++ b/WebCore/dom/DeviceMotionData.h @@ -28,60 +28,79 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> namespace WebCore { class DeviceMotionData : public RefCounted<DeviceMotionData> { public: + class Acceleration : public RefCounted<DeviceMotionData::Acceleration> { + public: + static PassRefPtr<Acceleration> create(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z); + + bool canProvideX() const { return m_canProvideX; } + bool canProvideY() const { return m_canProvideY; } + bool canProvideZ() const { return m_canProvideZ; } + + double x() const { return m_x; } + double y() const { return m_y; } + double z() const { return m_z; } + + private: + Acceleration(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z); + + double m_x; + double m_y; + double m_z; + + bool m_canProvideX; + bool m_canProvideY; + bool m_canProvideZ; + }; + + class RotationRate : public RefCounted<DeviceMotionData::RotationRate> { + public: + static PassRefPtr<RotationRate> create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); + + bool canProvideAlpha() const { return m_canProvideAlpha; } + bool canProvideBeta() const { return m_canProvideBeta; } + bool canProvideGamma() const { return m_canProvideGamma; } + + double alpha() const { return m_alpha; } + double beta() const { return m_beta; } + double gamma() const { return m_gamma; } + + private: + RotationRate(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); + + double m_alpha; + double m_beta; + double m_gamma; + + bool m_canProvideAlpha; + bool m_canProvideBeta; + bool m_canProvideGamma; + }; + static PassRefPtr<DeviceMotionData> create(); - static PassRefPtr<DeviceMotionData> create(bool canProvideXAcceleration, double xAcceleration, - bool canProvideYAcceleration, double yAcceleration, - bool canProvideZAcceleration, double zAcceleration, - bool canProvideXRotationRate, double xRotationRate, - bool canProvideYRotationRate, double yRotationRate, - bool canProvideZRotationRate, double zRotationRate, - bool canProvideInterval, double interval); - - double xAcceleration() const { return m_xAcceleration; } - double yAcceleration() const { return m_yAcceleration; } - double zAcceleration() const { return m_zAcceleration; } - double xRotationRate() const { return m_xRotationRate; } - double yRotationRate() const { return m_yRotationRate; } - double zRotationRate() const { return m_zRotationRate; } - double interval() const { return m_interval; } + static PassRefPtr<DeviceMotionData> create(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity, + PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval); - bool canProvideXAcceleration() const { return m_canProvideXAcceleration; } - bool canProvideYAcceleration() const { return m_canProvideYAcceleration; } - bool canProvideZAcceleration() const { return m_canProvideZAcceleration; } - bool canProvideXRotationRate() const { return m_canProvideXRotationRate; } - bool canProvideYRotationRate() const { return m_canProvideYRotationRate; } - bool canProvideZRotationRate() const { return m_canProvideZRotationRate; } + const Acceleration* acceleration() const { return m_acceleration.get(); } + const Acceleration* accelerationIncludingGravity() const { return m_accelerationIncludingGravity.get(); } + const RotationRate* rotationRate() const { return m_rotationRate.get(); } + double interval() const { return m_interval; } bool canProvideInterval() const { return m_canProvideInterval; } private: DeviceMotionData(); - DeviceMotionData(bool canProvideXAcceleration, double xAcceleration, - bool canProvideYAcceleration, double yAcceleration, - bool canProvideZAcceleration, double zAcceleration, - bool canProvideXRotationRate, double xRotationRate, - bool canProvideYRotationRate, double yRotationRate, - bool canProvideZRotationRate, double zRotationRate, - bool canProvideInterval, double interval); - - bool m_canProvideXAcceleration; - bool m_canProvideYAcceleration; - bool m_canProvideZAcceleration; - bool m_canProvideXRotationRate; - bool m_canProvideYRotationRate; - bool m_canProvideZRotationRate; - bool m_canProvideInterval; + DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity, + PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval); - double m_xAcceleration; - double m_yAcceleration; - double m_zAcceleration; - double m_xRotationRate; - double m_yRotationRate; - double m_zRotationRate; + RefPtr<Acceleration> m_acceleration; + RefPtr<Acceleration> m_accelerationIncludingGravity; + RefPtr<RotationRate> m_rotationRate; + bool m_canProvideInterval; double m_interval; }; diff --git a/WebCore/dom/DeviceMotionEvent.idl b/WebCore/dom/DeviceMotionEvent.idl index 97e8e71..437ba4c 100644 --- a/WebCore/dom/DeviceMotionEvent.idl +++ b/WebCore/dom/DeviceMotionEvent.idl @@ -28,14 +28,11 @@ module core { interface [ Conditional=DEVICE_ORIENTATION ] DeviceMotionEvent : Event { - readonly attribute [Custom] double xAcceleration; - readonly attribute [Custom] double yAcceleration; - readonly attribute [Custom] double zAcceleration; - readonly attribute [Custom] double xRotationRate; - readonly attribute [Custom] double yRotationRate; - readonly attribute [Custom] double zRotationRate; + readonly attribute [Custom] Acceleration acceleration; + readonly attribute [Custom] Acceleration accelerationIncludingGravity; + readonly attribute [Custom] RotationRate rotationRate; readonly attribute [Custom] double interval; - [Custom] void initDeviceMotionEvent(in DOMString type, in boolean bubbles, in boolean cancelable, in double xAcceleration, in double yAcceleration, in double zAcceleration, in double xRotationRate, in double yRotationRate, in double zRotationRate, in double interval); + [Custom] void initDeviceMotionEvent(in DOMString type, in boolean bubbles, in boolean cancelable, in Acceleration acceleration, in Acceleration accelerationIncludingGravity, in RotationRate rotationRate, in double interval); }; } diff --git a/WebCore/dom/DeviceOrientationClient.h b/WebCore/dom/DeviceOrientationClient.h index c969c95..347c3b3 100644 --- a/WebCore/dom/DeviceOrientationClient.h +++ b/WebCore/dom/DeviceOrientationClient.h @@ -39,6 +39,7 @@ public: virtual void startUpdating() = 0; virtual void stopUpdating() = 0; virtual DeviceOrientation* lastOrientation() const = 0; + virtual void deviceOrientationControllerDestroyed() = 0; }; } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationController.cpp b/WebCore/dom/DeviceOrientationController.cpp index a744366..60fcf13 100644 --- a/WebCore/dom/DeviceOrientationController.cpp +++ b/WebCore/dom/DeviceOrientationController.cpp @@ -41,6 +41,11 @@ DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrien m_client->setController(this); } +DeviceOrientationController::~DeviceOrientationController() +{ + m_client->deviceOrientationControllerDestroyed(); +} + void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer) { ASSERT_UNUSED(timer, timer == &m_timer); diff --git a/WebCore/dom/DeviceOrientationController.h b/WebCore/dom/DeviceOrientationController.h index 9517791..53b80f8 100644 --- a/WebCore/dom/DeviceOrientationController.h +++ b/WebCore/dom/DeviceOrientationController.h @@ -40,6 +40,7 @@ class Page; class DeviceOrientationController { public: DeviceOrientationController(Page*, DeviceOrientationClient*); + ~DeviceOrientationController(); void addListener(DOMWindow*); void removeListener(DOMWindow*); diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 180b943..359a3d3 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -129,7 +129,6 @@ #include "TreeWalker.h" #include "UIEvent.h" #include "UserContentURLPattern.h" -#include "ViewportArguments.h" #include "WebKitAnimationEvent.h" #include "WebKitTransitionEvent.h" #include "WheelEvent.h" @@ -1079,7 +1078,7 @@ KURL Document::baseURI() const // * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h); // * making it receive the expading size of each direction separately, // i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize); -PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned hPadding, unsigned vPadding, bool ignoreClipping) const +PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping) const { // FIXME: Share code between this, elementFromPoint and caretRangeFromPoint. if (!renderer()) @@ -1093,26 +1092,25 @@ PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned float zoomFactor = frame->pageZoomFactor(); IntPoint point = roundedIntPoint(FloatPoint(centerX * zoomFactor + view()->scrollX(), centerY * zoomFactor + view()->scrollY())); - IntSize padding(hPadding, vPadding); int type = HitTestRequest::ReadOnly | HitTestRequest::Active; // When ignoreClipping is false, this method returns null for coordinates outside of the viewport. if (ignoreClipping) type |= HitTestRequest::IgnoreClipping; - else if (!frameView->visibleContentRect().intersects(IntRect(point, padding))) + else if (!frameView->visibleContentRect().intersects(HitTestResult::rectFromPoint(point, topPadding, rightPadding, bottomPadding, leftPadding))) return 0; HitTestRequest request(type); // Passing a zero padding will trigger a rect hit test, however for the purposes of nodesFromRect, // we special handle this case in order to return a valid NodeList. - if (padding.isZero()) { + if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) { HitTestResult result(point); return handleZeroPadding(request, result); } - HitTestResult result(point, padding); + HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding); renderView()->layer()->hitTest(request, result); return StaticHashSetNodeList::adopt(result.rectBasedTestResult()); @@ -1238,8 +1236,10 @@ void Document::removeElementById(const AtomicString& elementId, Element* element if (m_elementsById.get(elementId.impl()) == element) m_elementsById.remove(elementId.impl()); - else + else { + ASSERT(m_inRemovedLastRefFunction || m_duplicateIds.contains(elementId.impl())); m_duplicateIds.remove(elementId.impl()); + } } Element* Document::getElementByAccessKey(const String& key) const @@ -1824,6 +1824,18 @@ void Document::clearAXObjectCache() #endif } +bool Document::axObjectCacheExists() const +{ + if (m_axObjectCache) + return true; + + Document* doc = topDocument(); + if (doc != this) + return doc->axObjectCacheExists(); + + return false; +} + AXObjectCache* Document::axObjectCache() const { #if PLATFORM(ANDROID) @@ -2097,7 +2109,7 @@ void Document::implicitClose() view()->layout(); } -#if PLATFORM(MAC) +#if PLATFORM(MAC) || PLATFORM(CHROMIUM) if (f && renderObject && this == topDocument() && AXObjectCache::accessibilityEnabled()) { // The AX cache may have been cleared at this point, but we need to make sure it contains an // AX object to send the notification to. getOrCreate will make sure that an valid AX object @@ -2352,7 +2364,7 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist())) continue; RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::createInline(const_cast<Document*>(this), sheet->url()); - parsedSheet->setIsUserStyleSheet(sheet->level() == UserStyleSheet::UserLevel); + parsedSheet->setIsUserStyleSheet(sheet->level() == UserStyleUserLevel); parsedSheet->parseString(sheet->source(), !inQuirksMode()); if (!m_pageGroupUserSheets) m_pageGroupUserSheets.set(new Vector<RefPtr<CSSStyleSheet> >); @@ -2647,16 +2659,14 @@ void Document::processViewport(const String& features) { ASSERT(!features.isNull()); + m_viewportArguments = ViewportArguments(); + processArguments(features, (void*)&m_viewportArguments, &setViewportFeature); + Frame* frame = this->frame(); - if (!frame) + if (!frame || !frame->page()) return; - if (frame->page()) { - ViewportArguments arguments; - processArguments(features, (void*)&arguments, &setViewportFeature); - - frame->page()->chrome()->client()->didReceiveViewportArguments(frame, arguments); - } + frame->page()->chrome()->client()->didReceiveViewportArguments(frame, m_viewportArguments); } MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& request, const IntPoint& documentPoint, const PlatformMouseEvent& event) @@ -3224,7 +3234,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) } } -#if ((PLATFORM(MAC) || PLATFORM(WIN)) && !PLATFORM(CHROMIUM)) || PLATFORM(GTK) +#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled()) { RenderObject* oldFocusedRenderer = 0; RenderObject* newFocusedRenderer = 0; @@ -3271,6 +3281,8 @@ void Document::attachNodeIterator(NodeIterator* ni) void Document::detachNodeIterator(NodeIterator* ni) { + // The node iterator can be detached without having been attached if its root node didn't have a document + // when the iterator was created, but has it now. m_nodeIterators.remove(ni); } @@ -3870,6 +3882,10 @@ void Document::setInPageCache(bool flag) ASSERT(m_renderArena); setRenderer(m_savedRenderer); m_savedRenderer = 0; + + if (frame() && frame()->page()) + frame()->page()->chrome()->client()->didReceiveViewportArguments(frame(), m_viewportArguments); + if (childNeedsStyleRecalc()) scheduleStyleRecalc(); } @@ -3967,7 +3983,7 @@ bool Document::queryCommandIndeterm(const String& commandName) bool Document::queryCommandState(const String& commandName) { - return command(this, commandName).state() != FalseTriState; + return command(this, commandName).state() == TrueTriState; } bool Document::queryCommandSupported(const String& commandName) @@ -4083,6 +4099,11 @@ SVGDocumentExtensions* Document::accessSVGExtensions() m_svgExtensions = adoptPtr(new SVGDocumentExtensions(this)); return m_svgExtensions.get(); } + +bool Document::hasSVGRootNode() const +{ + return documentElement() && documentElement()->hasTagName(SVGNames::svgTag); +} #endif PassRefPtr<HTMLCollection> Document::images() @@ -4326,37 +4347,9 @@ void FormElementKey::deref() const type()->deref(); } -unsigned FormElementKeyHash::hash(const FormElementKey& k) +unsigned FormElementKeyHash::hash(const FormElementKey& key) { - ASSERT(sizeof(k) % (sizeof(uint16_t) * 2) == 0); - - unsigned l = sizeof(k) / (sizeof(uint16_t) * 2); - const uint16_t* s = reinterpret_cast<const uint16_t*>(&k); - uint32_t hash = WTF::stringHashingStartValue; - - // Main loop - for (; l > 0; l--) { - hash += s[0]; - uint32_t tmp = (s[1] << 11) ^ hash; - hash = (hash << 16) ^ tmp; - s += 2; - hash += hash >> 11; - } - - // Force "avalanching" of final 127 bits - hash ^= hash << 3; - hash += hash >> 5; - hash ^= hash << 2; - hash += hash >> 15; - hash ^= hash << 10; - - // this avoids ever returning a hash code of 0, since that is used to - // signal "hash not computed yet", using a value that is likely to be - // effectively the same as 0 when the low bits are masked - if (!hash) - hash = 0x80000000; - - return hash; + return WTF::StringHasher::createBlobHash<sizeof(FormElementKey)>(&key); } void Document::setIconURL(const String& iconURL, const String& type) diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index c1065fb..fa3d9fb 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -36,6 +36,7 @@ #include "QualifiedName.h" #include "ScriptExecutionContext.h" #include "Timer.h" +#include "ViewportArguments.h" #include <wtf/FixedArray.h> #include <wtf/HashCountedSet.h> #include <wtf/OwnPtr.h> @@ -276,6 +277,8 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitfullscreenchange); #endif + ViewportArguments viewportArguments() const { return m_viewportArguments; } + DocumentType* doctype() const { return m_docType.get(); } DOMImplementation* implementation() const; @@ -305,7 +308,7 @@ public: /** * Retrieve all nodes that intersect a rect in the window's document, until it is fully enclosed by - * the boundaries of node. + * the boundaries of a node. * * @param centerX x reference for the rectangle in CSS pixels * @param centerY y reference for the rectangle in CSS pixels @@ -314,7 +317,8 @@ public: * @param ignoreClipping whether or not to ignore the root scroll frame when retrieving the element. * If false, this method returns null for coordinates outside of the viewport. */ - PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, unsigned hPadding, unsigned vPadding, bool ignoreClipping) const; + PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, + unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping) const; Element* elementFromPoint(int x, int y) const; PassRefPtr<Range> caretRangeFromPoint(int x, int y); @@ -385,8 +389,10 @@ public: virtual bool isImageDocument() const { return false; } #if ENABLE(SVG) virtual bool isSVGDocument() const { return false; } + bool hasSVGRootNode() const; #else static bool isSVGDocument() { return false; } + static bool hasSVGRootNode() { return false; } #endif virtual bool isPluginDocument() const { return false; } virtual bool isMediaDocument() const { return false; } @@ -520,6 +526,7 @@ public: void clearAXObjectCache(); AXObjectCache* axObjectCache() const; + bool axObjectCacheExists() const; // to get visually ordered hebrew and arabic pages right void setVisuallyOrdered(); @@ -1323,6 +1330,8 @@ private: #endif int m_loadEventDelayCount; + + ViewportArguments m_viewportArguments; }; inline bool Document::hasElementWithId(AtomicStringImpl* id) const diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl index 296bd44..e551f88 100644 --- a/WebCore/dom/Document.idl +++ b/WebCore/dom/Document.idl @@ -186,11 +186,6 @@ module core { readonly attribute [ConvertNullStringTo=Undefined] DOMString defaultCharset; readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState; - - NodeList nodesFromRect(in long x, in long y, - in unsigned long hPadding, - in unsigned long vPadding, - in boolean ignoreClipping); Element elementFromPoint(in long x, in long y); Range caretRangeFromPoint(in long x, in long y); diff --git a/WebCore/dom/DocumentMarker.h b/WebCore/dom/DocumentMarker.h index e6160ae..dd5e981 100644 --- a/WebCore/dom/DocumentMarker.h +++ b/WebCore/dom/DocumentMarker.h @@ -40,6 +40,7 @@ struct DocumentMarker { Grammar, TextMatch, Replacement, + CorrectionIndicator, RejectedCorrection }; diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index 5f53c2d..c408790 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -33,6 +33,7 @@ #include "CSSStyleSelector.h" #include "ClientRect.h" #include "ClientRectList.h" +#include "DOMTokenList.h" #include "DatasetDOMStringMap.h" #include "Document.h" #include "DocumentFragment.h" @@ -578,7 +579,10 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value, else if (!old && !value.isNull()) m_attributeMap->addAttribute(createAttribute(QualifiedName(nullAtom, localName, nullAtom), value)); else if (old && !value.isNull()) { - old->setValue(value); + if (Attr* attrNode = old->attr()) + attrNode->setValue(value); + else + old->setValue(value); attributeChanged(old); } @@ -608,7 +612,10 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value, else if (!old && !value.isNull()) m_attributeMap->addAttribute(createAttribute(name, value)); else if (old) { - old->setValue(value); + if (Attr* attrNode = old->attr()) + attrNode->setValue(value); + else + old->setValue(value); attributeChanged(old); } @@ -651,6 +658,8 @@ void Element::updateAfterAttributeChanged(Attribute* attr) document()->axObjectCache()->selectedChildrenChanged(renderer()); else if (attrName == aria_expandedAttr) document()->axObjectCache()->handleAriaExpandedChange(renderer()); + else if (attrName == aria_hiddenAttr) + document()->axObjectCache()->childrenChanged(renderer()); } void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr) @@ -1565,6 +1574,21 @@ bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec) return false; } +DOMTokenList* Element::classList() +{ + ElementRareData* data = ensureRareData(); + if (!data->m_classList) + data->m_classList = DOMTokenList::create(this); + return data->m_classList.get(); +} + +DOMTokenList* Element::optionalClassList() const +{ + if (!hasRareData()) + return 0; + return rareData()->m_classList.get(); +} + DOMStringMap* Element::dataset() { ElementRareData* data = ensureRareData(); diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index d9a5085..b51e750 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -36,6 +36,7 @@ class Attribute; class ClientRect; class ClientRectList; class DOMStringMap; +class DOMTokenList; class ElementRareData; class IntSize; @@ -269,6 +270,9 @@ public: bool webkitMatchesSelector(const String& selectors, ExceptionCode&); + DOMTokenList* classList(); + DOMTokenList* optionalClassList() const; + DOMStringMap* dataset(); DOMStringMap* optionalDataset() const; diff --git a/WebCore/dom/ElementRareData.h b/WebCore/dom/ElementRareData.h index 8e338ab..f1e6334 100644 --- a/WebCore/dom/ElementRareData.h +++ b/WebCore/dom/ElementRareData.h @@ -22,6 +22,7 @@ #ifndef ElementRareData_h #define ElementRareData_h +#include "DOMTokenList.h" #include "DatasetDOMStringMap.h" #include "Element.h" #include "NodeRareData.h" @@ -42,6 +43,7 @@ public: RefPtr<RenderStyle> m_computedStyle; OwnPtr<DatasetDOMStringMap> m_datasetDOMStringMap; + OwnPtr<DOMTokenList> m_classList; }; inline IntSize defaultMinimumSizeForResizing() diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 92b42fe..5694dfe 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -25,11 +25,15 @@ #include "config.h" #include "Node.h" +<<<<<<< HEAD #ifdef ANDROID_DOM_LOGGING #define LOG_TAG "webcore" #include "AndroidLog.h" #endif +======= +#include "AXObjectCache.h" +>>>>>>> webkit.org at r68651 #include "Attr.h" #include "Attribute.h" #include "CSSParser.h" @@ -386,6 +390,9 @@ Node::~Node() if (renderer()) detach(); + if (AXObjectCache::accessibilityEnabled() && m_document && m_document->axObjectCacheExists()) + m_document->axObjectCache()->removeNodeForUse(this); + if (m_previous) m_previous->setNextSibling(0); if (m_next) diff --git a/WebCore/dom/NodeIterator.cpp b/WebCore/dom/NodeIterator.cpp index af07f42..ce3103c 100644 --- a/WebCore/dom/NodeIterator.cpp +++ b/WebCore/dom/NodeIterator.cpp @@ -76,12 +76,16 @@ NodeIterator::NodeIterator(PassRefPtr<Node> rootNode, unsigned whatToShow, PassR , m_referenceNode(root(), true) , m_detached(false) { - root()->document()->attachNodeIterator(this); + // Document type nodes may have a null document. But since they can't have children, there is no need to listen for modifications to these. + ASSERT(root()->document() || root()->nodeType() == Node::DOCUMENT_TYPE_NODE); + if (Document* ownerDocument = root()->document()) + ownerDocument->attachNodeIterator(this); } NodeIterator::~NodeIterator() { - root()->document()->detachNodeIterator(this); + if (Document* ownerDocument = root()->document()) + ownerDocument->detachNodeIterator(this); } PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionCode& ec) @@ -144,7 +148,8 @@ PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionCode& e void NodeIterator::detach() { - root()->document()->detachNodeIterator(this); + if (Document* ownerDocument = root()->document()) + ownerDocument->detachNodeIterator(this); m_detached = true; m_referenceNode.node.clear(); } @@ -159,6 +164,7 @@ void NodeIterator::updateForNodeRemoval(Node* removedNode, NodePointer& referenc { ASSERT(!m_detached); ASSERT(removedNode); + ASSERT(root()->document()); ASSERT(root()->document() == removedNode->document()); // Iterator is not affected if the removed node is the reference node and is the root. diff --git a/WebCore/dom/QualifiedName.h b/WebCore/dom/QualifiedName.h index ee90408..2da8f0c 100644 --- a/WebCore/dom/QualifiedName.h +++ b/WebCore/dom/QualifiedName.h @@ -112,52 +112,24 @@ inline bool operator!=(const QualifiedName& q, const AtomicString& a) { return a inline unsigned hashComponents(const QualifiedNameComponents& buf) { - ASSERT(sizeof(QualifiedNameComponents) % (sizeof(uint16_t) * 2) == 0); - - unsigned l = sizeof(QualifiedNameComponents) / (sizeof(uint16_t) * 2); - const uint16_t* s = reinterpret_cast<const uint16_t*>(&buf); - uint32_t hash = WTF::stringHashingStartValue; - - // Main loop - for (; l > 0; l--) { - hash += s[0]; - uint32_t tmp = (s[1] << 11) ^ hash; - hash = (hash << 16) ^ tmp; - s += 2; - hash += hash >> 11; - } - - // Force "avalanching" of final 127 bits - hash ^= hash << 3; - hash += hash >> 5; - hash ^= hash << 2; - hash += hash >> 15; - hash ^= hash << 10; - - // this avoids ever returning a hash code of 0, since that is used to - // signal "hash not computed yet", using a value that is likely to be - // effectively the same as 0 when the low bits are masked - if (hash == 0) - hash = 0x80000000; - - return hash; + return WTF::StringHasher::createBlobHash<sizeof(QualifiedNameComponents)>(&buf); } - + struct QualifiedNameHash { static unsigned hash(const QualifiedName& name) { return hash(name.impl()); } - + static unsigned hash(const QualifiedName::QualifiedNameImpl* name) - { + { QualifiedNameComponents c = { name->m_prefix.impl(), name->m_localName.impl(), name->m_namespace.impl() }; return hashComponents(c); } - + static bool equal(const QualifiedName& a, const QualifiedName& b) { return a == b; } static bool equal(const QualifiedName::QualifiedNameImpl* a, const QualifiedName::QualifiedNameImpl* b) { return a == b; } - + static const bool safeToCompareToEmptyOrDeleted = false; }; - + } namespace WTF { diff --git a/WebCore/dom/Range.h b/WebCore/dom/Range.h index 9834aec..aea76e1 100644 --- a/WebCore/dom/Range.h +++ b/WebCore/dom/Range.h @@ -109,6 +109,7 @@ public: void textRects(Vector<IntRect>&, bool useSelectionHeight = false); // Transform-friendly void textQuads(Vector<FloatQuad>&, bool useSelectionHeight = false); + void getBorderAndTextQuads(Vector<FloatQuad>&) const; void nodeChildrenChanged(ContainerNode*); void nodeChildrenWillBeRemoved(ContainerNode*); @@ -147,8 +148,6 @@ private: enum ActionType { DELETE_CONTENTS, EXTRACT_CONTENTS, CLONE_CONTENTS }; PassRefPtr<DocumentFragment> processContents(ActionType, ExceptionCode&); - void getBorderAndTextQuads(Vector<FloatQuad>&) const; - RefPtr<Document> m_ownerDocument; RangeBoundaryPoint m_start; RangeBoundaryPoint m_end; diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp index 0ca6cb3..bcab08c 100644 --- a/WebCore/dom/SelectElement.cpp +++ b/WebCore/dom/SelectElement.cpp @@ -53,7 +53,7 @@ #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) #define ARROW_KEYS_POP_MENU 1 #define SPACE_OR_RETURN_POP_MENU 0 -#elif PLATFORM(GTK) || (PLATFORM(CHROMIUM) && OS(LINUX)) +#elif PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(LINUX) || OS(FREEBSD))) #define ARROW_KEYS_POP_MENU 0 #define SPACE_OR_RETURN_POP_MENU 1 #else diff --git a/WebCore/dom/SpaceSplitString.h b/WebCore/dom/SpaceSplitString.h index f49670b..0d3650e 100644 --- a/WebCore/dom/SpaceSplitString.h +++ b/WebCore/dom/SpaceSplitString.h @@ -74,6 +74,7 @@ namespace WebCore { bool containsAll(const SpaceSplitString& names) const { return !names.m_data || (m_data && m_data->containsAll(*names.m_data)); } size_t size() const { return m_data ? m_data->size() : 0; } + bool isNull() const { return !m_data; } const AtomicString& operator[](size_t i) const { ASSERT(i < size()); return (*m_data)[i]; } private: diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp index a158e2e..f07fda9 100644 --- a/WebCore/dom/StyledElement.cpp +++ b/WebCore/dom/StyledElement.cpp @@ -28,6 +28,7 @@ #include "CSSStyleSelector.h" #include "CSSStyleSheet.h" #include "CSSValueKeywords.h" +#include "DOMTokenList.h" #include "Document.h" #include "HTMLNames.h" #include <wtf/HashFunctions.h> @@ -217,12 +218,12 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString) } bool hasClass = i < length; setHasClass(hasClass); - if (hasClass) + if (hasClass) { attributes()->setClass(newClassString); - else { - if (attributeMap()) - attributeMap()->clearClass(); - } + if (DOMTokenList* classList = optionalClassList()) + classList->reset(newClassString); + } else if (attributeMap()) + attributeMap()->clearClass(); setNeedsStyleRecalc(); dispatchSubtreeModifiedEvent(); } diff --git a/WebCore/dom/StyledElement.h b/WebCore/dom/StyledElement.h index 8040dbf..4b62388 100644 --- a/WebCore/dom/StyledElement.h +++ b/WebCore/dom/StyledElement.h @@ -32,6 +32,7 @@ namespace WebCore { class Attribute; +class ClassList; class CSSMappedAttributeDeclaration; class StyledElement : public Element { diff --git a/WebCore/editing/AppendNodeCommand.cpp b/WebCore/editing/AppendNodeCommand.cpp index 6178641..eeecdd2 100644 --- a/WebCore/editing/AppendNodeCommand.cpp +++ b/WebCore/editing/AppendNodeCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "AppendNodeCommand.h" +#include "AXObjectCache.h" #include "htmlediting.h" namespace WebCore { @@ -42,6 +43,17 @@ AppendNodeCommand::AppendNodeCommand(PassRefPtr<Element> parent, PassRefPtr<Node ASSERT(m_parent->isContentEditable() || !m_parent->attached()); } +static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXObjectCache::AXTextChange textChange) +{ + String nodeValue = node->nodeValue(); + unsigned len = nodeValue.length(); + // Don't consider linebreaks in this command + if (nodeValue == "\n") + return; + + node->document()->axObjectCache()->nodeTextChangeNotification(node->renderer(), textChange, 0, len); +} + void AppendNodeCommand::doApply() { if (!m_parent->isContentEditable() && m_parent->attached()) @@ -49,6 +61,9 @@ void AppendNodeCommand::doApply() ExceptionCode ec; m_parent->appendChild(m_node.get(), ec); + + if (AXObjectCache::accessibilityEnabled()) + sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextInserted); } void AppendNodeCommand::doUnapply() @@ -56,6 +71,10 @@ void AppendNodeCommand::doUnapply() if (!m_parent->isContentEditable()) return; + // Need to notify this before actually deleting the text + if (AXObjectCache::accessibilityEnabled()) + sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextDeleted); + ExceptionCode ec; m_node->remove(ec); } diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp index b2e93ec..3ff7169 100644 --- a/WebCore/editing/ApplyStyleCommand.cpp +++ b/WebCore/editing/ApplyStyleCommand.cpp @@ -145,7 +145,7 @@ void StyleChange::init(PassRefPtr<CSSStyleDeclaration> style, const Position& po return; RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle(); - RefPtr<CSSMutableStyleDeclaration> mutableStyle = getPropertiesNotInComputedStyle(style.get(), computedStyle.get()); + RefPtr<CSSMutableStyleDeclaration> mutableStyle = getPropertiesNotIn(style.get(), computedStyle.get()); reconcileTextDecorationProperties(mutableStyle.get()); if (!document->frame()->editor()->shouldStyleWithCSS()) @@ -156,7 +156,7 @@ void StyleChange::init(PassRefPtr<CSSStyleDeclaration> style, const Position& po mutableStyle->removeProperty(CSSPropertyWhiteSpace); // If unicode-bidi is present in mutableStyle and direction is not, then add direction to mutableStyle. - // FIXME: Shouldn't this be done in getPropertiesNotInComputedStyle? + // FIXME: Shouldn't this be done in getPropertiesNotIn? if (mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi) && !style->getPropertyCSSValue(CSSPropertyDirection)) mutableStyle->setProperty(CSSPropertyDirection, style->getPropertyValue(CSSPropertyDirection)); @@ -221,8 +221,8 @@ void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclarati // Assuming reconcileTextDecorationProperties has been called, there should not be -webkit-text-decorations-in-effect // Furthermore, text-decoration: none has been trimmed so that text-decoration property is always a CSSValueList. - if (RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration)) { - ASSERT(textDecoration->isValueList()); + RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration); + if (textDecoration && textDecoration->isValueList()) { DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline))); DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough))); @@ -388,23 +388,43 @@ static bool fontWeightIsBold(CSSStyleDeclaration* style) return false; // Make compiler happy } -RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle) +static int getTextAlignment(CSSStyleDeclaration* style) { - ASSERT(style); - ASSERT(computedStyle); - RefPtr<CSSMutableStyleDeclaration> result = style->copy(); - computedStyle->diff(result.get()); + int textAlign = getIdentifierValue(style, CSSPropertyTextAlign); + switch (textAlign) { + case CSSValueCenter: + case CSSValueWebkitCenter: + return CSSValueCenter; + case CSSValueLeft: + case CSSValueWebkitLeft: + return CSSValueLeft; + case CSSValueRight: + case CSSValueWebkitRight: + return CSSValueRight; + } + return CSSValueInvalid; +} + +RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) +{ + ASSERT(styleWithRedundantProperties); + ASSERT(baseStyle); + RefPtr<CSSMutableStyleDeclaration> result = styleWithRedundantProperties->copy(); + baseStyle->diff(result.get()); - RefPtr<CSSValue> computedTextDecorationsInEffect = computedStyle->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); - diffTextDecorations(result.get(), CSSPropertyTextDecoration, computedTextDecorationsInEffect.get()); - diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect, computedTextDecorationsInEffect.get()); + RefPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); + diffTextDecorations(result.get(), CSSPropertyTextDecoration, baseTextDecorationsInEffect.get()); + diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect, baseTextDecorationsInEffect.get()); - if (fontWeightIsBold(result.get()) == fontWeightIsBold(computedStyle)) + if (fontWeightIsBold(result.get()) == fontWeightIsBold(baseStyle)) result->removeProperty(CSSPropertyFontWeight); - if (getRGBAFontColor(result.get()) == getRGBAFontColor(computedStyle)) + if (getRGBAFontColor(result.get()) == getRGBAFontColor(baseStyle)) result->removeProperty(CSSPropertyColor); + if (getTextAlignment(result.get()) == getTextAlignment(baseStyle)) + result->removeProperty(CSSPropertyTextAlign); + return result; } @@ -439,6 +459,11 @@ static const int editingStyleProperties[] = { }; size_t numEditingStyleProperties = sizeof(editingStyleProperties)/sizeof(editingStyleProperties[0]); +RefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::removeNonEditingProperties(CSSStyleDeclaration* style) +{ + return style->copyPropertiesInSet(editingStyleProperties, numEditingStyleProperties); +} + PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle) { RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = pos.computedStyle(); @@ -446,7 +471,7 @@ PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::editingStyleAtPosition if (!computedStyleAtPosition) style = CSSMutableStyleDeclaration::create(); else - style = computedStyleAtPosition->copyPropertiesInSet(editingStyleProperties, numEditingStyleProperties); + style = removeNonEditingProperties(computedStyleAtPosition.get()); if (style && pos.node() && pos.node()->computedStyle()) { RenderStyle* renderStyle = pos.node()->computedStyle(); @@ -1161,19 +1186,22 @@ bool ApplyStyleCommand::removeStyleFromRunBeforeApplyingStyle(CSSMutableStyleDec return true; } -bool ApplyStyleCommand::removeInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element, InlineStyleRemovalMode mode) +bool ApplyStyleCommand::removeInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element, InlineStyleRemovalMode mode, CSSMutableStyleDeclaration* extractedStyle) { ASSERT(style); ASSERT(element); if (m_styledInlineElement && element->hasTagName(m_styledInlineElement->tagQName())) { - if (mode != RemoveNone) + if (mode != RemoveNone) { + if (extractedStyle && element->inlineStyleDecl()) + extractedStyle->merge(element->inlineStyleDecl()); removeNodePreservingChildren(element); + } return true; } bool removed = false; - if (removeImplicitlyStyledElement(style, element, mode)) + if (removeImplicitlyStyledElement(style, element, mode, extractedStyle)) removed = true; if (!element->inDocument()) @@ -1181,7 +1209,7 @@ bool ApplyStyleCommand::removeInlineStyleFromElement(CSSMutableStyleDeclaration* // If the node was converted to a span, the span may still contain relevant // styles which must be removed (e.g. <b style='font-weight: bold'>) - if (removeCSSStyle(style, element, mode)) + if (removeCSSStyle(style, element, mode, extractedStyle)) removed = true; return removed; @@ -1313,27 +1341,35 @@ void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*& } } -bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) +bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLElement* element, InlineStyleRemovalMode mode, CSSMutableStyleDeclaration* extractedStyle) { ASSERT(style); - ASSERT(elem); + ASSERT(element); - CSSMutableStyleDeclaration* decl = elem->inlineStyleDecl(); + CSSMutableStyleDeclaration* decl = element->inlineStyleDecl(); if (!decl) return false; bool removed = false; CSSMutableStyleDeclaration::const_iterator end = style->end(); for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { - CSSPropertyID propertyID = static_cast<CSSPropertyID>((*it).id()); + CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id()); RefPtr<CSSValue> value = decl->getPropertyCSSValue(propertyID); - if (value && (propertyID != CSSPropertyWhiteSpace || !isTabSpanNode(elem))) { + if (value && (propertyID != CSSPropertyWhiteSpace || !isTabSpanNode(element))) { removed = true; if (mode == RemoveNone) return true; - removeCSSProperty(elem, propertyID); - if (propertyID == CSSPropertyUnicodeBidi && !decl->getPropertyValue(CSSPropertyDirection).isEmpty()) - removeCSSProperty(elem, CSSPropertyDirection); + + ExceptionCode ec = 0; + if (extractedStyle) + extractedStyle->setProperty(propertyID, value->cssText(), decl->getPropertyPriority(propertyID), ec); + removeCSSProperty(element, propertyID); + + if (propertyID == CSSPropertyUnicodeBidi && !decl->getPropertyValue(CSSPropertyDirection).isEmpty()) { + if (extractedStyle) + extractedStyle->setProperty(CSSPropertyDirection, decl->getPropertyValue(CSSPropertyDirection), decl->getPropertyPriority(CSSPropertyDirection), ec); + removeCSSProperty(element, CSSPropertyDirection); + } } } @@ -1342,10 +1378,10 @@ bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLEl // No need to serialize <foo style=""> if we just removed the last css property if (decl->isEmpty()) - removeNodeAttribute(elem, styleAttr); + removeNodeAttribute(element, styleAttr); - if (isSpanWithoutAttributesOrUnstyleStyleSpan(elem)) - removeNodePreservingChildren(elem); + if (isSpanWithoutAttributesOrUnstyleStyleSpan(element)) + removeNodePreservingChildren(element); return removed; } @@ -1370,51 +1406,6 @@ HTMLElement* ApplyStyleCommand::highestAncestorWithConflictingInlineStyle(CSSMut return result; } -PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractInlineStyleToPushDown(CSSMutableStyleDeclaration* styleToApply, Node* node, bool isStyledElement) -{ - ASSERT(node); - ASSERT(node->isElementNode()); - - // non-html elements not handled yet - if (!node->isHTMLElement()) - return 0; - - HTMLElement* element = static_cast<HTMLElement*>(node); - RefPtr<CSSMutableStyleDeclaration> style = element->inlineStyleDecl(); - if (isStyledElement) { - removeNodePreservingChildren(element); - return style.release(); - } - - if (!style) { - style = CSSMutableStyleDeclaration::create(); - removeImplicitlyStyledElement(styleToApply, element, RemoveIfNeeded, style.get()); - return style.release(); - } - - Vector<int> properties; - CSSMutableStyleDeclaration::const_iterator end = styleToApply->end(); - for (CSSMutableStyleDeclaration::const_iterator it = styleToApply->begin(); it != end; ++it) - properties.append(it->id()); - - style = style->copyPropertiesInSet(properties.data(), properties.size()); - for (size_t i = 0; i < properties.size(); i++) { - RefPtr<CSSValue> property = style->getPropertyCSSValue(properties[i]); - if (property) - removeCSSProperty(element, static_cast<CSSPropertyID>(properties[i])); - } - - if (element->inlineStyleDecl() && element->inlineStyleDecl()->isEmpty()) - removeNodeAttribute(element, styleAttr); - - if (isSpanWithoutAttributesOrUnstyleStyleSpan(element)) - removeNodePreservingChildren(element); - - removeImplicitlyStyledElement(styleToApply, element, RemoveIfNeeded, style.get()); - - return style.release(); -} - void ApplyStyleCommand::applyInlineStyleToPushDown(Node* node, CSSMutableStyleDeclaration* style) { ASSERT(node); @@ -1437,11 +1428,9 @@ void ApplyStyleCommand::applyInlineStyleToPushDown(Node* node, CSSMutableStyleDe newInlineStyle->setProperty(it->id(), it->value()->cssText(), it->isImportant(), ec); // text-decorations adds up - if (it->id() == CSSPropertyTextDecoration) { - ASSERT(it->value()->isValueList()); + if (it->id() == CSSPropertyTextDecoration && it->value()->isValueList()) { RefPtr<CSSValue> textDecoration = newInlineStyle->getPropertyCSSValue(CSSPropertyTextDecoration); - if (textDecoration) { - ASSERT(textDecoration->isValueList()); + if (textDecoration && textDecoration->isValueList()) { CSSValueList* textDecorationOfInlineStyle = static_cast<CSSValueList*>(textDecoration.get()); CSSValueList* textDecorationOfStyleApplied = static_cast<CSSValueList*>(it->value()); @@ -1492,7 +1481,8 @@ void ApplyStyleCommand::pushDownInlineStyleAroundNode(CSSMutableStyleDeclaration RefPtr<StyledElement> styledElement; if (current->isStyledElement() && m_styledInlineElement && current->hasTagName(m_styledInlineElement->tagQName())) styledElement = static_cast<StyledElement*>(current); - RefPtr<CSSMutableStyleDeclaration> styleToPushDown = extractInlineStyleToPushDown(style, current, styledElement); + RefPtr<CSSMutableStyleDeclaration> styleToPushDown = CSSMutableStyleDeclaration::create(); + removeInlineStyleFromElement(style, static_cast<HTMLElement*>(current), RemoveIfNeeded, styleToPushDown.get()); // The inner loop will go through children on each level // FIXME: we should aggregate inline child elements together so that we don't wrap each child separately. diff --git a/WebCore/editing/ApplyStyleCommand.h b/WebCore/editing/ApplyStyleCommand.h index 78f592e..eb6a2bc 100644 --- a/WebCore/editing/ApplyStyleCommand.h +++ b/WebCore/editing/ApplyStyleCommand.h @@ -57,7 +57,8 @@ public: { return adoptRef(new ApplyStyleCommand(element, removeOnly, action)); } - + + static RefPtr<CSSMutableStyleDeclaration> removeNonEditingProperties(CSSStyleDeclaration* style); static PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle = IgnoreTypingStyle); private: @@ -72,13 +73,12 @@ private: // style-removal helpers bool removeStyleFromRunBeforeApplyingStyle(CSSMutableStyleDeclaration* style, Node*& runStart, Node*& runEnd); - bool removeInlineStyleFromElement(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveIfNeeded); + bool removeInlineStyleFromElement(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveIfNeeded, CSSMutableStyleDeclaration* extractedStyle = 0); inline bool shouldRemoveInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element) {return removeInlineStyleFromElement(style, element, RemoveNone);} - bool removeImplicitlyStyledElement(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode, CSSMutableStyleDeclaration* extractedStyle = 0); + bool removeImplicitlyStyledElement(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode, CSSMutableStyleDeclaration* extractedStyle); void replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*&); - bool removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveIfNeeded); + bool removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveIfNeeded, CSSMutableStyleDeclaration* extractedStyle = 0); HTMLElement* highestAncestorWithConflictingInlineStyle(CSSMutableStyleDeclaration*, Node*); - PassRefPtr<CSSMutableStyleDeclaration> extractInlineStyleToPushDown(CSSMutableStyleDeclaration*, Node*, bool isStyledElement); void applyInlineStyleToPushDown(Node*, CSSMutableStyleDeclaration *style); void pushDownInlineStyleAroundNode(CSSMutableStyleDeclaration*, Node*); void removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>, const Position& start, const Position& end); @@ -126,7 +126,7 @@ private: bool isStyleSpan(const Node*); PassRefPtr<HTMLElement> createStyleSpanElement(Document*); -RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle); +RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); void prepareEditingStyleToApplyAt(CSSMutableStyleDeclaration*, Position); void removeStylesAddedByNode(CSSMutableStyleDeclaration*, Node*); diff --git a/WebCore/editing/DeleteFromTextNodeCommand.cpp b/WebCore/editing/DeleteFromTextNodeCommand.cpp index f1d79af..fe572e1 100644 --- a/WebCore/editing/DeleteFromTextNodeCommand.cpp +++ b/WebCore/editing/DeleteFromTextNodeCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "DeleteFromTextNodeCommand.h" +#include "AXObjectCache.h" #include "Text.h" namespace WebCore { @@ -53,6 +54,10 @@ void DeleteFromTextNodeCommand::doApply() if (ec) return; + // Need to notify this before actually deleting the text + if (AXObjectCache::accessibilityEnabled()) + document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextDeleted, m_offset, m_count); + m_node->deleteData(m_offset, m_count, ec); } @@ -65,6 +70,9 @@ void DeleteFromTextNodeCommand::doUnapply() ExceptionCode ec; m_node->insertData(m_offset, m_text, ec); + + if (AXObjectCache::accessibilityEnabled()) + document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextInserted, m_offset, m_count); } } // namespace WebCore diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp index 4aa5c3c..4aca57e 100644 --- a/WebCore/editing/DeleteSelectionCommand.cpp +++ b/WebCore/editing/DeleteSelectionCommand.cpp @@ -443,11 +443,7 @@ void DeleteSelectionCommand::handleGeneralDelete() return; if (startNode == m_downstreamEnd.node()) { - // The selection to delete is all in one node. - if (!startNode->renderer() || (startOffset == 0 && m_downstreamEnd.atLastEditingPositionForNode())) { - // just delete - removeNode(startNode); - } else if (m_downstreamEnd.deprecatedEditingOffset() - startOffset > 0) { + if (m_downstreamEnd.deprecatedEditingOffset() - startOffset > 0) { if (startNode->isTextNode()) { // in a text node that needs to be trimmed Text* text = static_cast<Text*>(startNode); @@ -457,6 +453,10 @@ void DeleteSelectionCommand::handleGeneralDelete() m_endingPosition = m_upstreamStart; } } + + // The selection to delete is all in one node. + if (!startNode->renderer() || (!startOffset && m_downstreamEnd.atLastEditingPositionForNode())) + removeNode(startNode); } else { bool startNodeWasDescendantOfEndNode = m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node()); @@ -472,6 +472,9 @@ void DeleteSelectionCommand::handleGeneralDelete() } else { node = startNode->childNode(startOffset); } + } else if (startNode == m_upstreamEnd.node() && startNode->isTextNode()) { + Text* text = static_cast<Text*>(m_upstreamEnd.node()); + deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset()); } // handle deleting all nodes that are completely selected diff --git a/WebCore/editing/EditingBehavior.h b/WebCore/editing/EditingBehavior.h index d442ad6..842d3f2 100644 --- a/WebCore/editing/EditingBehavior.h +++ b/WebCore/editing/EditingBehavior.h @@ -53,6 +53,10 @@ public: // style has to be present throughout the selection. bool shouldToggleStyleBasedOnStartOfSelection() const { return m_type == EditingMacBehavior; } + // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the base + // in place and moving the extent. Matches NSTextView. + bool shouldAlwaysGrowSelectionWhenExtendingToBoundary() const { return m_type == EditingMacBehavior; } + private: EditingBehaviorType m_type; }; diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp index 24c1680..b267637 100644 --- a/WebCore/editing/Editor.cpp +++ b/WebCore/editing/Editor.cpp @@ -862,9 +862,9 @@ static const int textOnlyProperties[] = { CSSPropertyColor, }; -static TriState triStateOfStyleInComputedStyle(CSSStyleDeclaration* desiredStyle, CSSComputedStyleDeclaration* computedStyle, bool ignoreTextOnlyProperties = false) +static TriState triStateOfStyle(CSSStyleDeclaration* desiredStyle, CSSStyleDeclaration* styleToCompare, bool ignoreTextOnlyProperties = false) { - RefPtr<CSSMutableStyleDeclaration> diff = getPropertiesNotInComputedStyle(desiredStyle, computedStyle); + RefPtr<CSSMutableStyleDeclaration> diff = getPropertiesNotIn(desiredStyle, styleToCompare); if (ignoreTextOnlyProperties) diff->removePropertiesInSet(textOnlyProperties, sizeof(textOnlyProperties) / sizeof(textOnlyProperties[0])); @@ -878,17 +878,11 @@ static TriState triStateOfStyleInComputedStyle(CSSStyleDeclaration* desiredStyle bool Editor::selectionStartHasStyle(CSSStyleDeclaration* style) const { - Node* nodeToRemove; - RefPtr<CSSComputedStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove); + bool shouldUseFixedFontDefaultSize; + RefPtr<CSSMutableStyleDeclaration> selectionStyle = selectionComputedStyle(shouldUseFixedFontDefaultSize); if (!selectionStyle) return false; - TriState state = triStateOfStyleInComputedStyle(style, selectionStyle.get()); - if (nodeToRemove) { - ExceptionCode ec = 0; - nodeToRemove->remove(ec); - ASSERT(!ec); - } - return state == TrueTriState; + return triStateOfStyle(style, selectionStyle.get()) == TrueTriState; } TriState Editor::selectionHasStyle(CSSStyleDeclaration* style) const @@ -896,21 +890,16 @@ TriState Editor::selectionHasStyle(CSSStyleDeclaration* style) const TriState state = FalseTriState; if (!m_frame->selection()->isRange()) { - Node* nodeToRemove; - RefPtr<CSSComputedStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove); + bool shouldUseFixedFontDefaultSize; + RefPtr<CSSMutableStyleDeclaration> selectionStyle = selectionComputedStyle(shouldUseFixedFontDefaultSize); if (!selectionStyle) return FalseTriState; - state = triStateOfStyleInComputedStyle(style, selectionStyle.get()); - if (nodeToRemove) { - ExceptionCode ec = 0; - nodeToRemove->remove(ec); - ASSERT(!ec); - } + state = triStateOfStyle(style, selectionStyle.get()); } else { for (Node* node = m_frame->selection()->start().node(); node; node = node->traverseNextNode()) { RefPtr<CSSComputedStyleDeclaration> nodeStyle = computedStyle(node); if (nodeStyle) { - TriState nodeState = triStateOfStyleInComputedStyle(style, nodeStyle.get(), !node->isTextNode()); + TriState nodeState = triStateOfStyle(style, nodeStyle.get(), !node->isTextNode()); if (node == m_frame->selection()->start().node()) state = nodeState; else if (state != nodeState && node->isTextNode()) { @@ -944,8 +933,8 @@ static bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) String Editor::selectionStartCSSPropertyValue(int propertyID) { - Node* nodeToRemove; - RefPtr<CSSComputedStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove); + bool shouldUseFixedFontDefaultSize = false; + RefPtr<CSSMutableStyleDeclaration> selectionStyle = selectionComputedStyle(shouldUseFixedFontDefaultSize); if (!selectionStyle) return String(); @@ -958,7 +947,7 @@ String Editor::selectionStartCSSPropertyValue(int propertyID) RefPtr<Range> range(m_frame->selection()->toNormalizedRange()); ExceptionCode ec = 0; for (Node* ancestor = range->commonAncestorContainer(ec); ancestor; ancestor = ancestor->parentNode()) { - selectionStyle = computedStyle(ancestor); + selectionStyle = computedStyle(ancestor)->copy(); if (!hasTransparentBackgroundColor(selectionStyle.get())) { value = selectionStyle->getPropertyValue(CSSPropertyBackgroundColor); break; @@ -970,16 +959,10 @@ String Editor::selectionStartCSSPropertyValue(int propertyID) RefPtr<CSSValue> cssValue = selectionStyle->getPropertyCSSValue(CSSPropertyFontSize); ASSERT(cssValue->isPrimitiveValue()); int fontPixelSize = static_cast<CSSPrimitiveValue*>(cssValue.get())->getIntValue(CSSPrimitiveValue::CSS_PX); - int size = CSSStyleSelector::legacyFontSize(m_frame->document(), fontPixelSize, selectionStyle->useFixedFontDefaultSize()); + int size = CSSStyleSelector::legacyFontSize(m_frame->document(), fontPixelSize, shouldUseFixedFontDefaultSize); value = String::number(size); } - if (nodeToRemove) { - ExceptionCode ec = 0; - nodeToRemove->remove(ec); - ASSERT(!ec); - } - return value; } @@ -1027,7 +1010,8 @@ void Editor::appliedEditing(PassRefPtr<EditCommand> cmd) if (client()) client()->registerCommandForUndo(m_lastEditCommand); } - respondToChangedContents(newSelection); + respondToChangedContents(newSelection); + stopCorrectionPanelTimer(); } void Editor::unappliedEditing(PassRefPtr<EditCommand> cmd) @@ -2675,6 +2659,10 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh || result->type == TextCheckingTypeCorrection)) { // In this case the result range just has to touch the spelling range, so we can handle replacing non-word text such as punctuation. ASSERT(resultLength > 0 && resultLocation >= 0); + + if (shouldShowCorrectionPanel && resultLocation + resultLength < spellingRangeEndOffset) + continue; + int replacementLength = result->replacement.length(); bool doReplacement = (replacementLength > 0); RefPtr<Range> rangeToReplace = TextIterator::subrange(paragraphRange.get(), resultLocation, resultLength); @@ -2728,7 +2716,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh if (shouldShowCorrectionPanel && resultLocation + resultLength == spellingRangeEndOffset && result->type == TextCheckingTypeCorrection) { // We only show the correction panel on the last word. Vector<FloatQuad> textQuads; - rangeToReplace->textQuads(textQuads); + rangeToReplace->getBorderAndTextQuads(textQuads); Vector<FloatQuad>::const_iterator end = textQuads.end(); FloatRect totalBoundingBox; for (Vector<FloatQuad>::const_iterator it = textQuads.begin(); it < end; ++it) @@ -2753,6 +2741,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh // Add a marker so that corrections can easily be undone and won't be re-corrected. RefPtr<Range> replacedRange = TextIterator::subrange(paragraphRange.get(), resultLocation, replacementLength); replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::Replacement, replacedString); + replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::CorrectionIndicator); } } } @@ -2844,6 +2833,13 @@ void Editor::startCorrectionPanelTimer() #endif } +void Editor::stopCorrectionPanelTimer() +{ +#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + m_correctionPanelTimer.stop(); +#endif +} + void Editor::handleCancelOperation() { #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) @@ -3127,6 +3123,13 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, b if (newSelection.start().isOrphan() || newSelection.end().isOrphan()) return; +#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + // Check to see if the command introduced paragraph separator. If it did, we remove existing autocorrection underlines. + // This is in consistency with the behavior in AppKit + if (!inSameParagraph(m_frame->selection()->selection().visibleStart(), newSelection.visibleEnd())) + m_frame->document()->markers()->removeMarkers(DocumentMarker::CorrectionIndicator); +#endif + // If there is no selection change, don't bother sending shouldChangeSelection, but still call setSelection, // because there is work that it must do in this situation. // The old selection can be invalid here and calling shouldChangeSelection can produce some strange calls. @@ -3246,10 +3249,8 @@ void Editor::computeAndSetTypingStyle(CSSStyleDeclaration* style, EditAction edi m_frame->selection()->setTypingStyle(mutableStyle.release()); } -PassRefPtr<CSSComputedStyleDeclaration> Editor::selectionComputedStyle(Node*& nodeToRemove) const +PassRefPtr<CSSMutableStyleDeclaration> Editor::selectionComputedStyle(bool& shouldUseFixedFontDefaultSize) const { - nodeToRemove = 0; - if (m_frame->selection()->isNone()) return 0; @@ -3269,34 +3270,19 @@ PassRefPtr<CSSComputedStyleDeclaration> Editor::selectionComputedStyle(Node*& no return 0; RefPtr<Element> styleElement = element; - ExceptionCode ec = 0; + RefPtr<CSSComputedStyleDeclaration> style = computedStyle(styleElement.release()); + RefPtr<CSSMutableStyleDeclaration> mutableStyle = style->copy(); + shouldUseFixedFontDefaultSize = style->useFixedFontDefaultSize(); - if (m_frame->selection()->typingStyle()) { - styleElement = m_frame->document()->createElement(spanTag, false); - - styleElement->setAttribute(styleAttr, m_frame->selection()->typingStyle()->cssText(), ec); - ASSERT(!ec); - - styleElement->appendChild(m_frame->document()->createEditingTextNode(""), ec); - ASSERT(!ec); - - if (element->renderer() && element->renderer()->canHaveChildren()) - element->appendChild(styleElement, ec); - else { - Node* parent = element->parent(); - Node* next = element->nextSibling(); - - if (next) - parent->insertBefore(styleElement, next, ec); - else - parent->appendChild(styleElement, ec); - } - ASSERT(!ec); + if (!m_frame->selection()->typingStyle()) + return mutableStyle; - nodeToRemove = styleElement.get(); - } + RefPtr<CSSMutableStyleDeclaration> typingStyle = m_frame->selection()->typingStyle()->copy(); + ApplyStyleCommand::removeNonEditingProperties(typingStyle.get()); + prepareEditingStyleToApplyAt(typingStyle.get(), position); + mutableStyle->merge(typingStyle.get()); - return computedStyle(styleElement.release()); + return mutableStyle; } void Editor::textFieldDidBeginEditing(Element* e) diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h index 7a4a185..f167b16 100644 --- a/WebCore/editing/Editor.h +++ b/WebCore/editing/Editor.h @@ -347,7 +347,7 @@ public: bool markedTextMatchesAreHighlighted() const; void setMarkedTextMatchesAreHighlighted(bool); - PassRefPtr<CSSComputedStyleDeclaration> selectionComputedStyle(Node*& nodeToRemove) const; + PassRefPtr<CSSMutableStyleDeclaration> selectionComputedStyle(bool& shouldUseFixedFontDefaultSize) const; void textFieldDidBeginEditing(Element*); void textFieldDidEndEditing(Element*); @@ -402,6 +402,7 @@ private: void changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle); void correctionPanelTimerFired(Timer<Editor>*); Node* findEventTargetFromSelection() const; + void stopCorrectionPanelTimer(); }; inline void Editor::setStartNewKillRingSequence(bool flag) diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 1b1f14f..616c07b 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -131,8 +131,8 @@ static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditActi static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, CSSValue* value) { ExceptionCode ec = 0; - Node* nodeToRemove = 0; - RefPtr<CSSComputedStyleDeclaration> selectionStyle = frame->editor()->selectionComputedStyle(nodeToRemove); + bool shouldUseFixedFontDefaultSize; + RefPtr<CSSMutableStyleDeclaration> selectionStyle = frame->editor()->selectionComputedStyle(shouldUseFixedFontDefaultSize); if (!selectionStyle) return false; @@ -148,12 +148,6 @@ static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E } else if (selectedCSSValue->cssText() == "none") newStyle = value->cssText(); - ASSERT(!ec); - if (nodeToRemove) { - nodeToRemove->remove(ec); - ASSERT(!ec); - } - // FIXME: We shouldn't be having to convert new style into text. We should have setPropertyCSSValue. RefPtr<CSSMutableStyleDeclaration> newMutableStyle = CSSMutableStyleDeclaration::create(); newMutableStyle->setProperty(propertyID, newStyle, ec); @@ -166,10 +160,9 @@ static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAct style->setProperty(propertyID, onValue); // We need to add this style to pass it to selectionStartHasStyle / selectionHasStyle // Style is considered present when - // mac: present at the beginning of selection + // Mac: present at the beginning of selection // other: present throughout the selection - // FIXME: Make stateStyle() to use this editing method too for the cases where it's used for queryCommandState. bool styleIsPresent; if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection()) styleIsPresent = frame->editor()->selectionStartHasStyle(style.get()); @@ -237,6 +230,9 @@ static TriState stateStyle(Frame* frame, int propertyID, const char* desiredValu { RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); style->setProperty(propertyID, desiredValue); + + if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection()) + return frame->editor()->selectionStartHasStyle(style.get()) ? TrueTriState : FalseTriState; return frame->editor()->selectionHasStyle(style.get()); } @@ -1303,6 +1299,21 @@ static TriState stateUnorderedList(Frame* frame, Event*) return frame->editor()->selectionUnorderedListState(); } +static TriState stateJustifyCenter(Frame* frame, Event*) +{ + return stateStyle(frame, CSSPropertyTextAlign, "center"); +} + +static TriState stateJustifyLeft(Frame* frame, Event*) +{ + return stateStyle(frame, CSSPropertyTextAlign, "left"); +} + +static TriState stateJustifyRight(Frame* frame, Event*) +{ + return stateStyle(frame, CSSPropertyTextAlign, "right"); +} + // Value functions static String valueNull(Frame*, Event*) @@ -1389,20 +1400,20 @@ static const CommandMap& createCommandMap() { "InsertText", { executeInsertText, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } }, { "InsertUnorderedList", { executeInsertUnorderedList, supported, enabledInRichlyEditableText, stateUnorderedList, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "Italic", { executeToggleItalic, supported, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "JustifyCenter", { executeJustifyCenter, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "JustifyCenter", { executeJustifyCenter, supported, enabledInRichlyEditableText, stateJustifyCenter, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "JustifyFull", { executeJustifyFull, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "JustifyLeft", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "JustifyLeft", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateJustifyLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "JustifyNone", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "JustifyRight", { executeJustifyRight, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "JustifyRight", { executeJustifyRight, supported, enabledInRichlyEditableText, stateJustifyRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MakeTextWritingDirectionLeftToRight", { executeMakeTextWritingDirectionLeftToRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionLeftToRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MakeTextWritingDirectionNatural", { executeMakeTextWritingDirectionNatural, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionNatural, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MakeTextWritingDirectionRightToLeft", { executeMakeTextWritingDirectionRightToLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionRightToLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveBackward", { executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveBackward", { executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveDown", { executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveForward", { executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveForward", { executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveLeft", { executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveLeftAndModifySelection", { executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MovePageDown", { executeMovePageDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, @@ -1415,30 +1426,30 @@ static const CommandMap& createCommandMap() { "MoveRightAndModifySelection", { executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToBeginningOfDocument", { executeMoveToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToBeginningOfDocumentAndModifySelection", { executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToBeginningOfLine", { executeMoveToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToBeginningOfLineAndModifySelection", { executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToBeginningOfParagraph", { executeMoveToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToBeginningOfParagraphAndModifySelection", { executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToBeginningOfSentence", { executeMoveToBeginningOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToBeginningOfSentenceAndModifySelection", { executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToBeginningOfLine", { executeMoveToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToBeginningOfLineAndModifySelection", { executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToBeginningOfParagraph", { executeMoveToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToBeginningOfParagraphAndModifySelection", { executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToBeginningOfSentence", { executeMoveToBeginningOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToBeginningOfSentenceAndModifySelection", { executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToEndOfDocument", { executeMoveToEndOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToEndOfDocumentAndModifySelection", { executeMoveToEndOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToEndOfLine", { executeMoveToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToEndOfLineAndModifySelection", { executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToEndOfParagraph", { executeMoveToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToEndOfParagraphAndModifySelection", { executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToEndOfSentence", { executeMoveToEndOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveToEndOfSentenceAndModifySelection", { executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToEndOfLine", { executeMoveToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToEndOfLineAndModifySelection", { executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToEndOfParagraph", { executeMoveToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToEndOfParagraphAndModifySelection", { executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToEndOfSentence", { executeMoveToEndOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveToEndOfSentenceAndModifySelection", { executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToLeftEndOfLine", { executeMoveToLeftEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToLeftEndOfLineAndModifySelection", { executeMoveToLeftEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToRightEndOfLine", { executeMoveToRightEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveToRightEndOfLineAndModifySelection", { executeMoveToRightEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveUp", { executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveWordBackward", { executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveWordForward", { executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "MoveWordForwardAndModifySelection", { executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveWordBackward", { executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveWordForward", { executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, + { "MoveWordForwardAndModifySelection", { executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveWordLeft", { executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveWordLeftAndModifySelection", { executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "MoveWordRight", { executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, diff --git a/WebCore/editing/FormatBlockCommand.cpp b/WebCore/editing/FormatBlockCommand.cpp index 221aecf..6bb8ad5 100644 --- a/WebCore/editing/FormatBlockCommand.cpp +++ b/WebCore/editing/FormatBlockCommand.cpp @@ -41,33 +41,6 @@ FormatBlockCommand::FormatBlockCommand(Document* document, const AtomicString& t { } -bool FormatBlockCommand::modifyRange() -{ - ASSERT(endingSelection().isRange()); - VisiblePosition visibleStart = endingSelection().visibleStart(); - VisiblePosition visibleEnd = endingSelection().visibleEnd(); - VisiblePosition startOfLastParagraph = startOfParagraph(visibleEnd); - - if (startOfParagraph(visibleStart) == startOfLastParagraph) - return false; - - setEndingSelection(visibleStart); - doApply(); - visibleStart = endingSelection().visibleStart(); - VisiblePosition nextParagraph = endOfParagraph(visibleStart).next(); - while (nextParagraph.isNotNull() && nextParagraph != startOfLastParagraph) { - setEndingSelection(nextParagraph); - doApply(); - nextParagraph = endOfParagraph(endingSelection().visibleStart()).next(); - } - setEndingSelection(visibleEnd); - doApply(); - visibleEnd = endingSelection().visibleEnd(); - setEndingSelection(VisibleSelection(visibleStart.deepEquivalent(), visibleEnd.deepEquivalent(), DOWNSTREAM)); - - return true; -} - void FormatBlockCommand::doApply() { if (!endingSelection().isNonOrphanedCaretOrRange()) @@ -86,12 +59,35 @@ void FormatBlockCommand::doApply() // FIXME: We paint the gap before some paragraphs that are indented with left // margin/padding, but not others. We should make the gap painting more consistent and // then use a left margin/padding rule here. - if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) + if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) { setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(true))); + visibleEnd = endingSelection().visibleEnd(); + } - if (endingSelection().isRange() && modifyRange()) + VisiblePosition startOfLastParagraph = startOfParagraph(visibleEnd); + if (endingSelection().isCaret() || startOfParagraph(visibleStart) == startOfLastParagraph) { + doApplyForSingleParagraph(); return; + } + + setEndingSelection(visibleStart); + doApplyForSingleParagraph(); + visibleStart = endingSelection().visibleStart(); + VisiblePosition nextParagraph = endOfParagraph(visibleStart).next(); + while (nextParagraph.isNotNull() && nextParagraph != startOfLastParagraph) { + setEndingSelection(nextParagraph); + doApplyForSingleParagraph(); + nextParagraph = endOfParagraph(endingSelection().visibleStart()).next(); + } + setEndingSelection(visibleEnd); + doApplyForSingleParagraph(); + visibleEnd = endingSelection().visibleEnd(); + setEndingSelection(VisibleSelection(visibleStart.deepEquivalent(), visibleEnd.deepEquivalent(), DOWNSTREAM)); +} + +void FormatBlockCommand::doApplyForSingleParagraph() +{ ExceptionCode ec; String localName, prefix; if (!Document::parseQualifiedName(m_tagName, prefix, localName, ec)) @@ -102,14 +98,14 @@ void FormatBlockCommand::doApply() if (refNode->hasTagName(qTypeOfBlock)) // We're already in a block with the format we want, so we don't have to do anything return; - + VisiblePosition paragraphStart = startOfParagraph(endingSelection().visibleStart()); VisiblePosition paragraphEnd = endOfParagraph(endingSelection().visibleStart()); VisiblePosition blockStart = startOfBlock(endingSelection().visibleStart()); VisiblePosition blockEnd = endOfBlock(endingSelection().visibleStart()); RefPtr<Element> blockNode = createHTMLElement(document(), m_tagName); RefPtr<Element> placeholder = createBreakElement(document()); - + Node* root = endingSelection().start().node()->rootEditableElement(); if (validBlockTag(refNode->nodeName().lower()) && paragraphStart == blockStart && paragraphEnd == blockEnd && @@ -122,7 +118,7 @@ void FormatBlockCommand::doApply() insertNodeAt(blockNode, paragraphStart.deepEquivalent().upstream()); } appendNode(placeholder, blockNode); - + VisiblePosition destination(Position(placeholder.get(), 0)); if (paragraphStart == paragraphEnd && !lineBreakExistsAtVisiblePosition(paragraphStart)) { setEndingSelection(destination); diff --git a/WebCore/editing/FormatBlockCommand.h b/WebCore/editing/FormatBlockCommand.h index 1c8d814..70e6fa6 100644 --- a/WebCore/editing/FormatBlockCommand.h +++ b/WebCore/editing/FormatBlockCommand.h @@ -41,9 +41,9 @@ private: FormatBlockCommand(Document*, const AtomicString& tagName); virtual void doApply(); + void doApplyForSingleParagraph(); virtual EditAction editingAction() const { return EditActionFormatBlock; } - bool modifyRange(); AtomicString m_tagName; }; diff --git a/WebCore/editing/InsertIntoTextNodeCommand.cpp b/WebCore/editing/InsertIntoTextNodeCommand.cpp index 9c3423a..9b7761c 100644 --- a/WebCore/editing/InsertIntoTextNodeCommand.cpp +++ b/WebCore/editing/InsertIntoTextNodeCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "InsertIntoTextNodeCommand.h" +#include "AXObjectCache.h" #include "Text.h" namespace WebCore { @@ -48,6 +49,9 @@ void InsertIntoTextNodeCommand::doApply() ExceptionCode ec; m_node->insertData(m_offset, m_text, ec); + + if (AXObjectCache::accessibilityEnabled()) + document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextInserted, m_offset, m_text.length()); } void InsertIntoTextNodeCommand::doUnapply() @@ -55,6 +59,10 @@ void InsertIntoTextNodeCommand::doUnapply() if (!m_node->isContentEditable()) return; + // Need to notify this before actually deleting the text + if (AXObjectCache::accessibilityEnabled()) + document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextDeleted, m_offset, m_text.length()); + ExceptionCode ec; m_node->deleteData(m_offset, m_text.length(), ec); } diff --git a/WebCore/editing/InsertNodeBeforeCommand.cpp b/WebCore/editing/InsertNodeBeforeCommand.cpp index 2ce9846..fb72312 100644 --- a/WebCore/editing/InsertNodeBeforeCommand.cpp +++ b/WebCore/editing/InsertNodeBeforeCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "InsertNodeBeforeCommand.h" +#include "AXObjectCache.h" #include "htmlediting.h" namespace WebCore { @@ -51,6 +52,9 @@ void InsertNodeBeforeCommand::doApply() ExceptionCode ec; parent->insertBefore(m_insertChild.get(), m_refChild.get(), ec); + + if (AXObjectCache::accessibilityEnabled()) + document()->axObjectCache()->nodeTextChangeNotification(m_insertChild->renderer(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue().length()); } void InsertNodeBeforeCommand::doUnapply() @@ -58,6 +62,10 @@ void InsertNodeBeforeCommand::doUnapply() if (!m_insertChild->isContentEditable()) return; + // Need to notify this before actually deleting the text + if (AXObjectCache::accessibilityEnabled()) + document()->axObjectCache()->nodeTextChangeNotification(m_insertChild->renderer(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue().length()); + ExceptionCode ec; m_insertChild->remove(ec); } diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp index c04fe25..c9295d3 100644 --- a/WebCore/editing/SelectionController.cpp +++ b/WebCore/editing/SelectionController.cpp @@ -622,24 +622,18 @@ VisiblePosition SelectionController::modifyMovingBackward(TextGranularity granul return pos; } -bool SelectionController::modify(EAlteration alter, EDirection dir, TextGranularity granularity, bool userTriggered) -{ - Settings* settings = m_frame ? m_frame->settings() : 0; - return modify(alter, dir, granularity, userTriggered, settings); -} - static bool isBoundary(TextGranularity granularity) { return granularity == LineBoundary || granularity == ParagraphBoundary || granularity == DocumentBoundary; } -bool SelectionController::modify(EAlteration alter, EDirection direction, TextGranularity granularity, bool userTriggered, Settings* settings) +bool SelectionController::modify(EAlteration alter, EDirection direction, TextGranularity granularity, bool userTriggered) { if (userTriggered) { SelectionController trialSelectionController; trialSelectionController.setSelection(m_selection); trialSelectionController.setIsDirectional(m_isDirectional); - trialSelectionController.modify(alter, direction, granularity, false, settings); + trialSelectionController.modify(alter, direction, granularity, false); bool change = shouldChangeSelection(trialSelectionController.selection()); if (!change) @@ -690,16 +684,17 @@ bool SelectionController::modify(EAlteration alter, EDirection direction, TextGr moveTo(position, userTriggered); break; case AlterationExtend: - if (!settings || settings->editingBehaviorType() != EditingMacBehavior || m_selection.isCaret() || !isBoundary(granularity)) + // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the + // base in place and moving the extent. Matches NSTextView. + if (!m_frame || !m_frame->editor()->behavior().shouldAlwaysGrowSelectionWhenExtendingToBoundary() || m_selection.isCaret() || !isBoundary(granularity)) setExtent(position, userTriggered); else { - // Standard Mac behavior when extending to a boundary is grow the selection rather - // than leaving the base in place and moving the extent. Matches NSTextView. if (direction == DirectionForward || direction == DirectionRight) setEnd(position, userTriggered); else setStart(position, userTriggered); } + break; } if (granularity == LineGranularity || granularity == ParagraphGranularity) diff --git a/WebCore/editing/SelectionController.h b/WebCore/editing/SelectionController.h index 90018cd..e5fe71b 100644 --- a/WebCore/editing/SelectionController.h +++ b/WebCore/editing/SelectionController.h @@ -181,8 +181,6 @@ private: VisiblePosition startForPlatform() const; VisiblePosition endForPlatform() const; - bool modify(EAlteration, EDirection, TextGranularity, bool userTriggered, Settings*); - VisiblePosition modifyExtendingRight(TextGranularity); VisiblePosition modifyExtendingForward(TextGranularity); VisiblePosition modifyMovingRight(TextGranularity); @@ -249,7 +247,7 @@ inline void SelectionController::setTypingStyle(PassRefPtr<CSSMutableStyleDeclar m_typingStyle = style; } -#if !(PLATFORM(MAC) || PLATFORM(GTK)) +#if !(PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(CHROMIUM)) inline void SelectionController::notifyAccessibilityForSelectionChange() { } diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp index d5a03ef..0612986 100644 --- a/WebCore/editing/TextIterator.cpp +++ b/WebCore/editing/TextIterator.cpp @@ -782,7 +782,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node) || node->hasTagName(pTag)) { RenderStyle* style = r->style(); if (style) { - int bottomMargin = toRenderBox(r)->collapsedMarginBottom(); + int bottomMargin = toRenderBox(r)->collapsedMarginAfter(); int fontSize = style->fontDescription().computedPixelSize(); if (bottomMargin * 2 >= fontSize) return true; @@ -1534,7 +1534,7 @@ const UChar* WordAwareIterator::characters() const // -------- -static inline UChar foldQuoteMark(UChar c) +static inline UChar foldQuoteMarkOrSoftHyphen(UChar c) { switch (c) { case hebrewPunctuationGershayim: @@ -1545,12 +1545,16 @@ static inline UChar foldQuoteMark(UChar c) case leftSingleQuotationMark: case rightSingleQuotationMark: return '\''; + case softHyphen: + // Replace soft hyphen with an ignorable character so that their presence or absence will + // not affect string comparison. + return 0; default: return c; } } -static inline void foldQuoteMarks(String& s) +static inline void foldQuoteMarksAndSoftHyphens(String& s) { s.replace(hebrewPunctuationGeresh, '\''); s.replace(hebrewPunctuationGershayim, '"'); @@ -1558,14 +1562,17 @@ static inline void foldQuoteMarks(String& s) s.replace(leftSingleQuotationMark, '\''); s.replace(rightDoubleQuotationMark, '"'); s.replace(rightSingleQuotationMark, '\''); + // Replace soft hyphen with an ignorable character so that their presence or absence will + // not affect string comparison. + s.replace(softHyphen, 0); } #if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION -static inline void foldQuoteMarks(UChar* data, size_t length) +static inline void foldQuoteMarksAndSoftHyphens(UChar* data, size_t length) { for (size_t i = 0; i < length; ++i) - data[i] = foldQuoteMark(data[i]); + data[i] = foldQuoteMarkOrSoftHyphen(data[i]); } static const size_t minimumSearchBufferSize = 8192; @@ -1819,7 +1826,7 @@ inline SearchBuffer::SearchBuffer(const String& target, bool isCaseSensitive) // FIXME: We'd like to tailor the searcher to fold quote marks for us instead // of doing it in a separate replacement pass here, but ICU doesn't offer a way // to add tailoring on top of the locale-specific tailoring as of this writing. - foldQuoteMarks(m_target); + foldQuoteMarksAndSoftHyphens(m_target); size_t targetLength = m_target.length(); m_buffer.reserveInitialCapacity(max(targetLength * 8, minimumSearchBufferSize)); @@ -1869,7 +1876,7 @@ inline size_t SearchBuffer::append(const UChar* characters, size_t length) size_t usableLength = min(m_buffer.capacity() - oldLength, length); ASSERT(usableLength); m_buffer.append(characters, usableLength); - foldQuoteMarks(m_buffer.data() + oldLength, usableLength); + foldQuoteMarksAndSoftHyphens(m_buffer.data() + oldLength, usableLength); return usableLength; } @@ -2008,7 +2015,7 @@ inline SearchBuffer::SearchBuffer(const String& target, bool isCaseSensitive) { ASSERT(!m_target.isEmpty()); m_target.replace(noBreakSpace, ' '); - foldQuoteMarks(m_target); + foldQuoteMarksAndSoftHyphens(m_target); } inline SearchBuffer::~SearchBuffer() @@ -2028,7 +2035,7 @@ inline bool SearchBuffer::atBreak() const inline void SearchBuffer::append(UChar c, bool isStart) { - m_buffer[m_cursor] = c == noBreakSpace ? ' ' : foldQuoteMark(c); + m_buffer[m_cursor] = c == noBreakSpace ? ' ' : foldQuoteMarkOrSoftHyphen(c); m_isCharacterStartBuffer[m_cursor] = isStart; if (++m_cursor == m_target.length()) { m_cursor = 0; diff --git a/WebCore/editing/TypingCommand.cpp b/WebCore/editing/TypingCommand.cpp index 1d1183a..60b3f7b 100644 --- a/WebCore/editing/TypingCommand.cpp +++ b/WebCore/editing/TypingCommand.cpp @@ -283,7 +283,7 @@ EditAction TypingCommand::editingAction() const return EditActionTyping; } -void TypingCommand::markMisspellingsAfterTyping() +void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType) { #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) if (!document()->frame()->editor()->isContinuousSpellCheckingEnabled() @@ -308,8 +308,10 @@ void TypingCommand::markMisspellingsAfterTyping() if (p1 != p2) document()->frame()->editor()->markMisspellingsAfterTypingToPosition(p1); #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) - else + else if (commandType == TypingCommand::InsertText) document()->frame()->editor()->startCorrectionPanelTimer(); +#else + UNUSED_PARAM(commandType); #endif } } @@ -317,14 +319,14 @@ void TypingCommand::markMisspellingsAfterTyping() void TypingCommand::typingAddedToOpenCommand(ETypingCommand commandTypeForAddedTyping) { updatePreservesTypingStyle(commandTypeForAddedTyping); - + #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) document()->frame()->editor()->appliedEditing(this); // Since the spellchecking code may also perform corrections and other replacements, it should happen after the typing changes. - markMisspellingsAfterTyping(); + markMisspellingsAfterTyping(commandTypeForAddedTyping); #else // The old spellchecking code requires that checking be done first, to prevent issues like that in 6864072, where <doesn't> is marked as misspelled. - markMisspellingsAfterTyping(); + markMisspellingsAfterTyping(commandTypeForAddedTyping); document()->frame()->editor()->appliedEditing(this); #endif } diff --git a/WebCore/editing/TypingCommand.h b/WebCore/editing/TypingCommand.h index 7c89a7c..60b5f2a 100644 --- a/WebCore/editing/TypingCommand.h +++ b/WebCore/editing/TypingCommand.h @@ -82,10 +82,10 @@ private: virtual bool preservesTypingStyle() const { return m_preservesTypingStyle; } void updatePreservesTypingStyle(ETypingCommand); - void markMisspellingsAfterTyping(); + void markMisspellingsAfterTyping(ETypingCommand); void typingAddedToOpenCommand(ETypingCommand); bool makeEditableRootEmpty(); - + ETypingCommand m_commandType; String m_textToInsert; bool m_openForMoreTyping; diff --git a/WebCore/editing/android/EditorAndroid.cpp b/WebCore/editing/android/EditorAndroid.cpp index 61cce01..29c0be5 100644 --- a/WebCore/editing/android/EditorAndroid.cpp +++ b/WebCore/editing/android/EditorAndroid.cpp @@ -33,7 +33,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) { - return new ClipboardAndroid(policy, false); + return new ClipboardAndroid(policy, Clipboard::CopyAndPaste); } } // namespace WebCore diff --git a/WebCore/editing/brew/EditorBrew.cpp b/WebCore/editing/brew/EditorBrew.cpp index 4a1f4d7..e609891 100644 --- a/WebCore/editing/brew/EditorBrew.cpp +++ b/WebCore/editing/brew/EditorBrew.cpp @@ -33,7 +33,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) { - return new ClipboardBrew(policy, false); + return new ClipboardBrew(policy, Clipboard::CopyAndPaste); } } // namespace WebCore diff --git a/WebCore/editing/chromium/EditorChromium.cpp b/WebCore/editing/chromium/EditorChromium.cpp index 7a13b12..c938a7e 100644 --- a/WebCore/editing/chromium/EditorChromium.cpp +++ b/WebCore/editing/chromium/EditorChromium.cpp @@ -39,7 +39,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame* frame) { - return ClipboardChromium::create(false, ChromiumDataObject::create(), policy, frame); + return ClipboardChromium::create(Clipboard::CopyAndPaste, ChromiumDataObject::create(), policy, frame); } } // namespace WebCore diff --git a/WebCore/editing/chromium/SelectionControllerChromium.cpp b/WebCore/editing/chromium/SelectionControllerChromium.cpp new file mode 100644 index 0000000..d627d9b --- /dev/null +++ b/WebCore/editing/chromium/SelectionControllerChromium.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SelectionController.h" + +#include "AXObjectCache.h" +#include "Frame.h" + +namespace WebCore { + +void SelectionController::notifyAccessibilityForSelectionChange() +{ + // FIXME: Support editable text in chromium. + if (AXObjectCache::accessibilityEnabled() && m_selection.start().isNotNull() && m_selection.end().isNotNull()) { + Document* document = m_frame->document(); + document->axObjectCache()->postNotification(m_selection.start().node()->renderer(), AXObjectCache::AXSelectedTextChanged, false); + } +} + +} // namespace WebCore diff --git a/WebCore/editing/haiku/EditorHaiku.cpp b/WebCore/editing/haiku/EditorHaiku.cpp index 4596c9e..2b3d0ba 100644 --- a/WebCore/editing/haiku/EditorHaiku.cpp +++ b/WebCore/editing/haiku/EditorHaiku.cpp @@ -37,7 +37,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) { - return ClipboardHaiku::create(policy, false); + return ClipboardHaiku::create(policy, Clipboard::CopyAndPaste); } } // namespace WebCore diff --git a/WebCore/editing/mac/EditorMac.mm b/WebCore/editing/mac/EditorMac.mm index f010908..b5e3b25 100644 --- a/WebCore/editing/mac/EditorMac.mm +++ b/WebCore/editing/mac/EditorMac.mm @@ -42,7 +42,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame* frame) { - return ClipboardMac::create(false, [NSPasteboard generalPasteboard], policy, frame); + return ClipboardMac::create(Clipboard::CopyAndPaste, [NSPasteboard generalPasteboard], policy, frame); } void Editor::showFontPanel() diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index a279808..82499bf 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -93,14 +93,15 @@ private: }; enum EntityMask { - EntityNone = 0x0000, EntityAmp = 0x0001, EntityLt = 0x0002, EntityGt = 0x0004, EntityQuot = 0x0008, EntityNbsp = 0x0010, - EntityMaskInCDATA = EntityNone, + // Non-breaking space needs to be escaped in innerHTML for compatibility reason. See http://trac.webkit.org/changeset/32879 + // However, we cannot do this in a XML document because it does not have the entity reference defined (See the bug 19215). + EntityMaskInCDATA = 0, EntityMaskInPCDATA = EntityAmp | EntityLt | EntityGt, EntityMaskInHTMLPCDATA = EntityMaskInPCDATA | EntityNbsp, EntityMaskInAttributeValue = EntityAmp | EntityLt | EntityGt | EntityQuot, diff --git a/WebCore/editing/visible_units.cpp b/WebCore/editing/visible_units.cpp index f84fec0..d9ca223 100644 --- a/WebCore/editing/visible_units.cpp +++ b/WebCore/editing/visible_units.cpp @@ -222,13 +222,16 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc // Use the character iterator to translate the next value into a DOM position. CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions); charIt.advance(next - prefixLength - 1); - pos = charIt.range()->endPosition(); + RefPtr<Range> characterRange = charIt.range(); + pos = characterRange->endPosition(); if (*charIt.characters() == '\n') { // FIXME: workaround for collapsed range (where only start position is correct) emitted for some emitted newlines (see rdar://5192593) VisiblePosition visPos = VisiblePosition(pos); - if (visPos == VisiblePosition(charIt.range()->startPosition())) - pos = visPos.next(true).deepEquivalent(); + if (visPos == VisiblePosition(characterRange->startPosition())) { + charIt.advance(1); + pos = charIt.range()->startPosition(); + } } } @@ -560,7 +563,7 @@ VisiblePosition previousLinePosition(const VisiblePosition &visiblePosition, int root = box->root()->prevRootBox(); // We want to skip zero height boxes. // This could happen in case it is a TrailingFloatsRootInlineBox. - if (root && root->height()) + if (root && root->logicalHeight()) containingBlock = renderer->containingBlock(); else root = 0; @@ -669,7 +672,7 @@ VisiblePosition nextLinePosition(const VisiblePosition &visiblePosition, int x) root = box->root()->nextRootBox(); // We want to skip zero height boxes. // This could happen in case it is a TrailingFloatsRootInlineBox. - if (root && root->height()) + if (root && root->logicalHeight()) containingBlock = renderer->containingBlock(); else root = 0; diff --git a/WebCore/editing/wx/EditorWx.cpp b/WebCore/editing/wx/EditorWx.cpp index a2ec654..83d6b78 100644 --- a/WebCore/editing/wx/EditorWx.cpp +++ b/WebCore/editing/wx/EditorWx.cpp @@ -33,7 +33,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) { - return ClipboardWx::create(policy, true); + return ClipboardWx::create(policy, Clipboard::CopyAndPaste); } void Editor::showColorPanel() diff --git a/WebCore/features.pri b/WebCore/features.pri index df1c91f..f8b4bc3 100644 --- a/WebCore/features.pri +++ b/WebCore/features.pri @@ -68,10 +68,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1 !contains(DEFINES, ENABLE_IMAGE_RESIZER=.): DEFINES += ENABLE_IMAGE_RESIZER=0 !contains(DEFINES, ENABLE_INPUT_SPEECH=.): DEFINES += ENABLE_INPUT_SPEECH=0 - -greaterThan(QT_MINOR_VERSION, 5) { - !contains(DEFINES, ENABLE_3D_RENDERING=.): DEFINES += ENABLE_3D_RENDERING=1 -} +!contains(DEFINES, ENABLE_3D_RENDERING=.): DEFINES += ENABLE_3D_RENDERING=1 # SVG support !contains(DEFINES, ENABLE_SVG=0) { @@ -89,9 +86,7 @@ greaterThan(QT_MINOR_VERSION, 5) { !contains(DEFINES, ENABLE_DATALIST=.): DEFINES += ENABLE_DATALIST=1 # Tiled Backing Store support -greaterThan(QT_MINOR_VERSION, 5) { - !contains(DEFINES, ENABLE_TILED_BACKING_STORE=.): DEFINES += ENABLE_TILED_BACKING_STORE=1 -} +!contains(DEFINES, ENABLE_TILED_BACKING_STORE=.): DEFINES += ENABLE_TILED_BACKING_STORE=1 # Nescape plugins support (NPAPI) !contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) { @@ -133,8 +128,7 @@ greaterThan(QT_MINOR_VERSION, 5) { } } -# Enable touch event support with Qt 4.6 -!lessThan(QT_MINOR_VERSION, 6): DEFINES += ENABLE_TOUCH_EVENTS=1 +DEFINES += ENABLE_TOUCH_EVENTS=1 # HTML5 Media Support # We require QtMultimedia or Phonon @@ -142,7 +136,7 @@ greaterThan(QT_MINOR_VERSION, 5) { DEFINES -= ENABLE_VIDEO=1 DEFINES += ENABLE_VIDEO=0 - !lessThan(QT_MINOR_VERSION, 6):contains(MOBILITY_CONFIG, multimedia) { + contains(MOBILITY_CONFIG, multimedia) { DEFINES -= ENABLE_VIDEO=0 DEFINES += ENABLE_VIDEO=1 } else:contains(QT_CONFIG, phonon) { diff --git a/WebCore/fileapi/AsyncFileWriter.h b/WebCore/fileapi/AsyncFileWriter.h index ff6c1fa..fef1643 100644 --- a/WebCore/fileapi/AsyncFileWriter.h +++ b/WebCore/fileapi/AsyncFileWriter.h @@ -39,14 +39,11 @@ namespace WebCore { class Blob; -class FileWriterClient; class AsyncFileWriter { public: virtual ~AsyncFileWriter() {} - virtual void setFileWriterClient(FileWriterClient* client) = 0; - virtual void write(long long position, Blob* data) = 0; virtual void truncate(long long length) = 0; virtual void abort() = 0; diff --git a/WebCore/fileapi/FileWriterClient.h b/WebCore/fileapi/AsyncFileWriterClient.h index 1bebbd6..327b19c 100644 --- a/WebCore/fileapi/FileWriterClient.h +++ b/WebCore/fileapi/AsyncFileWriterClient.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FileWriterClient_h -#define FileWriterClient_h +#ifndef AsyncFileWriterClient_h +#define AsyncFileWriterClient_h #if ENABLE(FILE_SYSTEM) @@ -37,12 +37,12 @@ namespace WebCore { -class FileWriterClient { +class AsyncFileWriterClient { public: - virtual ~FileWriterClient() {} + virtual ~AsyncFileWriterClient() {} virtual void didWrite(long long bytes, bool complete) = 0; - virtual void didTruncate(long long position) = 0; + virtual void didTruncate() = 0; virtual void didFail(ExceptionCode) = 0; }; @@ -50,4 +50,4 @@ public: #endif // ENABLE(FILE_SYSTEM) -#endif // FileWriterClient_h +#endif // AsyncFileWriterClient_h diff --git a/WebCore/fileapi/DOMFileSystem.cpp b/WebCore/fileapi/DOMFileSystem.cpp index a8a7e6b..2bd09c2 100644 --- a/WebCore/fileapi/DOMFileSystem.cpp +++ b/WebCore/fileapi/DOMFileSystem.cpp @@ -38,10 +38,14 @@ #include "DirectoryEntry.h" #include "EntriesCallback.h" #include "Entry.h" +#include "EntryArray.h" #include "EntryCallback.h" #include "ErrorCallback.h" +#include "FileEntry.h" #include "FileError.h" #include "FileSystemCallbacks.h" +#include "FileWriter.h" +#include "FileWriterCallback.h" #include "MetadataCallback.h" #include "ScriptExecutionContext.h" #include "VoidCallback.h" @@ -84,7 +88,7 @@ void DOMFileSystem::contextDestroyed() void DOMFileSystem::getMetadata(const Entry* entry, PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { String platformPath = m_asyncFileSystem->virtualToPlatformPath(entry->fullPath()); - m_asyncFileSystem->readMetadata(platformPath, new MetadataCallbacks(successCallback, errorCallback)); + m_asyncFileSystem->readMetadata(platformPath, MetadataCallbacks::create(successCallback, errorCallback)); } static bool checkValidityForForCopyOrMove(const Entry* src, Entry* parent, const String& newName) @@ -123,7 +127,7 @@ void DOMFileSystem::move(const Entry* src, PassRefPtr<Entry> parent, const Strin String srcPlatformPath = m_asyncFileSystem->virtualToPlatformPath(src->fullPath()); String destPlatformPath = parent->filesystem()->asyncFileSystem()->virtualToPlatformPath(destPath); - m_asyncFileSystem->move(srcPlatformPath, destPlatformPath, new EntryCallbacks(successCallback, errorCallback, this, destPath, src->isDirectory())); + m_asyncFileSystem->move(srcPlatformPath, destPlatformPath, EntryCallbacks::create(successCallback, errorCallback, this, destPath, src->isDirectory())); } void DOMFileSystem::copy(const Entry* src, PassRefPtr<Entry> parent, const String& newName, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) @@ -141,14 +145,14 @@ void DOMFileSystem::copy(const Entry* src, PassRefPtr<Entry> parent, const Strin String srcPlatformPath = m_asyncFileSystem->virtualToPlatformPath(src->fullPath()); String destPlatformPath = parent->filesystem()->asyncFileSystem()->virtualToPlatformPath(destPath); - m_asyncFileSystem->copy(srcPlatformPath, destPlatformPath, new EntryCallbacks(successCallback, errorCallback, this, destPath, src->isDirectory())); + m_asyncFileSystem->copy(srcPlatformPath, destPlatformPath, EntryCallbacks::create(successCallback, errorCallback, this, destPath, src->isDirectory())); } void DOMFileSystem::remove(const Entry* entry, PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { ASSERT(entry); String platformPath = m_asyncFileSystem->virtualToPlatformPath(entry->fullPath()); - m_asyncFileSystem->remove(platformPath, new VoidCallbacks(successCallback, errorCallback)); + m_asyncFileSystem->remove(platformPath, VoidCallbacks::create(successCallback, errorCallback)); } void DOMFileSystem::getParent(const Entry* entry, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) @@ -156,7 +160,7 @@ void DOMFileSystem::getParent(const Entry* entry, PassRefPtr<EntryCallback> succ ASSERT(entry); String path = DOMFilePath::getDirectory(entry->fullPath()); String platformPath = m_asyncFileSystem->virtualToPlatformPath(path); - m_asyncFileSystem->directoryExists(platformPath, new EntryCallbacks(successCallback, errorCallback, this, path, true)); + m_asyncFileSystem->directoryExists(platformPath, EntryCallbacks::create(successCallback, errorCallback, this, path, true)); } void DOMFileSystem::getFile(const Entry* base, const String& path, PassRefPtr<Flags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) @@ -172,7 +176,7 @@ void DOMFileSystem::getFile(const Entry* base, const String& path, PassRefPtr<Fl absolutePath = DOMFilePath::removeExtraParentReferences(DOMFilePath::append(base->fullPath(), path)); String platformPath = m_asyncFileSystem->virtualToPlatformPath(absolutePath); - OwnPtr<EntryCallbacks> callbacks = adoptPtr(new EntryCallbacks(successCallback, errorCallback, this, absolutePath, false)); + OwnPtr<EntryCallbacks> callbacks = EntryCallbacks::create(successCallback, errorCallback, this, absolutePath, false); if (flags && flags->isCreate()) m_asyncFileSystem->createFile(platformPath, flags->isExclusive(), callbacks.release()); else @@ -192,18 +196,29 @@ void DOMFileSystem::getDirectory(const Entry* base, const String& path, PassRefP absolutePath = DOMFilePath::removeExtraParentReferences(DOMFilePath::append(base->fullPath(), path)); String platformPath = m_asyncFileSystem->virtualToPlatformPath(absolutePath); - OwnPtr<EntryCallbacks> callbacks = adoptPtr(new EntryCallbacks(successCallback, errorCallback, this, absolutePath, true)); + OwnPtr<EntryCallbacks> callbacks = EntryCallbacks::create(successCallback, errorCallback, this, absolutePath, true); if (flags && flags->isCreate()) m_asyncFileSystem->createDirectory(platformPath, flags->isExclusive(), callbacks.release()); else m_asyncFileSystem->directoryExists(platformPath, callbacks.release()); } +void DOMFileSystem::createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +{ + ASSERT(file); + + String platformPath = m_asyncFileSystem->virtualToPlatformPath(file->fullPath()); + + RefPtr<FileWriter> fileWriter = FileWriter::create(scriptExecutionContext()); + OwnPtr<FileWriterCallbacks> callbacks = FileWriterCallbacks::create(fileWriter, successCallback, errorCallback); + m_asyncFileSystem->createWriter(fileWriter.get(), platformPath, callbacks.release()); +} + void DOMFileSystem::readDirectory(const String& path, PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { ASSERT(DOMFilePath::isAbsolute(path)); String platformPath = m_asyncFileSystem->virtualToPlatformPath(path); - m_asyncFileSystem->readDirectory(platformPath, new EntriesCallbacks(successCallback, errorCallback, this, path)); + m_asyncFileSystem->readDirectory(platformPath, EntriesCallbacks::create(successCallback, errorCallback, this, path)); } } // namespace diff --git a/WebCore/fileapi/DOMFileSystem.h b/WebCore/fileapi/DOMFileSystem.h index f779aba..881ffc5 100644 --- a/WebCore/fileapi/DOMFileSystem.h +++ b/WebCore/fileapi/DOMFileSystem.h @@ -48,6 +48,8 @@ class Entry; class EntryCallback; class EntriesCallback; class ErrorCallback; +class FileEntry; +class FileWriterCallback; class MetadataCallback; class VoidCallback; @@ -77,6 +79,7 @@ public: void getFile(const Entry* base, const String& path, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); void getDirectory(const Entry* base, const String& path, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>); void readDirectory(const String& path, PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>); + void createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>); // Schedule a callback. This should not cross threads (should be called on the same context thread). template <typename CB, typename CBArg> diff --git a/WebCore/fileapi/DOMFileSystem.idl b/WebCore/fileapi/DOMFileSystem.idl index b7307e2..037770b 100644 --- a/WebCore/fileapi/DOMFileSystem.idl +++ b/WebCore/fileapi/DOMFileSystem.idl @@ -30,7 +30,8 @@ module storage { interface [ - Conditional=FILE_SYSTEM + Conditional=FILE_SYSTEM, + NoStaticTables ] DOMFileSystem { readonly attribute DOMString name; readonly attribute DirectoryEntry root; diff --git a/WebCore/fileapi/DirectoryEntry.idl b/WebCore/fileapi/DirectoryEntry.idl index 7a0efdd..2880ed0 100644 --- a/WebCore/fileapi/DirectoryEntry.idl +++ b/WebCore/fileapi/DirectoryEntry.idl @@ -32,7 +32,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, GenerateNativeConverter, - GenerateToJS + GenerateToJS, + NoStaticTables ] DirectoryEntry : Entry { DirectoryReader createReader(); [Custom] void getFile(in [ConvertUndefinedOrNullToNullString] DOMString path, in [Optional] Flags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); diff --git a/WebCore/fileapi/DirectoryReader.idl b/WebCore/fileapi/DirectoryReader.idl index c3c7012..831fb05 100644 --- a/WebCore/fileapi/DirectoryReader.idl +++ b/WebCore/fileapi/DirectoryReader.idl @@ -30,7 +30,8 @@ module storage { interface [ - Conditional=FILE_SYSTEM + Conditional=FILE_SYSTEM, + NoStaticTables ] DirectoryReader { void readEntries(in [Callback] EntriesCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); }; diff --git a/WebCore/fileapi/Entry.idl b/WebCore/fileapi/Entry.idl index b674455..d363bcd 100644 --- a/WebCore/fileapi/Entry.idl +++ b/WebCore/fileapi/Entry.idl @@ -31,7 +31,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, - CustomToJS + CustomToJS, + NoStaticTables ] Entry { readonly attribute boolean isFile; readonly attribute boolean isDirectory; diff --git a/WebCore/fileapi/EntryArray.idl b/WebCore/fileapi/EntryArray.idl index e987ece..dca7827 100644 --- a/WebCore/fileapi/EntryArray.idl +++ b/WebCore/fileapi/EntryArray.idl @@ -32,6 +32,7 @@ module storage { interface [ Conditional=FILE_SYSTEM, HasIndexGetter, + NoStaticTables ] EntryArray { readonly attribute unsigned long length; Entry item(in [IsIndex] unsigned long index); diff --git a/WebCore/fileapi/FileEntry.idl b/WebCore/fileapi/FileEntry.idl index eb913b8..73ef895 100644 --- a/WebCore/fileapi/FileEntry.idl +++ b/WebCore/fileapi/FileEntry.idl @@ -32,7 +32,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, GenerateNativeConverter, - GenerateToJS + GenerateToJS, + NoStaticTables ] FileEntry : Entry { void createWriter(in [Callback] FileWriterCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); void file(in [Callback] FileCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); diff --git a/WebCore/fileapi/FileSystemCallbacks.cpp b/WebCore/fileapi/FileSystemCallbacks.cpp index d59e47a..550b509 100644 --- a/WebCore/fileapi/FileSystemCallbacks.cpp +++ b/WebCore/fileapi/FileSystemCallbacks.cpp @@ -34,6 +34,7 @@ #if ENABLE(FILE_SYSTEM) #include "AsyncFileSystem.h" +#include "AsyncFileWriter.h" #include "DOMFilePath.h" #include "DOMFileSystem.h" #include "DirectoryEntry.h" @@ -45,6 +46,8 @@ #include "FileEntry.h" #include "FileError.h" #include "FileSystemCallback.h" +#include "FileWriter.h" +#include "FileWriterCallback.h" #include "Metadata.h" #include "MetadataCallback.h" #include "ScriptExecutionContext.h" @@ -91,6 +94,12 @@ void FileSystemCallbacksBase::didReadDirectoryEntry(const String&, bool) ASSERT_NOT_REACHED(); } +void FileSystemCallbacksBase::didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long) +{ + // Each subclass must implement an appropriate one. + ASSERT_NOT_REACHED(); +} + void FileSystemCallbacksBase::didFail(int code) { if (m_errorCallback) { @@ -101,6 +110,11 @@ void FileSystemCallbacksBase::didFail(int code) // EntryCallbacks ------------------------------------------------------------- +PassOwnPtr<EntryCallbacks> EntryCallbacks::create(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& expectedPath, bool isDirectory) +{ + return adoptPtr(new EntryCallbacks(successCallback, errorCallback, fileSystem, expectedPath, isDirectory)); +} + EntryCallbacks::EntryCallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& expectedPath, bool isDirectory) : FileSystemCallbacksBase(errorCallback) , m_successCallback(successCallback) @@ -123,6 +137,11 @@ void EntryCallbacks::didSucceed() // EntriesCallbacks ----------------------------------------------------------- +PassOwnPtr<EntriesCallbacks> EntriesCallbacks::create(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& basePath) +{ + return adoptPtr(new EntriesCallbacks(successCallback, errorCallback, fileSystem, basePath)); +} + EntriesCallbacks::EntriesCallbacks(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& basePath) : FileSystemCallbacksBase(errorCallback) , m_successCallback(successCallback) @@ -155,6 +174,11 @@ void EntriesCallbacks::didReadDirectoryEntries(bool hasMore) // FileSystemCallbacks -------------------------------------------------------- +PassOwnPtr<FileSystemCallbacks> FileSystemCallbacks::create(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* scriptExecutionContext) +{ + return adoptPtr(new FileSystemCallbacks(successCallback, errorCallback, scriptExecutionContext)); +} + FileSystemCallbacks::FileSystemCallbacks(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* context) : FileSystemCallbacksBase(errorCallback) , m_successCallback(successCallback) @@ -174,6 +198,11 @@ void FileSystemCallbacks::didOpenFileSystem(const String& name, PassOwnPtr<Async // MetadataCallbacks ---------------------------------------------------------- +PassOwnPtr<MetadataCallbacks> MetadataCallbacks::create(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +{ + return adoptPtr(new MetadataCallbacks(successCallback, errorCallback)); +} + MetadataCallbacks::MetadataCallbacks(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) : FileSystemCallbacksBase(errorCallback) , m_successCallback(successCallback) @@ -187,8 +216,35 @@ void MetadataCallbacks::didReadMetadata(double modificationTime) m_successCallback.clear(); } +// FileWriterCallbacks ---------------------------------------------------------- + +PassOwnPtr<FileWriterCallbacks> FileWriterCallbacks::create(PassRefPtr<FileWriter> fileWriter, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +{ + return adoptPtr(new FileWriterCallbacks(fileWriter, successCallback, errorCallback)); +} + +FileWriterCallbacks::FileWriterCallbacks(PassRefPtr<FileWriter> fileWriter, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) + : FileSystemCallbacksBase(errorCallback) + , m_fileWriter(fileWriter) + , m_successCallback(successCallback) +{ +} + +void FileWriterCallbacks::didCreateFileWriter(PassOwnPtr<AsyncFileWriter> asyncFileWriter, long long length) +{ + m_fileWriter->initialize(asyncFileWriter, length); + if (m_successCallback) + m_successCallback->handleEvent(m_fileWriter.release().get()); + m_successCallback.clear(); +} + // VoidCallbacks -------------------------------------------------------------- +PassOwnPtr<VoidCallbacks> VoidCallbacks::create(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +{ + return adoptPtr(new VoidCallbacks(successCallback, errorCallback)); +} + VoidCallbacks::VoidCallbacks(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) : FileSystemCallbacksBase(errorCallback) , m_successCallback(successCallback) diff --git a/WebCore/fileapi/FileSystemCallbacks.h b/WebCore/fileapi/FileSystemCallbacks.h index 31a2a0c..3647ad3 100644 --- a/WebCore/fileapi/FileSystemCallbacks.h +++ b/WebCore/fileapi/FileSystemCallbacks.h @@ -40,12 +40,15 @@ namespace WebCore { +class AsyncFileWriter; class DOMFileSystem; class ErrorCallback; class EntriesCallback; class EntryArray; class EntryCallback; class FileSystemCallback; +class FileWriter; +class FileWriterCallback; class MetadataCallback; class ScriptExecutionContext; class VoidCallback; @@ -67,6 +70,9 @@ public: virtual void didReadDirectoryEntry(const String& name, bool isDirectory); virtual void didReadDirectoryEntries(bool hasMore); + // For createFileWriter. + virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length); + // For ErrorCallback. virtual void didFail(int code); @@ -79,10 +85,11 @@ protected: class EntryCallbacks : public FileSystemCallbacksBase { public: - EntryCallbacks(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& expectedPath, bool isDirectory); + static PassOwnPtr<EntryCallbacks> create(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& expectedPath, bool isDirectory); virtual void didSucceed(); private: + EntryCallbacks(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& expectedPath, bool isDirectory); RefPtr<EntryCallback> m_successCallback; DOMFileSystem* m_fileSystem; String m_expectedPath; @@ -91,11 +98,12 @@ private: class EntriesCallbacks : public FileSystemCallbacksBase { public: - EntriesCallbacks(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& basePath); + static PassOwnPtr<EntriesCallbacks> create(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& basePath); virtual void didReadDirectoryEntry(const String& name, bool isDirectory); virtual void didReadDirectoryEntries(bool hasMore); private: + EntriesCallbacks(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& basePath); RefPtr<EntriesCallback> m_successCallback; DOMFileSystem* m_fileSystem; String m_basePath; @@ -104,29 +112,43 @@ private: class FileSystemCallbacks : public FileSystemCallbacksBase { public: - FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*); + static PassOwnPtr<FileSystemCallbacks> create(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*); virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>); private: + FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*); RefPtr<FileSystemCallback> m_successCallback; RefPtr<ScriptExecutionContext> m_scriptExecutionContext; }; class MetadataCallbacks : public FileSystemCallbacksBase { public: - MetadataCallbacks(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); + static PassOwnPtr<MetadataCallbacks> create(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); virtual void didReadMetadata(double modificationTime); private: + MetadataCallbacks(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); RefPtr<MetadataCallback> m_successCallback; }; +class FileWriterCallbacks : public FileSystemCallbacksBase { +public: + static PassOwnPtr<FileWriterCallbacks> create(PassRefPtr<FileWriter>, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>); + virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length); + +private: + FileWriterCallbacks(PassRefPtr<FileWriter>, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>); + RefPtr<FileWriter> m_fileWriter; + RefPtr<FileWriterCallback> m_successCallback; +}; + class VoidCallbacks : public FileSystemCallbacksBase { public: - VoidCallbacks(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); + static PassOwnPtr<VoidCallbacks> create(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); virtual void didSucceed(); private: + VoidCallbacks(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); RefPtr<VoidCallback> m_successCallback; }; diff --git a/WebCore/fileapi/FileWriter.cpp b/WebCore/fileapi/FileWriter.cpp index a9f9afd..8367bf9 100644 --- a/WebCore/fileapi/FileWriter.cpp +++ b/WebCore/fileapi/FileWriter.cpp @@ -48,6 +48,7 @@ FileWriter::FileWriter(ScriptExecutionContext* context) , m_position(0) , m_bytesWritten(0) , m_bytesToWrite(0) + , m_truncateLength(-1) { } @@ -95,7 +96,6 @@ void FileWriter::write(Blob* data, ExceptionCode& ec) m_readyState = WRITING; m_bytesWritten = 0; m_bytesToWrite = data->size(); - fireEvent(eventNames().writestartEvent); m_writer->write(m_position, data); } @@ -122,7 +122,7 @@ void FileWriter::seek(long long position, ExceptionCode& ec) void FileWriter::truncate(long long position, ExceptionCode& ec) { ASSERT(m_writer); - if (m_readyState == WRITING || position >= m_length) { + if (m_readyState == WRITING || position < 0) { ec = INVALID_STATE_ERR; m_error = FileError::create(ec); return; @@ -130,7 +130,7 @@ void FileWriter::truncate(long long position, ExceptionCode& ec) m_readyState = WRITING; m_bytesWritten = 0; m_bytesToWrite = 0; - fireEvent(eventNames().writestartEvent); + m_truncateLength = position; m_writer->truncate(position); } @@ -142,11 +142,8 @@ void FileWriter::abort(ExceptionCode& ec) m_error = FileError::create(ec); return; } + m_error = FileError::create(ABORT_ERR); - m_readyState = DONE; - fireEvent(eventNames().errorEvent); - fireEvent(eventNames().abortEvent); - fireEvent(eventNames().writeendEvent); m_writer->abort(); } @@ -155,36 +152,41 @@ void FileWriter::didWrite(long long bytes, bool complete) ASSERT(bytes > 0); ASSERT(bytes + m_bytesWritten > 0); ASSERT(bytes + m_bytesWritten <= m_bytesToWrite); + if (!m_bytesWritten) + fireEvent(eventNames().writestartEvent); m_bytesWritten += bytes; ASSERT((m_bytesWritten == m_bytesToWrite) == complete); m_position += bytes; if (m_position > m_length) m_length = m_position; - if (complete) - m_readyState = DONE; fireEvent(eventNames().writeEvent); - if (complete) + if (complete) { + m_readyState = DONE; fireEvent(eventNames().writeendEvent); + } } -void FileWriter::didTruncate(long long length) +void FileWriter::didTruncate() { - ASSERT(length > 0); - ASSERT(length >= 0); - ASSERT(length < m_length); - m_length = length; + ASSERT(m_truncateLength >= 0); + fireEvent(eventNames().writestartEvent); + m_length = m_truncateLength; if (m_position > m_length) m_position = m_length; - m_readyState = DONE; + m_truncateLength = -1; fireEvent(eventNames().writeEvent); + m_readyState = DONE; fireEvent(eventNames().writeendEvent); } void FileWriter::didFail(ExceptionCode ec) { m_error = FileError::create(ec); - m_readyState = DONE; fireEvent(eventNames().errorEvent); + if (ABORT_ERR == ec) + fireEvent(eventNames().abortEvent); + fireEvent(eventNames().errorEvent); + m_readyState = DONE; fireEvent(eventNames().writeendEvent); } diff --git a/WebCore/fileapi/FileWriter.h b/WebCore/fileapi/FileWriter.h index 0737085..4bb91ef 100644 --- a/WebCore/fileapi/FileWriter.h +++ b/WebCore/fileapi/FileWriter.h @@ -34,8 +34,8 @@ #if ENABLE(FILE_SYSTEM) #include "ActiveDOMObject.h" +#include "AsyncFileWriterClient.h" #include "EventTarget.h" -#include "FileWriterClient.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -49,7 +49,7 @@ class Blob; class FileError; class ScriptExecutionContext; -class FileWriter : public RefCounted<FileWriter>, public ActiveDOMObject, public EventTarget, public FileWriterClient { +class FileWriter : public RefCounted<FileWriter>, public ActiveDOMObject, public EventTarget, public AsyncFileWriterClient { public: static PassRefPtr<FileWriter> create(ScriptExecutionContext* context) { @@ -74,9 +74,9 @@ public: long long position() const { return m_position; } long long length() const { return m_length; } - // FileWriterClient + // AsyncFileWriterClient void didWrite(long long bytes, bool complete); - void didTruncate(long long length); + void didTruncate(); void didFail(ExceptionCode ec); // ActiveDOMObject @@ -121,6 +121,7 @@ private: long long m_length; long long m_bytesWritten; long long m_bytesToWrite; + long long m_truncateLength; }; } // namespace WebCore diff --git a/WebCore/fileapi/Flags.idl b/WebCore/fileapi/Flags.idl index 29658a1..88cede3 100644 --- a/WebCore/fileapi/Flags.idl +++ b/WebCore/fileapi/Flags.idl @@ -31,7 +31,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, - CanBeConstructed + CanBeConstructed, + NoStaticTables ] Flags { attribute boolean create; attribute boolean exclusive; diff --git a/WebCore/fileapi/LocalFileSystem.cpp b/WebCore/fileapi/LocalFileSystem.cpp index 59ec2a1..567aafe 100644 --- a/WebCore/fileapi/LocalFileSystem.cpp +++ b/WebCore/fileapi/LocalFileSystem.cpp @@ -50,25 +50,41 @@ namespace WebCore { -PassRefPtr<LocalFileSystem> LocalFileSystem::create(const String& basePath) +LocalFileSystem* LocalFileSystem::s_instance = 0; + +void LocalFileSystem::initializeLocalFileSystem(const String& basePath) { - return adoptRef(new LocalFileSystem(basePath)); + // FIXME: Should initialize the quota settings as well. + ASSERT(isMainThread()); + ASSERT(!s_instance); + if (s_instance) + return; + + OwnPtr<LocalFileSystem> localFileSystem = adoptPtr(new LocalFileSystem(basePath)); + s_instance = localFileSystem.leakPtr(); } -static void openFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, AsyncFileSystem::Type type, PassOwnPtr<FileSystemCallbacks> callbacks) +LocalFileSystem& LocalFileSystem::localFileSystem() { - AsyncFileSystem::openFileSystem(basePath, identifier, type, callbacks); + // initializeLocalFileSystem must be called prior calling this. + ASSERT(s_instance); + return *s_instance; } -void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +String LocalFileSystem::fileSystemBasePath() const { - if (type != AsyncFileSystem::Temporary && type != AsyncFileSystem::Persistent) { - DOMFileSystem::scheduleCallback(context, errorCallback, FileError::create(INVALID_MODIFICATION_ERR)); - return; - } + return m_basePath; +} +static void openFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + AsyncFileSystem::openFileSystem(basePath, identifier, type, callbacks); +} + +void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously. - context->postTask(createCallbackTask(&openFileSystem, m_basePath, context->securityOrigin()->databaseIdentifier(), type, new FileSystemCallbacks(successCallback, errorCallback, context))); + context->postTask(createCallbackTask(&openFileSystem, fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, callbacks)); } } // namespace diff --git a/WebCore/fileapi/LocalFileSystem.h b/WebCore/fileapi/LocalFileSystem.h index 48cfa8f..bb1d045 100644 --- a/WebCore/fileapi/LocalFileSystem.h +++ b/WebCore/fileapi/LocalFileSystem.h @@ -44,20 +44,44 @@ class ErrorCallback; class FileSystemCallback; class ScriptExecutionContext; -class LocalFileSystem : public RefCounted<LocalFileSystem> { +// Keeps per-process information and provides an entry point to open a file system. +class LocalFileSystem : public Noncopyable { public: - static PassRefPtr<LocalFileSystem> create(const String& basePath); - virtual ~LocalFileSystem() { } + // Returns a per-process instance of LocalFileSystem. + // Note that LocalFileSystem::initializeLocalFileSystem must be called before + // calling this one. + static LocalFileSystem& localFileSystem(); - void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>); + void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassOwnPtr<AsyncFileSystemCallbacks>); -protected: +#if !PLATFORM(CHROMIUM) + // This call is not thread-safe; must be called before any worker threads are created. + void initializeLocalFileSystem(const String&); + + String fileSystemBasePath() const; +#endif + +private: LocalFileSystem(const String& basePath) : m_basePath(basePath) { } - String m_basePath; + static LocalFileSystem* s_instance; + + // An inner class that enforces thread-safe string access. + class SystemBasePath { + public: + explicit SystemBasePath(const String& path) : m_value(path) { } + operator String() const + { + return m_value.threadsafeCopy(); + } + private: + String m_value; + }; + + SystemBasePath m_basePath; }; } // namespace diff --git a/WebCore/fileapi/Metadata.idl b/WebCore/fileapi/Metadata.idl index a5a90bc..df50b66 100644 --- a/WebCore/fileapi/Metadata.idl +++ b/WebCore/fileapi/Metadata.idl @@ -30,7 +30,8 @@ module storage { interface [ - Conditional=FILE_SYSTEM + Conditional=FILE_SYSTEM, + NoStaticTables ] Metadata { readonly attribute Date modificationTime; }; diff --git a/WebCore/html/BaseTextInputType.cpp b/WebCore/html/BaseTextInputType.cpp new file mode 100644 index 0000000..3e57ace --- /dev/null +++ b/WebCore/html/BaseTextInputType.cpp @@ -0,0 +1,52 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com> + * Copyright (C) 2010 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 "BaseTextInputType.h" + +#include "HTMLInputElement.h" +#include "HTMLNames.h" +#include "RegularExpression.h" + +namespace WebCore { + +using namespace HTMLNames; + +bool BaseTextInputType::isTextType() const +{ + return true; +} + +bool BaseTextInputType::patternMismatch(const String& value) const +{ + const AtomicString& pattern = element()->fastGetAttribute(patternAttr); + // Empty values can't be mismatched + if (pattern.isEmpty() || value.isEmpty()) + return false; + int matchLength = 0; + int valueLength = value.length(); + int matchOffset = RegularExpression(pattern, TextCaseSensitive).match(value, 0, &matchLength); + return matchOffset || matchLength != valueLength; +} + +} // namespace WebCore diff --git a/WebCore/html/BaseTextInputType.h b/WebCore/html/BaseTextInputType.h new file mode 100644 index 0000000..9bd6c6d --- /dev/null +++ b/WebCore/html/BaseTextInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef BaseTextInputType_h +#define BaseTextInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +// Base of email, password, search, tel, text, and URL types. +// They support maxlength, selection functions, and so on. +class BaseTextInputType : public TextFieldInputType { +protected: + BaseTextInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual bool isTextType() const; + virtual bool patternMismatch(const String&) const; +}; + +} // namespace WebCore + +#endif // BaseTextInputType_h diff --git a/WebCore/platform/chromium/GLES2Context.h b/WebCore/html/ButtonInputType.cpp index d37885a..7f56970 100644 --- a/WebCore/platform/chromium/GLES2Context.h +++ b/WebCore/html/ButtonInputType.cpp @@ -28,43 +28,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GLES2Context_h -#define GLES2Context_h +#include "config.h" +#include "ButtonInputType.h" -#include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> namespace WebCore { -class GLES2ContextInternal; -class IntSize; -class Page; +PassOwnPtr<InputType> ButtonInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new ButtonInputType(element)); +} -class GLES2Context : public Noncopyable { -public: - // Used by the implementation only - static PassOwnPtr<GLES2Context> create(PassOwnPtr<GLES2ContextInternal>); - ~GLES2Context(); - - bool makeCurrent(); - bool destroy(); - bool swapBuffers(); - - // Only valid for offscreen contexts. - void resizeOffscreenContent(const IntSize&); - - // Returns the ID of the texture used for offscreen rendering in the context of the parent. - // This texture is accessible by the GPU page compositor. - unsigned getOffscreenContentParentTextureId(); - -private: - GLES2Context(); - - friend class GLES2ContextInternal; - OwnPtr<GLES2ContextInternal> m_internal; -}; +const AtomicString& ButtonInputType::formControlType() const +{ + return InputTypeNames::button(); +} } // namespace WebCore - -#endif diff --git a/WebCore/html/ButtonInputType.h b/WebCore/html/ButtonInputType.h new file mode 100644 index 0000000..99b3574 --- /dev/null +++ b/WebCore/html/ButtonInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ButtonInputType_h +#define ButtonInputType_h + +#include "InputType.h" + +namespace WebCore { + +class ButtonInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + ButtonInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // ButtonInputType_h diff --git a/WebCore/html/CheckboxInputType.cpp b/WebCore/html/CheckboxInputType.cpp new file mode 100644 index 0000000..1c7ea4b --- /dev/null +++ b/WebCore/html/CheckboxInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CheckboxInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> CheckboxInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new CheckboxInputType(element)); +} + +const AtomicString& CheckboxInputType::formControlType() const +{ + return InputTypeNames::checkbox(); +} + +} // namespace WebCore diff --git a/WebCore/html/CheckboxInputType.h b/WebCore/html/CheckboxInputType.h new file mode 100644 index 0000000..6a152e9 --- /dev/null +++ b/WebCore/html/CheckboxInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CheckboxInputType_h +#define CheckboxInputType_h + +#include "InputType.h" + +namespace WebCore { + +class CheckboxInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + CheckboxInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // CheckboxInputType_h diff --git a/WebCore/html/ColorInputType.cpp b/WebCore/html/ColorInputType.cpp new file mode 100644 index 0000000..c68acea --- /dev/null +++ b/WebCore/html/ColorInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ColorInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> ColorInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new ColorInputType(element)); +} + +const AtomicString& ColorInputType::formControlType() const +{ + return InputTypeNames::color(); +} + +} // namespace WebCore diff --git a/WebCore/html/ColorInputType.h b/WebCore/html/ColorInputType.h new file mode 100644 index 0000000..7259346 --- /dev/null +++ b/WebCore/html/ColorInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ColorInputType_h +#define ColorInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class ColorInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + ColorInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // ButtonInputType_h diff --git a/WebCore/html/DOMTokenList.cpp b/WebCore/html/DOMTokenList.cpp new file mode 100644 index 0000000..8ee45a2 --- /dev/null +++ b/WebCore/html/DOMTokenList.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 "DOMTokenList.h" + +#include "Element.h" +#include "HTMLNames.h" +#include "SpaceSplitString.h" +#include "StringBuilder.h" + +namespace WebCore { + +using namespace HTMLNames; + +static bool validateToken(const AtomicString& token, ExceptionCode& ec) +{ + if (token.isEmpty()) { + ec = SYNTAX_ERR; + return false; + } + + unsigned length = token.length(); + for (unsigned i = 0; i < length; ++i) { + if (isClassWhitespace(token[i])) { + ec = INVALID_CHARACTER_ERR; + return false; + } + } + + return true; +} + +DOMTokenList::DOMTokenList(Element* element) + : m_element(element) +{ + if (m_element->document()->inQuirksMode()) + m_classNamesForQuirksMode.set(m_element->fastGetAttribute(classAttr), false); +} + +void DOMTokenList::ref() +{ + m_element->ref(); +} + +void DOMTokenList::deref() +{ + m_element->deref(); +} + +unsigned DOMTokenList::length() const +{ + return classNames().size(); +} + +const AtomicString DOMTokenList::item(unsigned index) const +{ + if (index >= length()) + return AtomicString(); + return classNames()[index]; +} + +bool DOMTokenList::contains(const AtomicString& token, ExceptionCode& ec) const +{ + if (!validateToken(token, ec)) + return false; + return containsInternal(token); +} + +bool DOMTokenList::containsInternal(const AtomicString& token) const +{ + return classNames().contains(token); +} + +void DOMTokenList::add(const AtomicString& token, ExceptionCode& ec) +{ + if (!validateToken(token, ec)) + return; + addInternal(token); +} + +void DOMTokenList::addInternal(const AtomicString& token) const +{ + const AtomicString& oldClassName(m_element->fastGetAttribute(classAttr)); + if (oldClassName.isEmpty()) + m_element->setAttribute(classAttr, token); + else if (!containsInternal(token)) { + StringBuilder builder; + builder.append(oldClassName); + if (oldClassName[oldClassName.length() - 1] != ' ') + builder.append(' '); + builder.append(token); + m_element->setAttribute(classAttr, builder.toString()); + } +} + +void DOMTokenList::remove(const AtomicString& token, ExceptionCode& ec) +{ + if (!validateToken(token, ec)) + return; + removeInternal(token); +} + +void DOMTokenList::removeInternal(const AtomicString& token) const +{ + // Check using contains first since it uses AtomicString comparisons instead + // of character by character testing. + if (!containsInternal(token)) + return; + + // Algorithm defined at http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#remove-a-token-from-a-string + + const AtomicString& input = m_element->fastGetAttribute(classAttr); + unsigned inputLength = input.length(); + Vector<UChar> output; // 3 + output.reserveCapacity(inputLength); + unsigned position = 0; // 4 + + // Step 5 + while (position < inputLength) { + if (isClassWhitespace(input[position])) { // 6 + output.append(input[position++]); // 6.1, 6.2 + continue; // 6.3 + } + + // Step 7 + Vector<UChar> s; + while (position < inputLength && !isClassWhitespace(input[position])) + s.append(input[position++]); + + // Step 8 + if (s == token) { + // Step 8.1 + while (position < inputLength && isClassWhitespace(input[position])) + ++position; + + // Step 8.2 + size_t j = output.size(); + while (j > 0 && isClassWhitespace(output[j - 1])) + --j; + output.resize(j); + + // Step 8.3 + if (position < inputLength && !output.isEmpty()) + output.append(' '); + } else + output.append(s); // Step 9 + } + + output.shrinkToFit(); + m_element->setAttribute(classAttr, String::adopt(output)); +} + +bool DOMTokenList::toggle(const AtomicString& token, ExceptionCode& ec) +{ + if (!validateToken(token, ec)) + return false; + + if (containsInternal(token)) { + removeInternal(token); + return false; + } + addInternal(token); + return true; +} + +String DOMTokenList::toString() const +{ + return m_element->fastGetAttribute(classAttr); +} + +void DOMTokenList::reset(const String& newClassName) +{ + if (!m_classNamesForQuirksMode.isNull()) + m_classNamesForQuirksMode.set(newClassName, false); +} + +const SpaceSplitString& DOMTokenList::classNames() const +{ + if (!m_classNamesForQuirksMode.isNull()) + return m_classNamesForQuirksMode; + return m_element->attributeMap()->classNames(); +} + +} // namespace WebCore diff --git a/WebCore/html/DOMTokenList.h b/WebCore/html/DOMTokenList.h new file mode 100644 index 0000000..fad69ca --- /dev/null +++ b/WebCore/html/DOMTokenList.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 DOMTokenList_h +#define DOMTokenList_h + +#include "ExceptionCode.h" +#include "SpaceSplitString.h" +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +class Element; + +class DOMTokenList : public Noncopyable { +public: + static PassOwnPtr<DOMTokenList> create(Element* element) + { + return adoptPtr(new DOMTokenList(element)); + } + + void ref(); + void deref(); + + unsigned length() const; + const AtomicString item(unsigned index) const; + bool contains(const AtomicString&, ExceptionCode&) const; + void add(const AtomicString&, ExceptionCode&); + void remove(const AtomicString&, ExceptionCode&); + bool toggle(const AtomicString&, ExceptionCode&); + String toString() const; + + void reset(const String&); + + Element* element() { return m_element; } + +private: + DOMTokenList(Element*); + + void addInternal(const AtomicString&) const; + bool containsInternal(const AtomicString&) const; + void removeInternal(const AtomicString&) const; + + const SpaceSplitString& classNames() const; + + Element* m_element; + SpaceSplitString m_classNamesForQuirksMode; +}; + +} // namespace WebCore + +#endif // DOMTokenList_h diff --git a/WebCore/html/DOMTokenList.idl b/WebCore/html/DOMTokenList.idl new file mode 100644 index 0000000..a46900e --- /dev/null +++ b/WebCore/html/DOMTokenList.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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. + */ + +module core { + + interface [ + GenerateConstructor, + HasIndexGetter + ] DOMTokenList { + readonly attribute unsigned long length; + [ConvertNullStringTo=Null] DOMString item(in unsigned long index); + boolean contains(in DOMString token) raises(DOMException); + void add(in DOMString token) raises(DOMException); + void remove(in DOMString token) raises(DOMException); + boolean toggle(in DOMString token) raises(DOMException); + +#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT + [DontEnum] DOMString toString(); +#endif + }; + +} diff --git a/WebCore/html/DateInputType.cpp b/WebCore/html/DateInputType.cpp new file mode 100644 index 0000000..0605846 --- /dev/null +++ b/WebCore/html/DateInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DateInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> DateInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new DateInputType(element)); +} + +const AtomicString& DateInputType::formControlType() const +{ + return InputTypeNames::date(); +} + +} // namespace WebCore diff --git a/WebCore/html/DateInputType.h b/WebCore/html/DateInputType.h new file mode 100644 index 0000000..e6f60d7 --- /dev/null +++ b/WebCore/html/DateInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DateInputType_h +#define DateInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class DateInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + DateInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // DateInputType_h diff --git a/WebCore/html/DateTimeInputType.cpp b/WebCore/html/DateTimeInputType.cpp new file mode 100644 index 0000000..0bf5e04 --- /dev/null +++ b/WebCore/html/DateTimeInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DateTimeInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> DateTimeInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new DateTimeInputType(element)); +} + +const AtomicString& DateTimeInputType::formControlType() const +{ + return InputTypeNames::datetime(); +} + +} // namespace WebCore diff --git a/WebCore/html/DateTimeInputType.h b/WebCore/html/DateTimeInputType.h new file mode 100644 index 0000000..f24ebfb --- /dev/null +++ b/WebCore/html/DateTimeInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DateTimeInputType_h +#define DateTimeInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class DateTimeInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + DateTimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // DateTimeInputType_h diff --git a/WebCore/html/DateTimeLocalInputType.cpp b/WebCore/html/DateTimeLocalInputType.cpp new file mode 100644 index 0000000..33c6cfa --- /dev/null +++ b/WebCore/html/DateTimeLocalInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DateTimeLocalInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> DateTimeLocalInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new DateTimeLocalInputType(element)); +} + +const AtomicString& DateTimeLocalInputType::formControlType() const +{ + return InputTypeNames::datetimelocal(); +} + +} // namespace WebCore diff --git a/WebCore/html/DateTimeLocalInputType.h b/WebCore/html/DateTimeLocalInputType.h new file mode 100644 index 0000000..1a3d866 --- /dev/null +++ b/WebCore/html/DateTimeLocalInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DateTimeLocalInputType_h +#define DateTimeLocalInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class DateTimeLocalInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + DateTimeLocalInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // DateTimeLocalInputType_h diff --git a/WebCore/html/DocTypeStrings.gperf b/WebCore/html/DocTypeStrings.gperf index 5c213b0..22488eb 100644 --- a/WebCore/html/DocTypeStrings.gperf +++ b/WebCore/html/DocTypeStrings.gperf @@ -1,23 +1,14 @@ %struct-type -struct PubIDInfo { - enum eMode { - eQuirks, - eQuirks3, - eAlmostStandards - }; - - const char* name; - eMode mode_if_no_sysid; - eMode mode_if_sysid; -} -%language=ANSI-C +struct PubIDInfo; +%omit-struct-type +%language=C++ %readonly-tables %global-table %compare-strncmp +%define class-name DocTypeStringsHash %define initializer-suffix ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards -%define lookup-function-name findDoctypeEntry +%define lookup-function-name findDoctypeEntryImpl %define hash-function-name doctype_hash_function -%includes %enum %% "+//silmaril//dtd html pro v0r11 19970101//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 diff --git a/WebCore/html/EmailInputType.cpp b/WebCore/html/EmailInputType.cpp new file mode 100644 index 0000000..4472310 --- /dev/null +++ b/WebCore/html/EmailInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "EmailInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> EmailInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new EmailInputType(element)); +} + +const AtomicString& EmailInputType::formControlType() const +{ + return InputTypeNames::email(); +} + +} // namespace WebCore diff --git a/WebCore/html/EmailInputType.h b/WebCore/html/EmailInputType.h new file mode 100644 index 0000000..bbf6f73 --- /dev/null +++ b/WebCore/html/EmailInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EmailInputType_h +#define EmailInputType_h + +#include "BaseTextInputType.h" + +namespace WebCore { + +class EmailInputType : public BaseTextInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + EmailInputType(HTMLInputElement* element) : BaseTextInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // ButtonInputType_h diff --git a/WebCore/html/FileInputType.cpp b/WebCore/html/FileInputType.cpp new file mode 100644 index 0000000..0e08362 --- /dev/null +++ b/WebCore/html/FileInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FileInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> FileInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new FileInputType(element)); +} + +const AtomicString& FileInputType::formControlType() const +{ + return InputTypeNames::file(); +} + +} // namespace WebCore diff --git a/WebCore/html/FileInputType.h b/WebCore/html/FileInputType.h new file mode 100644 index 0000000..cebfab7 --- /dev/null +++ b/WebCore/html/FileInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FileInputType_h +#define FileInputType_h + +#include "InputType.h" + +namespace WebCore { + +class FileInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + FileInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // FileInputType_h diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp index 995552e..8beccc2 100644 --- a/WebCore/html/HTMLAnchorElement.cpp +++ b/WebCore/html/HTMLAnchorElement.cpp @@ -33,6 +33,7 @@ #include "KeyboardEvent.h" #include "MouseEvent.h" #include "Page.h" +#include "PingLoader.h" #include "RenderImage.h" #include "ResourceHandle.h" #include "Settings.h" @@ -147,6 +148,7 @@ void HTMLAnchorElement::defaultEventHandler(Event* event) String url = deprecatedParseURL(getAttribute(hrefAttr)); appendServerMapMousePosition(url, event); handleLinkClick(event, document(), url, getAttribute(targetAttr), hasRel(RelationNoReferrer)); + sendPings(document()->completeURL(url)); return; } @@ -440,6 +442,12 @@ String HTMLAnchorElement::search() const return query.isEmpty() ? "" : "?" + query; } +String HTMLAnchorElement::origin() const +{ + RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href()); + return origin->toString(); +} + void HTMLAnchorElement::setSearch(const String& value) { KURL url = href(); @@ -465,6 +473,16 @@ bool HTMLAnchorElement::isLiveLink() const return isLink() && treatLinkAsLiveForEventType(m_wasShiftKeyDownOnMouseDown ? MouseEventWithShiftKey : MouseEventWithoutShiftKey); } +void HTMLAnchorElement::sendPings(const KURL& destinationURL) +{ + if (!hasAttribute(pingAttr) || !document()->settings()->hyperlinkAuditingEnabled()) + return; + + SpaceSplitString pingURLs(getAttribute(pingAttr), true); + for (unsigned i = 0; i < pingURLs.size(); i++) + PingLoader::sendPing(document()->frame(), document()->completeURL(pingURLs[i]), destinationURL); +} + HTMLAnchorElement::EventType HTMLAnchorElement::eventType(Event* event) { if (!event->isMouseEvent()) diff --git a/WebCore/html/HTMLAnchorElement.h b/WebCore/html/HTMLAnchorElement.h index 16baff1..a7e7eec 100644 --- a/WebCore/html/HTMLAnchorElement.h +++ b/WebCore/html/HTMLAnchorElement.h @@ -82,6 +82,8 @@ public: String search() const; void setSearch(const String&); + String origin() const; + String text() const; String toString() const; @@ -109,6 +111,8 @@ private: virtual short tabIndex() const; virtual bool draggable() const; + void sendPings(const KURL& destinationURL); + enum EventType { MouseEventWithoutShiftKey, MouseEventWithShiftKey, diff --git a/WebCore/html/HTMLAnchorElement.idl b/WebCore/html/HTMLAnchorElement.idl index f5e1bd9..c918fde 100644 --- a/WebCore/html/HTMLAnchorElement.idl +++ b/WebCore/html/HTMLAnchorElement.idl @@ -49,6 +49,8 @@ module html { attribute [ConvertNullToNullString] DOMString port; attribute [ConvertNullToNullString] DOMString protocol; attribute [ConvertNullToNullString] DOMString search; + + readonly attribute [ConvertNullToNullString] DOMString origin; #endif readonly attribute DOMString text; diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in index 103d2c6..7a80c13 100644 --- a/WebCore/html/HTMLAttributeNames.in +++ b/WebCore/html/HTMLAttributeNames.in @@ -229,6 +229,7 @@ optimum pattern placeholder pluginurl +ping poster precision preload @@ -257,7 +258,7 @@ size sortable sortdirection span -speech +webkitspeech spellcheck src standby diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp index 6f46ab4..634fe13 100644 --- a/WebCore/html/HTMLCanvasElement.cpp +++ b/WebCore/html/HTMLCanvasElement.cpp @@ -377,7 +377,7 @@ void HTMLCanvasElement::createImageBuffer() const return; m_imageBuffer->context()->scale(FloatSize(size.width() / unscaledSize.width(), size.height() / unscaledSize.height())); m_imageBuffer->context()->setShadowsIgnoreTransforms(true); - m_imageBuffer->context()->setImageInterpolationQuality(CanvasInterpolationQuality); + m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQuality); } GraphicsContext* HTMLCanvasElement::drawingContext() const diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h index 01665c8..e6c0155 100644 --- a/WebCore/html/HTMLCanvasElement.h +++ b/WebCore/html/HTMLCanvasElement.h @@ -32,6 +32,14 @@ #include "HTMLElement.h" #include "IntSize.h" +#if PLATFORM(CHROMIUM) +#define DefaultInterpolationQuality InterpolationMedium +#elif PLATFORM(CG) +#define DefaultInterpolationQuality InterpolationLow +#else +#define DefaultInterpolationQuality InterpolationDefault +#endif + namespace WebCore { class CanvasContextAttributes; diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index f9efc4f..e20e729 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -64,6 +64,7 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" +#include "HashTools.h" #include "HTMLDocumentParser.h" #include "HTMLBodyElement.h" #include "HTMLElementFactory.h" @@ -74,8 +75,6 @@ #include "Settings.h" #include <wtf/text/CString.h> -#include "DocTypeStrings.cpp" - namespace WebCore { using namespace HTMLNames; diff --git a/WebCore/html/HTMLElement.idl b/WebCore/html/HTMLElement.idl index 863f28c..b127c51 100644 --- a/WebCore/html/HTMLElement.idl +++ b/WebCore/html/HTMLElement.idl @@ -31,6 +31,7 @@ module html { attribute [Reflect] DOMString lang; attribute [Reflect] DOMString dir; attribute [Reflect=class] DOMString className; + readonly attribute DOMTokenList classList; attribute long tabIndex; attribute boolean draggable; diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index d223b1e..29ea592 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -180,7 +180,7 @@ String HTMLImageElement::altText() const RenderObject* HTMLImageElement::createRenderer(RenderArena* arena, RenderStyle* style) { - if (style->contentData()) + if (style->contentData()) return RenderObject::createObject(this, style); RenderImage* image = new (arena) RenderImage(this); diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index 67b0c03..7e01de5 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -51,6 +51,7 @@ #include "HTMLNames.h" #include "HTMLOptionElement.h" #include "HTMLParserIdioms.h" +#include "InputType.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" #include "MouseEvent.h" @@ -164,6 +165,7 @@ HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum , m_autocomplete(Uninitialized) , m_autofilled(false) , m_inited(false) + , m_inputType(InputType::createText(this)) { ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); } @@ -348,17 +350,7 @@ bool HTMLInputElement::valueMissing(const String& value) const bool HTMLInputElement::patternMismatch(const String& value) const { - if (!isTextType()) - return false; - const AtomicString& pattern = getAttribute(patternAttr); - // Empty values can't be mismatched - if (pattern.isEmpty() || value.isEmpty()) - return false; - RegularExpression patternRegExp(pattern, TextCaseSensitive); - int matchLength = 0; - int valueLength = value.length(); - int matchOffset = patternRegExp.match(value, 0, &matchLength); - return matchOffset || matchLength != valueLength; + return m_inputType->patternMismatch(value); } bool HTMLInputElement::tooLong(const String& value, NeedsToCheckDirtyFlag check) const @@ -918,6 +910,7 @@ void HTMLInputElement::updateType() bool wasPasswordField = deprecatedInputType() == PASSWORD; bool didRespectHeightAndWidth = respectHeightAndWidthAttrs(); m_deprecatedTypeNumber = newType; + m_inputType = InputType::create(this, typeString); setNeedsWillValidateCheck(); bool willStoreValue = storesValueSeparateFromAttribute(); bool isPasswordField = deprecatedInputType() == PASSWORD; @@ -966,42 +959,9 @@ void HTMLInputElement::updateType() m_imageLoader.clear(); } -static const AtomicString* createFormControlTypes() -{ - AtomicString* types = new AtomicString[HTMLInputElement::deprecatedNumberOfTypes]; - // The values must be lowercased because they will be the return values of - // input.type and it must be lowercase according to DOM Level 2. - types[HTMLInputElement::BUTTON] = "button"; - types[HTMLInputElement::CHECKBOX] = "checkbox"; - types[HTMLInputElement::COLOR] = "color"; - types[HTMLInputElement::DATE] = "date"; - types[HTMLInputElement::DATETIME] = "datetime"; - types[HTMLInputElement::DATETIMELOCAL] = "datetime-local"; - types[HTMLInputElement::EMAIL] = "email"; - types[HTMLInputElement::FILE] = "file"; - types[HTMLInputElement::HIDDEN] = "hidden"; - types[HTMLInputElement::IMAGE] = "image"; - types[HTMLInputElement::ISINDEX] = emptyAtom; - types[HTMLInputElement::MONTH] = "month"; - types[HTMLInputElement::NUMBER] = "number"; - types[HTMLInputElement::PASSWORD] = "password"; - types[HTMLInputElement::RADIO] = "radio"; - types[HTMLInputElement::RANGE] = "range"; - types[HTMLInputElement::RESET] = "reset"; - types[HTMLInputElement::SEARCH] = "search"; - types[HTMLInputElement::SUBMIT] = "submit"; - types[HTMLInputElement::TELEPHONE] = "tel"; - types[HTMLInputElement::TEXT] = "text"; - types[HTMLInputElement::TIME] = "time"; - types[HTMLInputElement::URL] = "url"; - types[HTMLInputElement::WEEK] = "week"; - return types; -} - const AtomicString& HTMLInputElement::formControlType() const { - static const AtomicString* formControlTypes = createFormControlTypes(); - return formControlTypes[deprecatedInputType()]; + return m_inputType->formControlType(); } bool HTMLInputElement::saveFormControlState(String& result) const @@ -1255,7 +1215,7 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) // FIXME: we need to tell this change to a renderer if the attribute affects the appearance. #endif #if ENABLE(INPUT_SPEECH) - else if (attr->name() == speechAttr) { + else if (attr->name() == webkitspeechAttr) { if (renderer()) renderer()->updateFromElement(); setNeedsStyleRecalc(); @@ -1488,70 +1448,12 @@ void HTMLInputElement::reset() bool HTMLInputElement::isTextField() const { - switch (deprecatedInputType()) { - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - return true; - case BUTTON: - case CHECKBOX: - case FILE: - case HIDDEN: - case IMAGE: - case RADIO: - case RANGE: - case RESET: - case SUBMIT: - return false; - } - ASSERT_NOT_REACHED(); - return false; + return m_inputType->isTextField(); } bool HTMLInputElement::isTextType() const { - switch (deprecatedInputType()) { - case EMAIL: - case PASSWORD: - case SEARCH: - case TELEPHONE: - case TEXT: - case URL: - return true; - case BUTTON: - case CHECKBOX: - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case FILE: - case HIDDEN: - case IMAGE: - case ISINDEX: - case MONTH: - case NUMBER: - case RADIO: - case RANGE: - case RESET: - case SUBMIT: - case TIME: - case WEEK: - return false; - } - ASSERT_NOT_REACHED(); - return false; + return m_inputType->isTextType(); } void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) @@ -2277,6 +2179,11 @@ void HTMLInputElement::defaultEventHandler(Event* evt) return; } } + if (deprecatedInputType() == RANGE && evt->isKeyboardEvent()) { + handleKeyEventForRange(static_cast<KeyboardEvent*>(evt)); + if (evt->defaultHandled()) + return; + } if (isTextField() && evt->type() == eventNames().keydownEvent @@ -2583,6 +2490,47 @@ void HTMLInputElement::handleBeforeTextInsertedEvent(Event* event) InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event); } +void HTMLInputElement::handleKeyEventForRange(KeyboardEvent* event) +{ + if (event->type() != eventNames().keydownEvent) + return; + String key = event->keyIdentifier(); + if (key != "Up" && key != "Right" && key != "Down" && key != "Left") + return; + + ExceptionCode ec; + if (equalIgnoringCase(getAttribute(stepAttr), "any")) { + double min = minimum(); + double max = maximum(); + // FIXME: Is 1/100 reasonable? + double step = (max - min) / 100; + double current = parseToDouble(value(), numeric_limits<double>::quiet_NaN()); + ASSERT(isfinite(current)); + double newValue; + if (key == "Up" || key == "Right") { + newValue = current + step; + if (newValue > max) + newValue = max; + } else { + newValue = current - step; + if (newValue < min) + newValue = min; + } + if (newValue != current) { + setValueAsNumber(newValue, ec); + dispatchFormControlChangeEvent(); + } + } else { + int stepMagnification = (key == "Up" || key == "Right") ? 1 : -1; + String lastStringValue = value(); + stepUp(stepMagnification, ec); + if (lastStringValue != value()) + dispatchFormControlChangeEvent(); + } + event->setDefaultHandled(); + return; +} + PassRefPtr<HTMLFormElement> HTMLInputElement::createTemporaryFormForIsIndex() { RefPtr<HTMLFormElement> form = HTMLFormElement::create(document()); @@ -3010,7 +2958,7 @@ bool HTMLInputElement::isSpeechEnabled() const case SEARCH: case TELEPHONE: case TEXT: - return hasAttribute(speechAttr); + return hasAttribute(webkitspeechAttr); case BUTTON: case CHECKBOX: case COLOR: diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h index 7e601ca..88e2bf7 100644 --- a/WebCore/html/HTMLInputElement.h +++ b/WebCore/html/HTMLInputElement.h @@ -35,6 +35,7 @@ class FileList; class HTMLDataListElement; class HTMLImageLoader; class HTMLOptionElement; +class InputType; class KURL; class VisibleSelection; @@ -65,9 +66,7 @@ public: MONTH, TIME, WEEK, - // If you add new types or change the order of enum values, update deprecatedNumberOfTypes below. }; - static const int deprecatedNumberOfTypes = WEEK + 1; static PassRefPtr<HTMLInputElement> create(const QualifiedName&, Document*, HTMLFormElement*); virtual ~HTMLInputElement(); @@ -325,6 +324,7 @@ private: void updateCheckedRadioButtons(); void handleBeforeTextInsertedEvent(Event*); + void handleKeyEventForRange(KeyboardEvent*); PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex(); // Helper for getAllowedValueStep(); bool getStepParameters(double* defaultStep, double* stepScaleFactor) const; @@ -374,6 +374,7 @@ private: #if ENABLE(DATALIST) bool m_hasNonEmptyList : 1; #endif + OwnPtr<InputType> m_inputType; }; } //namespace diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl index 19e4226..19dfa5a 100644 --- a/WebCore/html/HTMLInputElement.idl +++ b/WebCore/html/HTMLInputElement.idl @@ -100,7 +100,7 @@ module html { readonly attribute NodeList labels; #if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH - attribute [Reflect, EnabledAtRuntime] boolean speech; + attribute [Reflect, EnabledAtRuntime] boolean webkitspeech; #endif }; diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index f753183..6399f60 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -969,22 +969,16 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) return; if (m_seeking) { - // 4.8.10.10, step 8 + // 4.8.10.9, step 11 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) scheduleEvent(eventNames().waitingEvent); - // 4.8.10.10, step 9 - if (m_readyState < HAVE_CURRENT_DATA) { - if (oldState >= HAVE_CURRENT_DATA) - scheduleEvent(eventNames().seekingEvent); - } else { - // 4.8.10.10 step 12 & 13. + // 4.8.10.10 step 14 & 15. + if (m_readyState >= HAVE_CURRENT_DATA) finishSeek(); - } - } else { if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) { - // 4.8.10.9 + // 4.8.10.8 scheduleTimeupdateEvent(false); scheduleEvent(eventNames().waitingEvent); } @@ -1107,27 +1101,39 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec) // Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set. float now = currentTime(); + // 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is + // already running. Abort that other instance of the algorithm without waiting for the step that + // it is running to complete. + // Nothing specific to be done here. + // 3 - Set the seeking IDL attribute to true. - // The flag will be cleared when the engine tells is the time has actually changed + // The flag will be cleared when the engine tells us the time has actually changed. m_seeking = true; - // 4 - Queue a task to fire a simple event named timeupdate at the element. - scheduleTimeupdateEvent(false); - - // 6 - If the new playback position is later than the end of the media resource, then let it be the end + // 5 - If the new playback position is later than the end of the media resource, then let it be the end // of the media resource instead. time = min(time, duration()); - // 7 - If the new playback position is less than the earliest possible position, let it be that position instead. + // 6 - If the new playback position is less than the earliest possible position, let it be that position instead. float earliestTime = m_player->startTime(); time = max(time, earliestTime); - // 8 - If the (possibly now changed) new playback position is not in one of the ranges given in the + // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute // that is the nearest to the new playback position. ... If there are no ranges given in the seekable // attribute then set the seeking IDL attribute to false and abort these steps. RefPtr<TimeRanges> seekableRanges = seekable(); - if (!seekableRanges->length() || time == now) { + + // Short circuit seeking to the current time by just firing the events if no seek is required. + // Don't skip calling the media engine if we are in poster mode because a seek should always + // cancel poster display. + bool noSeekRequired = !seekableRanges->length() || (time == now && displayMode() != Poster); + if (noSeekRequired) { + if (time == now) { + scheduleEvent(eventNames().seekingEvent); + scheduleTimeupdateEvent(false); + scheduleEvent(eventNames().seekedEvent); + } m_seeking = false; return; } @@ -1140,20 +1146,26 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec) m_lastSeekTime = time; m_sentEndEvent = false; - // 9 - Set the current playback position to the given new playback position + // 8 - Set the current playback position to the given new playback position m_player->seek(time); - // 10-15 are handled, if necessary, when the engine signals a readystate change. + // 9 - Queue a task to fire a simple event named seeking at the element. + scheduleEvent(eventNames().seekingEvent); + + // 10 - Queue a task to fire a simple event named timeupdate at the element. + scheduleTimeupdateEvent(false); + + // 11-15 are handled, if necessary, when the engine signals a readystate change. } void HTMLMediaElement::finishSeek() { LOG(Media, "HTMLMediaElement::finishSeek"); - // 4.8.10.10 Seeking step 12 + // 4.8.10.9 Seeking step 14 m_seeking = false; - // 4.8.10.10 Seeking step 13 + // 4.8.10.9 Seeking step 15 scheduleEvent(eventNames().seekedEvent); setDisplayMode(Video); @@ -1666,8 +1678,8 @@ void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*) // movie time. scheduleTimeupdateEvent(false); - // 4.8.10.10 step 12 & 13. Needed if no ReadyState change is associated with the seek. - if (m_readyState >= HAVE_CURRENT_DATA && m_seeking) + // 4.8.10.9 step 14 & 15. Needed if no ReadyState change is associated with the seek. + if (m_seeking && m_readyState >= HAVE_CURRENT_DATA) finishSeek(); float now = currentTime(); diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp index ad6c1b3..a5e7d1e 100644 --- a/WebCore/html/HTMLTextAreaElement.cpp +++ b/WebCore/html/HTMLTextAreaElement.cpp @@ -291,12 +291,20 @@ String HTMLTextAreaElement::value() const void HTMLTextAreaElement::setValue(const String& value) { - setNonDirtyValue(value); + setValueCommon(value); m_isDirty = true; + setNeedsValidityCheck(); } void HTMLTextAreaElement::setNonDirtyValue(const String& value) { + setValueCommon(value); + m_isDirty = false; + setNeedsValidityCheck(); +} + +void HTMLTextAreaElement::setValueCommon(const String& value) +{ // Code elsewhere normalizes line endings added by the user via the keyboard or pasting. // We normalize line endings coming from JavaScript here. String normalizedValue = value.isNull() ? "" : value; @@ -311,8 +319,6 @@ void HTMLTextAreaElement::setNonDirtyValue(const String& value) m_value = normalizedValue; updatePlaceholderVisibility(false); setNeedsStyleRecalc(); - setNeedsValidityCheck(); - m_isDirty = false; setFormControlValueMatchesRenderer(true); // Set the caret to the end of the text value. diff --git a/WebCore/html/HTMLTextAreaElement.h b/WebCore/html/HTMLTextAreaElement.h index 28d0b61..d951c02 100644 --- a/WebCore/html/HTMLTextAreaElement.h +++ b/WebCore/html/HTMLTextAreaElement.h @@ -67,6 +67,7 @@ private: static String sanitizeUserInputValue(const String&, unsigned maxLength); void updateValue() const; void setNonDirtyValue(const String&); + void setValueCommon(const String&); virtual bool supportsPlaceholder() const { return true; } virtual bool isEmptyValue() const { return value().isEmpty(); } diff --git a/WebCore/html/HiddenInputType.cpp b/WebCore/html/HiddenInputType.cpp new file mode 100644 index 0000000..d97fe3a --- /dev/null +++ b/WebCore/html/HiddenInputType.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HiddenInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> HiddenInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new HiddenInputType(element)); +} + +const AtomicString& HiddenInputType::formControlType() const { + return InputTypeNames::hidden(); +} + +} // namespace WebCore diff --git a/WebCore/html/HiddenInputType.h b/WebCore/html/HiddenInputType.h new file mode 100644 index 0000000..564f99e --- /dev/null +++ b/WebCore/html/HiddenInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HiddenInputType_h +#define HiddenInputType_h + +#include "InputType.h" + +namespace WebCore { + +class HiddenInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + HiddenInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // HiddenInputType_h diff --git a/WebCore/html/ImageInputType.cpp b/WebCore/html/ImageInputType.cpp new file mode 100644 index 0000000..78b3981 --- /dev/null +++ b/WebCore/html/ImageInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ImageInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> ImageInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new ImageInputType(element)); +} + +const AtomicString& ImageInputType::formControlType() const +{ + return InputTypeNames::image(); +} + +} // namespace WebCore diff --git a/WebCore/html/ImageInputType.h b/WebCore/html/ImageInputType.h new file mode 100644 index 0000000..00ac77b --- /dev/null +++ b/WebCore/html/ImageInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ImageInputType_h +#define ImageInputType_h + +#include "InputType.h" + +namespace WebCore { + +class ImageInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + ImageInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // ImageInputType_h diff --git a/WebCore/html/InputType.cpp b/WebCore/html/InputType.cpp new file mode 100644 index 0000000..c3435f7 --- /dev/null +++ b/WebCore/html/InputType.cpp @@ -0,0 +1,277 @@ +/* + * 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 Apple Inc. All rights reserved. + * (C) 2006 Alexey Proskuryakov (ap@nypop.com) + * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2010 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 "InputType.h" + +#include "ButtonInputType.h" +#include "CheckboxInputType.h" +#include "ColorInputType.h" +#include "DateInputType.h" +#include "DateTimeInputType.h" +#include "DateTimeLocalInputType.h" +#include "EmailInputType.h" +#include "FileInputType.h" +#include "HTMLInputElement.h" +#include "HiddenInputType.h" +#include "ImageInputType.h" +#include "IsIndexInputType.h" +#include "MonthInputType.h" +#include "NumberInputType.h" +#include "PasswordInputType.h" +#include "RadioInputType.h" +#include "RangeInputType.h" +#include "RegularExpression.h" +#include "ResetInputType.h" +#include "SearchInputType.h" +#include "SubmitInputType.h" +#include "TelephoneInputType.h" +#include "TextInputType.h" +#include "TimeInputType.h" +#include "URLInputType.h" +#include "WeekInputType.h" +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +typedef HashMap<String, PassOwnPtr<InputType> (*)(HTMLInputElement*), CaseFoldingHash> InputTypeFactoryMap; +static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() +{ + OwnPtr<InputTypeFactoryMap> map = adoptPtr(new InputTypeFactoryMap); + map->add(InputTypeNames::button(), ButtonInputType::create); + map->add(InputTypeNames::checkbox(), CheckboxInputType::create); + map->add(InputTypeNames::color(), ColorInputType::create); + map->add(InputTypeNames::date(), DateInputType::create); + map->add(InputTypeNames::datetime(), DateTimeInputType::create); + map->add(InputTypeNames::datetimelocal(), DateTimeLocalInputType::create); + map->add(InputTypeNames::email(), EmailInputType::create); + map->add(InputTypeNames::file(), FileInputType::create); + map->add(InputTypeNames::hidden(), HiddenInputType::create); + map->add(InputTypeNames::image(), ImageInputType::create); + map->add(InputTypeNames::isindex(), IsIndexInputType::create); + map->add(InputTypeNames::month(), MonthInputType::create); + map->add(InputTypeNames::number(), NumberInputType::create); + map->add(InputTypeNames::password(), PasswordInputType::create); + map->add(InputTypeNames::radio(), RadioInputType::create); + map->add(InputTypeNames::range(), RangeInputType::create); + map->add(InputTypeNames::reset(), ResetInputType::create); + map->add(InputTypeNames::search(), SearchInputType::create); + map->add(InputTypeNames::submit(), SubmitInputType::create); + map->add(InputTypeNames::telephone(), TelephoneInputType::create); + map->add(InputTypeNames::time(), TimeInputType::create); + map->add(InputTypeNames::url(), URLInputType::create); + map->add(InputTypeNames::week(), WeekInputType::create); + // No need to register "text" because it is the default type. + return map.release(); +} + +PassOwnPtr<InputType> InputType::create(HTMLInputElement* element, const AtomicString& typeName) +{ + static const InputTypeFactoryMap* factoryMap = createInputTypeFactoryMap().leakPtr(); + PassOwnPtr<InputType> (*factory)(HTMLInputElement*) = typeName.isEmpty() ? 0 : factoryMap->get(typeName); + if (!factory) + factory = TextInputType::create; + return factory(element); +} + +PassOwnPtr<InputType> InputType::createText(HTMLInputElement* element) +{ + return TextInputType::create(element); +} + +InputType::~InputType() +{ +} + +bool InputType::isTextField() const +{ + return false; +} + +bool InputType::isTextType() const +{ + return false; +} + +bool InputType::patternMismatch(const String&) const +{ + return false; +} + +namespace InputTypeNames { + +// The type names must be lowercased because they will be the return values of +// input.type and input.type must be lowercase according to DOM Level 2. + +const AtomicString& button() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("button")); + return name; +} + +const AtomicString& checkbox() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("checkbox")); + return name; +} + +const AtomicString& color() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("color")); + return name; +} + +const AtomicString& date() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("date")); + return name; +} + +const AtomicString& datetime() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("datetime")); + return name; +} + +const AtomicString& datetimelocal() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("datetime-local")); + return name; +} + +const AtomicString& email() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("email")); + return name; +} + +const AtomicString& file() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("file")); + return name; +} + +const AtomicString& hidden() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("hidden")); + return name; +} + +const AtomicString& image() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("image")); + return name; +} + +const AtomicString& isindex() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("khtml_isindex")); + return name; +} + +const AtomicString& month() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("month")); + return name; +} + +const AtomicString& number() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("number")); + return name; +} + +const AtomicString& password() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("password")); + return name; +} + +const AtomicString& radio() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("radio")); + return name; +} + +const AtomicString& range() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("range")); + return name; +} + +const AtomicString& reset() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("reset")); + return name; +} + +const AtomicString& search() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("search")); + return name; +} + +const AtomicString& submit() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("submit")); + return name; +} + +const AtomicString& telephone() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("tel")); + return name; +} + +const AtomicString& text() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("text")); + return name; +} + +const AtomicString& time() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("time")); + return name; +} + +const AtomicString& url() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("url")); + return name; +} + +const AtomicString& week() +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("week")); + return name; +} + +} // namespace WebCore::InpuTypeNames + +} // namespace WebCore + diff --git a/WebCore/html/InputType.h b/WebCore/html/InputType.h new file mode 100644 index 0000000..3141f34 --- /dev/null +++ b/WebCore/html/InputType.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InputType_h +#define InputType_h + +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class HTMLInputElement; + +class InputType : public Noncopyable { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*, const AtomicString&); + static PassOwnPtr<InputType> createText(HTMLInputElement*); + virtual ~InputType(); + + virtual bool isTextField() const; + virtual bool isTextType() const; + virtual const AtomicString& formControlType() const = 0; + + virtual bool patternMismatch(const String&) const; + +protected: + InputType(HTMLInputElement* element) : m_element(element) { } + HTMLInputElement* element() const { return m_element; } + +private: + // Raw pointer because the HTMLInputElement object owns this InputType object. + HTMLInputElement* m_element; +}; + +namespace InputTypeNames { + +const AtomicString& button(); +const AtomicString& checkbox(); +const AtomicString& color(); +const AtomicString& date(); +const AtomicString& datetime(); +const AtomicString& datetimelocal(); +const AtomicString& email(); +const AtomicString& file(); +const AtomicString& hidden(); +const AtomicString& image(); +const AtomicString& isindex(); +const AtomicString& month(); +const AtomicString& number(); +const AtomicString& password(); +const AtomicString& radio(); +const AtomicString& range(); +const AtomicString& reset(); +const AtomicString& search(); +const AtomicString& submit(); +const AtomicString& telephone(); +const AtomicString& text(); +const AtomicString& time(); +const AtomicString& url(); +const AtomicString& week(); + +} // namespace WebCore::InputTypeNames + +} // namespace WebCore + +#endif diff --git a/WebCore/html/IsIndexInputType.cpp b/WebCore/html/IsIndexInputType.cpp new file mode 100644 index 0000000..80e0617 --- /dev/null +++ b/WebCore/html/IsIndexInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IsIndexInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> IsIndexInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new IsIndexInputType(element)); +} + +const AtomicString& IsIndexInputType::formControlType() const +{ + return emptyAtom; +} + +} // namespace WebCore diff --git a/WebCore/html/IsIndexInputType.h b/WebCore/html/IsIndexInputType.h new file mode 100644 index 0000000..93a1c08 --- /dev/null +++ b/WebCore/html/IsIndexInputType.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IsIndexInputType_h +#define IsIndexInputType_h + +#include "TextFieldInputType.h" +#include <wtf/text/AtomicString.h> + +namespace WebCore { + +class IsIndexInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + IsIndexInputType(HTMLInputElement* element) : TextFieldInputType(element) { }; + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // IsIndexInputType_h diff --git a/WebCore/html/MonthInputType.cpp b/WebCore/html/MonthInputType.cpp new file mode 100644 index 0000000..54f78c6 --- /dev/null +++ b/WebCore/html/MonthInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "MonthInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> MonthInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new MonthInputType(element)); +} + +const AtomicString& MonthInputType::formControlType() const +{ + return InputTypeNames::month(); +} + +} // namespace WebCore diff --git a/WebCore/html/MonthInputType.h b/WebCore/html/MonthInputType.h new file mode 100644 index 0000000..d605ffa --- /dev/null +++ b/WebCore/html/MonthInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef MonthInputType_h +#define MonthInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class MonthInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + MonthInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // MonthInputType_h diff --git a/WebCore/html/NumberInputType.cpp b/WebCore/html/NumberInputType.cpp new file mode 100644 index 0000000..9aba5c3 --- /dev/null +++ b/WebCore/html/NumberInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "NumberInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> NumberInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new NumberInputType(element)); +} + +const AtomicString& NumberInputType::formControlType() const +{ + return InputTypeNames::number(); +} + +} // namespace WebCore diff --git a/WebCore/html/NumberInputType.h b/WebCore/html/NumberInputType.h new file mode 100644 index 0000000..5347249 --- /dev/null +++ b/WebCore/html/NumberInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NumberInputType_h +#define NumberInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class NumberInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + NumberInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // NumberInputType_h diff --git a/WebCore/html/PasswordInputType.cpp b/WebCore/html/PasswordInputType.cpp new file mode 100644 index 0000000..a645f96 --- /dev/null +++ b/WebCore/html/PasswordInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "PasswordInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> PasswordInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new PasswordInputType(element)); +} + +const AtomicString& PasswordInputType::formControlType() const +{ + return InputTypeNames::password(); +} + +} // namespace WebCore diff --git a/WebCore/html/PasswordInputType.h b/WebCore/html/PasswordInputType.h new file mode 100644 index 0000000..db13449 --- /dev/null +++ b/WebCore/html/PasswordInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PasswordInputType_h +#define PasswordInputType_h + +#include "BaseTextInputType.h" + +namespace WebCore { + +class PasswordInputType : public BaseTextInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + PasswordInputType(HTMLInputElement* element) : BaseTextInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // PasswordInputType_h diff --git a/WebCore/html/RadioInputType.cpp b/WebCore/html/RadioInputType.cpp new file mode 100644 index 0000000..a1c8d04 --- /dev/null +++ b/WebCore/html/RadioInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "RadioInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> RadioInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new RadioInputType(element)); +} + +const AtomicString& RadioInputType::formControlType() const +{ + return InputTypeNames::radio(); +} + +} // namespace WebCore diff --git a/WebCore/html/RadioInputType.h b/WebCore/html/RadioInputType.h new file mode 100644 index 0000000..180c6dd --- /dev/null +++ b/WebCore/html/RadioInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RadioInputType_h +#define RadioInputType_h + +#include "InputType.h" + +namespace WebCore { + +class RadioInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + RadioInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // RadioInputType_h diff --git a/WebCore/html/RangeInputType.cpp b/WebCore/html/RangeInputType.cpp new file mode 100644 index 0000000..f5f7322 --- /dev/null +++ b/WebCore/html/RangeInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "RangeInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> RangeInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new RangeInputType(element)); +} + +const AtomicString& RangeInputType::formControlType() const +{ + return InputTypeNames::range(); +} + +} // namespace WebCore diff --git a/WebCore/html/RangeInputType.h b/WebCore/html/RangeInputType.h new file mode 100644 index 0000000..d42c617 --- /dev/null +++ b/WebCore/html/RangeInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RangeInputType_h +#define RangeInputType_h + +#include "InputType.h" + +namespace WebCore { + +class RangeInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + RangeInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // RangeInputType_h diff --git a/WebCore/html/ResetInputType.cpp b/WebCore/html/ResetInputType.cpp new file mode 100644 index 0000000..8b18a8d --- /dev/null +++ b/WebCore/html/ResetInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ResetInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> ResetInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new ResetInputType(element)); +} + +const AtomicString& ResetInputType::formControlType() const +{ + return InputTypeNames::reset(); +} + +} // namespace WebCore diff --git a/WebCore/html/ResetInputType.h b/WebCore/html/ResetInputType.h new file mode 100644 index 0000000..e0d8997 --- /dev/null +++ b/WebCore/html/ResetInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ResetInputType_h +#define ResetInputType_h + +#include "InputType.h" + +namespace WebCore { + +class ResetInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + ResetInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // ResetInputType_h diff --git a/WebCore/html/SearchInputType.cpp b/WebCore/html/SearchInputType.cpp new file mode 100644 index 0000000..6f3a01c --- /dev/null +++ b/WebCore/html/SearchInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SearchInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> SearchInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new SearchInputType(element)); +} + +const AtomicString& SearchInputType::formControlType() const +{ + return InputTypeNames::search(); +} + +} // namespace WebCore diff --git a/WebCore/html/SearchInputType.h b/WebCore/html/SearchInputType.h new file mode 100644 index 0000000..edffdb0 --- /dev/null +++ b/WebCore/html/SearchInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SearchInputType_h +#define SearchInputType_h + +#include "BaseTextInputType.h" + +namespace WebCore { + +class SearchInputType : public BaseTextInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + SearchInputType(HTMLInputElement* element) : BaseTextInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // SearchInputType_h diff --git a/WebCore/html/SubmitInputType.cpp b/WebCore/html/SubmitInputType.cpp new file mode 100644 index 0000000..dd13e6b --- /dev/null +++ b/WebCore/html/SubmitInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SubmitInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> SubmitInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new SubmitInputType(element)); +} + +const AtomicString& SubmitInputType::formControlType() const +{ + return InputTypeNames::submit(); +} + +} // namespace WebCore diff --git a/WebCore/html/SubmitInputType.h b/WebCore/html/SubmitInputType.h new file mode 100644 index 0000000..7ea448e --- /dev/null +++ b/WebCore/html/SubmitInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SubmitInputType_h +#define SubmitInputType_h + +#include "InputType.h" + +namespace WebCore { + +class SubmitInputType : public InputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + SubmitInputType(HTMLInputElement* element) : InputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // SubmitInputType_h diff --git a/WebCore/html/TelephoneInputType.cpp b/WebCore/html/TelephoneInputType.cpp new file mode 100644 index 0000000..27d66ce --- /dev/null +++ b/WebCore/html/TelephoneInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TelephoneInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> TelephoneInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new TelephoneInputType(element)); +} + +const AtomicString& TelephoneInputType::formControlType() const +{ + return InputTypeNames::telephone(); +} + +} // namespace WebCore diff --git a/WebCore/html/TelephoneInputType.h b/WebCore/html/TelephoneInputType.h new file mode 100644 index 0000000..9458f50 --- /dev/null +++ b/WebCore/html/TelephoneInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TelephoneInputType_h +#define TelephoneInputType_h + +#include "BaseTextInputType.h" + +namespace WebCore { + +class TelephoneInputType : public BaseTextInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + TelephoneInputType(HTMLInputElement* element) : BaseTextInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // TelephoneInputType_h diff --git a/WebCore/html/TextFieldInputType.cpp b/WebCore/html/TextFieldInputType.cpp new file mode 100644 index 0000000..e681b40 --- /dev/null +++ b/WebCore/html/TextFieldInputType.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TextFieldInputType.h" + +namespace WebCore { + +bool TextFieldInputType::isTextField() const +{ + return true; +} + +} // namespace WebCore diff --git a/WebCore/html/TextFieldInputType.h b/WebCore/html/TextFieldInputType.h new file mode 100644 index 0000000..fb33a01 --- /dev/null +++ b/WebCore/html/TextFieldInputType.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TextFieldInputType_h +#define TextFieldInputType_h + +#include "InputType.h" + +namespace WebCore { + +// The class represents types of which UI contain text fields. +// It supports not only the types for BaseTextInputType but also type=number. +class TextFieldInputType : public InputType { +protected: + TextFieldInputType(HTMLInputElement* element) : InputType(element) { } + virtual bool isTextField() const; +}; + +} // namespace WebCore + +#endif // TextFieldInputType_h diff --git a/WebCore/html/TextInputType.cpp b/WebCore/html/TextInputType.cpp new file mode 100644 index 0000000..23a8679 --- /dev/null +++ b/WebCore/html/TextInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TextInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> TextInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new TextInputType(element)); +} + +const AtomicString& TextInputType::formControlType() const +{ + return InputTypeNames::text(); +} + +} // namespace WebCore diff --git a/WebCore/html/TextInputType.h b/WebCore/html/TextInputType.h new file mode 100644 index 0000000..89fd9b0 --- /dev/null +++ b/WebCore/html/TextInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TextInputType_h +#define TextInputType_h + +#include "BaseTextInputType.h" + +namespace WebCore { + +class TextInputType : public BaseTextInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + TextInputType(HTMLInputElement* element) : BaseTextInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // TextInputType_h diff --git a/WebCore/html/TimeInputType.cpp b/WebCore/html/TimeInputType.cpp new file mode 100644 index 0000000..1564bc5 --- /dev/null +++ b/WebCore/html/TimeInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TimeInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> TimeInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new TimeInputType(element)); +} + +const AtomicString& TimeInputType::formControlType() const +{ + return InputTypeNames::time(); +} + +} // namespace WebCore diff --git a/WebCore/html/TimeInputType.h b/WebCore/html/TimeInputType.h new file mode 100644 index 0000000..9530f7d --- /dev/null +++ b/WebCore/html/TimeInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TimeInputType_h +#define TimeInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class TimeInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + TimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // TimeInputType_h diff --git a/WebCore/html/URLInputType.cpp b/WebCore/html/URLInputType.cpp new file mode 100644 index 0000000..2afdcde --- /dev/null +++ b/WebCore/html/URLInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "URLInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> URLInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new URLInputType(element)); +} + +const AtomicString& URLInputType::formControlType() const +{ + return InputTypeNames::url(); +} + +} // namespace WebCore diff --git a/WebCore/html/URLInputType.h b/WebCore/html/URLInputType.h new file mode 100644 index 0000000..85d4f9f --- /dev/null +++ b/WebCore/html/URLInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef URLInputType_h +#define URLInputType_h + +#include "BaseTextInputType.h" + +namespace WebCore { + +class URLInputType : public BaseTextInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + URLInputType(HTMLInputElement* element) : BaseTextInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // URLInputType_h diff --git a/WebCore/html/WeekInputType.cpp b/WebCore/html/WeekInputType.cpp new file mode 100644 index 0000000..0b4ab30 --- /dev/null +++ b/WebCore/html/WeekInputType.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WeekInputType.h" + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +PassOwnPtr<InputType> WeekInputType::create(HTMLInputElement* element) +{ + return adoptPtr(new WeekInputType(element)); +} + +const AtomicString& WeekInputType::formControlType() const +{ + return InputTypeNames::week(); +} + +} // namespace WebCore diff --git a/WebCore/html/WeekInputType.h b/WebCore/html/WeekInputType.h new file mode 100644 index 0000000..7b6ee23 --- /dev/null +++ b/WebCore/html/WeekInputType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WeekInputType_h +#define WeekInputType_h + +#include "TextFieldInputType.h" + +namespace WebCore { + +class WeekInputType : public TextFieldInputType { +public: + static PassOwnPtr<InputType> create(HTMLInputElement*); + +private: + WeekInputType(HTMLInputElement* element) : TextFieldInputType(element) { } + virtual const AtomicString& formControlType() const; +}; + +} // namespace WebCore + +#endif // WeekInputType_h diff --git a/WebCore/html/canvas/CanvasRenderingContext.cpp b/WebCore/html/canvas/CanvasRenderingContext.cpp index e019332..c814c66 100644 --- a/WebCore/html/canvas/CanvasRenderingContext.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext.cpp @@ -25,7 +25,14 @@ #include "config.h" #include "CanvasRenderingContext.h" + +#include "CachedImage.h" +#include "CanvasPattern.h" #include "HTMLCanvasElement.h" +#include "HTMLImageElement.h" +#include "HTMLVideoElement.h" +#include "KURL.h" +#include "SecurityOrigin.h" namespace WebCore { @@ -44,4 +51,48 @@ void CanvasRenderingContext::deref() m_canvas->deref(); } +void CanvasRenderingContext::checkOrigin(const CanvasPattern* pattern) +{ + if (canvas()->originClean() && pattern && !pattern->originClean()) + canvas()->setOriginTainted(); +} + +void CanvasRenderingContext::checkOrigin(const HTMLCanvasElement* sourceCanvas) +{ + if (canvas()->originClean() && sourceCanvas && !sourceCanvas->originClean()) + canvas()->setOriginTainted(); +} + +void CanvasRenderingContext::checkOrigin(const HTMLImageElement* image) +{ + if (!image || !canvas()->originClean()) + return; + + CachedImage* cachedImage = image->cachedImage(); + checkOrigin(cachedImage->response().url()); + + if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); +} + +void CanvasRenderingContext::checkOrigin(const HTMLVideoElement* video) +{ +#if ENABLE(VIDEO) + checkOrigin(KURL(KURL(), video->currentSrc())); + if (canvas()->originClean() && video && !video->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); +#endif +} + +void CanvasRenderingContext::checkOrigin(const KURL& url) +{ + if (!canvas()->originClean() || m_cleanOrigins.contains(url.string())) + return; + + if (canvas()->securityOrigin().taintsCanvas(url)) + canvas()->setOriginTainted(); + else + m_cleanOrigins.add(url.string()); +} + } // namespace WebCore diff --git a/WebCore/html/canvas/CanvasRenderingContext.h b/WebCore/html/canvas/CanvasRenderingContext.h index 8499b47..a25e8a1 100644 --- a/WebCore/html/canvas/CanvasRenderingContext.h +++ b/WebCore/html/canvas/CanvasRenderingContext.h @@ -28,38 +28,52 @@ #include "GraphicsLayer.h" +#include <wtf/HashSet.h> #include <wtf/Noncopyable.h> +#include <wtf/text/StringHash.h> namespace WebCore { - class WebGLObject; - class HTMLCanvasElement; +class CanvasPattern; +class HTMLCanvasElement; +class HTMLImageElement; +class HTMLVideoElement; +class KURL; +class WebGLObject; - class CanvasRenderingContext : public Noncopyable { - public: - CanvasRenderingContext(HTMLCanvasElement*); - virtual ~CanvasRenderingContext() { } - - // Ref and deref the m_canvas - void ref(); - void deref(); - - HTMLCanvasElement* canvas() const { return m_canvas; } - - virtual bool is2d() const { return false; } - virtual bool is3d() const { return false; } - virtual bool isAccelerated() const { return false; } - - virtual void paintRenderingResultsToCanvas() {} - virtual bool paintsIntoCanvasBuffer() const { return true; } +class CanvasRenderingContext : public Noncopyable { +public: + CanvasRenderingContext(HTMLCanvasElement*); + virtual ~CanvasRenderingContext() { } + + // Ref and deref the m_canvas + void ref(); + void deref(); + + HTMLCanvasElement* canvas() const { return m_canvas; } + + virtual bool is2d() const { return false; } + virtual bool is3d() const { return false; } + virtual bool isAccelerated() const { return false; } + + virtual void paintRenderingResultsToCanvas() {} + virtual bool paintsIntoCanvasBuffer() const { return true; } #if USE(ACCELERATED_COMPOSITING) - virtual PlatformLayer* platformLayer() const { return 0; } + virtual PlatformLayer* platformLayer() const { return 0; } #endif - private: - HTMLCanvasElement* m_canvas; - }; +protected: + void checkOrigin(const CanvasPattern*); + void checkOrigin(const HTMLCanvasElement*); + void checkOrigin(const HTMLImageElement*); + void checkOrigin(const HTMLVideoElement*); + void checkOrigin(const KURL&); + +private: + HTMLCanvasElement* m_canvas; + HashSet<String> m_cleanOrigins; +}; } // namespace WebCore diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 0fb7ed5..161a891 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -249,12 +249,7 @@ void CanvasRenderingContext2D::setStrokeStyle(PassRefPtr<CanvasStyle> style) if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(*style)) return; - if (canvas()->originClean()) { - if (CanvasPattern* pattern = style->canvasPattern()) { - if (!pattern->originClean()) - canvas()->setOriginTainted(); - } - } + checkOrigin(style->canvasPattern()); state().m_strokeStyle = style; GraphicsContext* c = drawingContext(); @@ -277,12 +272,7 @@ void CanvasRenderingContext2D::setFillStyle(PassRefPtr<CanvasStyle> style) if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(*style)) return; - if (canvas()->originClean()) { - if (CanvasPattern* pattern = style->canvasPattern()) { - if (!pattern->originClean()) - canvas()->setOriginTainted(); - } - } + checkOrigin(style->canvasPattern()); state().m_fillStyle = style; GraphicsContext* c = drawingContext(); @@ -1121,25 +1111,6 @@ static inline FloatRect normalizeRect(const FloatRect& rect) max(rect.height(), -rect.height())); } -void CanvasRenderingContext2D::checkOrigin(const KURL& url) -{ - if (m_cleanOrigins.contains(url.string())) - return; - - if (canvas()->securityOrigin().taintsCanvas(url)) - canvas()->setOriginTainted(); - else - m_cleanOrigins.add(url.string()); -} - -void CanvasRenderingContext2D::checkOrigin(const String& url) -{ - if (m_cleanOrigins.contains(url)) - return; - - checkOrigin(KURL(KURL(), url)); -} - void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y, ExceptionCode& ec) { if (!image) { @@ -1186,18 +1157,21 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec || !isfinite(srcRect.x()) || !isfinite(srcRect.y()) || !isfinite(srcRect.width()) || !isfinite(srcRect.height())) return; + if (!dstRect.width() || !dstRect.height()) + return; + if (!image->complete()) return; + FloatRect normalizedSrcRect = normalizeRect(srcRect); + FloatRect normalizedDstRect = normalizeRect(dstRect); + FloatRect imageRect = FloatRect(FloatPoint(), size(image)); - if (!imageRect.contains(normalizeRect(srcRect)) || !srcRect.width() || !srcRect.height()) { + if (!imageRect.contains(normalizedSrcRect) || !srcRect.width() || !srcRect.height()) { ec = INDEX_SIZE_ERR; return; } - if (!dstRect.width() || !dstRect.height()) - return; - GraphicsContext* c = drawingContext(); if (!c) return; @@ -1208,14 +1182,10 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec if (!cachedImage) return; - if (canvas()->originClean()) - checkOrigin(cachedImage->response().url()); - - if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) - canvas()->setOriginTainted(); + checkOrigin(image); - FloatRect sourceRect = c->roundToDevicePixels(srcRect); - FloatRect destRect = c->roundToDevicePixels(dstRect); + FloatRect sourceRect = c->roundToDevicePixels(normalizedSrcRect); + FloatRect destRect = c->roundToDevicePixels(normalizedDstRect); c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); didDraw(destRect); } @@ -1285,8 +1255,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const if (!buffer) return; - if (!sourceCanvas->originClean()) - canvas()->setOriginTainted(); + checkOrigin(sourceCanvas); #if ENABLE(ACCELERATED_2D_CANVAS) // If we're drawing from one accelerated canvas 2d to another, avoid calling sourceCanvas->makeRenderingResultsAvailable() @@ -1360,11 +1329,7 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec if (!state().m_invertibleCTM) return; - if (canvas()->originClean()) - checkOrigin(video->currentSrc()); - - if (canvas()->originClean() && !video->hasSingleSecurityOrigin()) - canvas()->setOriginTainted(); + checkOrigin(video); FloatRect sourceRect = c->roundToDevicePixels(srcRect); FloatRect destRect = c->roundToDevicePixels(dstRect); @@ -1393,11 +1358,7 @@ void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image, if (!cachedImage) return; - if (canvas()->originClean()) - checkOrigin(cachedImage->response().url()); - - if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) - canvas()->setOriginTainted(); + checkOrigin(image); GraphicsContext* c = drawingContext(); if (!c) @@ -1689,6 +1650,7 @@ void CanvasRenderingContext2D::setFont(const String& newFont) RefPtr<RenderStyle> newStyle = RenderStyle::create(); if (RenderStyle* computedStyle = canvas()->computedStyle()) newStyle->setFontDescription(computedStyle->fontDescription()); + newStyle->font().update(newStyle->font().fontSelector()); // Now map the font property into the style. CSSStyleSelector* styleSelector = canvas()->styleSelector(); diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h index 91b6549..2c88a31 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -36,7 +36,6 @@ #include "PlatformString.h" #include <wtf/Vector.h> -#include <wtf/text/StringHash.h> #if PLATFORM(CG) #include <ApplicationServices/ApplicationServices.h> @@ -57,7 +56,6 @@ class HTMLCanvasElement; class HTMLImageElement; class HTMLVideoElement; class ImageData; -class KURL; class TextMetrics; #if ENABLE(ACCELERATED_2D_CANVAS) @@ -289,11 +287,6 @@ private: void prepareGradientForDashboard(CanvasGradient* gradient) const; - HashSet<String> m_cleanOrigins; - - void checkOrigin(const KURL&); - void checkOrigin(const String&); - Vector<State, 1> m_stateStack; bool m_usesCSSCompatibilityParseMode; #if ENABLE(DASHBOARD_SUPPORT) diff --git a/WebCore/html/canvas/WebGLBuffer.cpp b/WebCore/html/canvas/WebGLBuffer.cpp index d43868d..99d9cad 100644 --- a/WebCore/html/canvas/WebGLBuffer.cpp +++ b/WebCore/html/canvas/WebGLBuffer.cpp @@ -52,7 +52,8 @@ WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx) void WebGLBuffer::deleteObjectImpl(Platform3DObject object) { - context()->graphicsContext3D()->deleteBuffer(object); + if (!isDeleted()) + context()->graphicsContext3D()->deleteBuffer(object); } bool WebGLBuffer::associateBufferDataImpl(ArrayBuffer* array, unsigned byteOffset, unsigned byteLength) diff --git a/WebCore/html/canvas/WebGLFramebuffer.cpp b/WebCore/html/canvas/WebGLFramebuffer.cpp index 6291705..a709341 100644 --- a/WebCore/html/canvas/WebGLFramebuffer.cpp +++ b/WebCore/html/canvas/WebGLFramebuffer.cpp @@ -40,10 +40,6 @@ PassRefPtr<WebGLFramebuffer> WebGLFramebuffer::create(WebGLRenderingContext* ctx WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContext* ctx) : WebGLObject(ctx) - , m_colorAttachment(0) - , m_depthAttachment(0) - , m_stencilAttachment(0) - , m_depthStencilAttachment(0) { setObject(context()->graphicsContext3D()->createFramebuffer()); } @@ -73,6 +69,23 @@ void WebGLFramebuffer::setAttachment(unsigned long attachment, WebGLObject* atta initializeRenderbuffers(); } +void WebGLFramebuffer::removeAttachment(WebGLObject* attachment) +{ + if (!object()) + return; + if (attachment == m_colorAttachment.get()) + m_colorAttachment = 0; + else if (attachment == m_depthAttachment.get()) + m_depthAttachment = 0; + else if (attachment == m_stencilAttachment.get()) + m_stencilAttachment = 0; + else if (attachment == m_depthStencilAttachment.get()) + m_depthStencilAttachment = 0; + else + return; + initializeRenderbuffers(); +} + void WebGLFramebuffer::onBind() { initializeRenderbuffers(); @@ -83,8 +96,8 @@ void WebGLFramebuffer::onAttachedObjectChange(WebGLObject* object) // Currently object == 0 is not considered, but this might change if the // lifespan of WebGLObject changes. if (object - && (object == m_colorAttachment || object == m_depthAttachment - || object == m_stencilAttachment || object == m_depthStencilAttachment)) + && (object == m_colorAttachment.get() || object == m_depthAttachment.get() + || object == m_stencilAttachment.get() || object == m_depthStencilAttachment.get())) initializeRenderbuffers(); } @@ -92,7 +105,7 @@ unsigned long WebGLFramebuffer::getColorBufferFormat() { if (object() && m_colorAttachment && m_colorAttachment->object()) { if (m_colorAttachment->isRenderbuffer()) { - unsigned long format = (reinterpret_cast<WebGLRenderbuffer*>(m_colorAttachment))->getInternalFormat(); + unsigned long format = (reinterpret_cast<WebGLRenderbuffer*>(m_colorAttachment.get()))->getInternalFormat(); switch (format) { case GraphicsContext3D::RGBA4: case GraphicsContext3D::RGB5_A1: @@ -101,14 +114,19 @@ unsigned long WebGLFramebuffer::getColorBufferFormat() return GraphicsContext3D::RGB; } } else if (m_colorAttachment->isTexture()) - return (reinterpret_cast<WebGLTexture*>(m_colorAttachment))->getInternalFormat(0); + return (reinterpret_cast<WebGLTexture*>(m_colorAttachment.get()))->getInternalFormat(0); } return 0; } void WebGLFramebuffer::deleteObjectImpl(Platform3DObject object) { - context()->graphicsContext3D()->deleteFramebuffer(object); + if (!isDeleted()) + context()->graphicsContext3D()->deleteFramebuffer(object); + m_colorAttachment = 0; + m_depthAttachment = 0; + m_stencilAttachment = 0; + m_depthStencilAttachment = 0; } bool WebGLFramebuffer::isUninitialized(WebGLObject* attachedObject) @@ -131,19 +149,19 @@ void WebGLFramebuffer::initializeRenderbuffers() return; bool initColor = false, initDepth = false, initStencil = false; unsigned long mask = 0; - if (isUninitialized(m_colorAttachment)) { + if (isUninitialized(m_colorAttachment.get())) { initColor = true; mask |= GraphicsContext3D::COLOR_BUFFER_BIT; } - if (isUninitialized(m_depthAttachment)) { + if (isUninitialized(m_depthAttachment.get())) { initDepth = true; mask |= GraphicsContext3D::DEPTH_BUFFER_BIT; } - if (isUninitialized(m_stencilAttachment)) { + if (isUninitialized(m_stencilAttachment.get())) { initStencil = true; mask |= GraphicsContext3D::STENCIL_BUFFER_BIT; } - if (isUninitialized(m_depthStencilAttachment)) { + if (isUninitialized(m_depthStencilAttachment.get())) { initDepth = true; initStencil = true; mask |= (GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT); @@ -209,14 +227,14 @@ void WebGLFramebuffer::initializeRenderbuffers() g3d->disable(GraphicsContext3D::DITHER); if (initColor) - setInitialized(m_colorAttachment); + setInitialized(m_colorAttachment.get()); if (initDepth && initStencil && m_depthStencilAttachment) - setInitialized(m_depthStencilAttachment); + setInitialized(m_depthStencilAttachment.get()); else { if (initDepth) - setInitialized(m_depthAttachment); + setInitialized(m_depthAttachment.get()); if (initStencil) - setInitialized(m_stencilAttachment); + setInitialized(m_stencilAttachment.get()); } } diff --git a/WebCore/html/canvas/WebGLFramebuffer.h b/WebCore/html/canvas/WebGLFramebuffer.h index ac945dd..1892694 100644 --- a/WebCore/html/canvas/WebGLFramebuffer.h +++ b/WebCore/html/canvas/WebGLFramebuffer.h @@ -44,6 +44,8 @@ public: bool isDepthStencilAttached() const { return (m_depthStencilAttachment && m_depthStencilAttachment->object()); } void setAttachment(unsigned long, WebGLObject*); + // If an object is attached to the framebuffer, remove it. + void removeAttachment(WebGLObject*); // This function is called right after a framebuffer is bound. // Because renderbuffers and textures attached to the framebuffer might @@ -71,12 +73,10 @@ private: void setInitialized(WebGLObject*); void initializeRenderbuffers(); - // These objects are kept alive by the global table in - // WebGLRenderingContext. - WebGLObject* m_colorAttachment; - WebGLObject* m_depthAttachment; - WebGLObject* m_stencilAttachment; - WebGLObject* m_depthStencilAttachment; + RefPtr<WebGLObject> m_colorAttachment; + RefPtr<WebGLObject> m_depthAttachment; + RefPtr<WebGLObject> m_stencilAttachment; + RefPtr<WebGLObject> m_depthStencilAttachment; }; } // namespace WebCore diff --git a/WebCore/html/canvas/WebGLObject.cpp b/WebCore/html/canvas/WebGLObject.cpp index 5fd5534..8aa4663 100644 --- a/WebCore/html/canvas/WebGLObject.cpp +++ b/WebCore/html/canvas/WebGLObject.cpp @@ -49,10 +49,8 @@ WebGLObject::~WebGLObject() void WebGLObject::setObject(Platform3DObject object) { - if (object == m_object) - return; - - deleteObject(); + // object==0 && m_deleted==false indicating an uninitialized state; + ASSERT(!m_object && !m_deleted); m_object = object; } diff --git a/WebCore/html/canvas/WebGLObject.h b/WebCore/html/canvas/WebGLObject.h index 18d4cf9..82b8079 100644 --- a/WebCore/html/canvas/WebGLObject.h +++ b/WebCore/html/canvas/WebGLObject.h @@ -40,7 +40,6 @@ public: virtual ~WebGLObject(); Platform3DObject object() const { return m_object; } - void setObject(Platform3DObject); void deleteObject(); void detachContext() @@ -64,13 +63,22 @@ public: if (m_attachmentCount) --m_attachmentCount; if (!m_attachmentCount && m_deleted) - m_object = 0; + deleteObject(); } unsigned getAttachmentCount() { return m_attachmentCount; } protected: WebGLObject(WebGLRenderingContext*); + + // setObject should be only called once right after creating a WebGLObject. + void setObject(Platform3DObject); + + // deleteObjectImpl() may be called multiple times for the same object; + // isDeleted() needs to be tested in implementations when deciding whether + // to delete the OpenGL resource. virtual void deleteObjectImpl(Platform3DObject) = 0; + bool isDeleted() { return m_deleted; } + void setDeteled() { m_deleted = true; } private: Platform3DObject m_object; diff --git a/WebCore/html/canvas/WebGLProgram.cpp b/WebCore/html/canvas/WebGLProgram.cpp index 8cf3c42..0853b67 100644 --- a/WebCore/html/canvas/WebGLProgram.cpp +++ b/WebCore/html/canvas/WebGLProgram.cpp @@ -47,12 +47,17 @@ WebGLProgram::WebGLProgram(WebGLRenderingContext* ctx) void WebGLProgram::deleteObjectImpl(Platform3DObject obj) { - context()->graphicsContext3D()->deleteProgram(obj); - if (!object()) { - if (m_vertexShader) + if (!isDeleted()) + context()->graphicsContext3D()->deleteProgram(obj); + if (!getAttachmentCount()) { + if (m_vertexShader) { m_vertexShader->onDetached(); - if (m_fragmentShader) + m_vertexShader = 0; + } + if (m_fragmentShader) { m_fragmentShader->onDetached(); + m_fragmentShader = 0; + } } } diff --git a/WebCore/html/canvas/WebGLRenderbuffer.cpp b/WebCore/html/canvas/WebGLRenderbuffer.cpp index 7bc2eec..4772873 100644 --- a/WebCore/html/canvas/WebGLRenderbuffer.cpp +++ b/WebCore/html/canvas/WebGLRenderbuffer.cpp @@ -48,7 +48,8 @@ WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx) void WebGLRenderbuffer::deleteObjectImpl(Platform3DObject object) { - context()->graphicsContext3D()->deleteRenderbuffer(object); + if (!isDeleted()) + context()->graphicsContext3D()->deleteRenderbuffer(object); } } diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp index 68a6954..d1bb0cd 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -635,7 +635,11 @@ void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer) { if (!framebuffer) return; - + if (framebuffer == m_framebufferBinding) { + m_framebufferBinding = 0; + // Have to call bindFramebuffer here to bind back to internal fbo. + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0); + } framebuffer->deleteObject(); } @@ -656,10 +660,11 @@ void WebGLRenderingContext::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer) { if (!renderbuffer) return; - + if (renderbuffer == m_renderbufferBinding) + m_renderbufferBinding = 0; renderbuffer->deleteObject(); if (m_framebufferBinding) - m_framebufferBinding->onAttachedObjectChange(renderbuffer); + m_framebufferBinding->removeAttachment(renderbuffer); } void WebGLRenderingContext::deleteShader(WebGLShader* shader) @@ -677,7 +682,7 @@ void WebGLRenderingContext::deleteTexture(WebGLTexture* texture) texture->deleteObject(); if (m_framebufferBinding) - m_framebufferBinding->onAttachedObjectChange(texture); + m_framebufferBinding->removeAttachment(texture); } void WebGLRenderingContext::depthFunc(unsigned long func) @@ -775,30 +780,31 @@ bool WebGLRenderingContext::validateIndexArrayConservative(unsigned long type, l // index, skips the expensive per-draw-call iteration in // validateIndexArrayPrecise. + if (!m_boundElementArrayBuffer) + return false; + + unsigned numElements = m_boundElementArrayBuffer->byteLength(); + // The case count==0 is already dealt with in drawElements before validateIndexArrayConservative. + if (!numElements) + return false; + const ArrayBuffer* buffer = m_boundElementArrayBuffer->elementArrayBuffer(); + ASSERT(buffer); + long maxIndex = m_boundElementArrayBuffer->getCachedMaxIndex(type); if (maxIndex < 0) { // Compute the maximum index in the entire buffer for the given type of index. switch (type) { case GraphicsContext3D::UNSIGNED_BYTE: { - unsigned numElements = m_boundElementArrayBuffer->byteLength(); - if (!numElements) - maxIndex = 0; - else { - const unsigned char* p = static_cast<const unsigned char*>(m_boundElementArrayBuffer->elementArrayBuffer()->data()); - for (unsigned i = 0; i < numElements; i++) - maxIndex = max(maxIndex, static_cast<long>(p[i])); - } + const unsigned char* p = static_cast<const unsigned char*>(buffer->data()); + for (unsigned i = 0; i < numElements; i++) + maxIndex = max(maxIndex, static_cast<long>(p[i])); break; } case GraphicsContext3D::UNSIGNED_SHORT: { - unsigned numElements = m_boundElementArrayBuffer->byteLength() / sizeof(unsigned short); - if (!numElements) - maxIndex = 0; - else { - const unsigned short* p = static_cast<const unsigned short*>(m_boundElementArrayBuffer->elementArrayBuffer()->data()); - for (unsigned i = 0; i < numElements; i++) - maxIndex = max(maxIndex, static_cast<long>(p[i])); - } + numElements /= sizeof(unsigned short); + const unsigned short* p = static_cast<const unsigned short*>(buffer->data()); + for (unsigned i = 0; i < numElements; i++) + maxIndex = max(maxIndex, static_cast<long>(p[i])); break; } default: @@ -824,6 +830,14 @@ bool WebGLRenderingContext::validateIndexArrayPrecise(unsigned long count, unsig if (!m_boundElementArrayBuffer) return false; + if (!count) { + numElementsRequired = 0; + return true; + } + + if (!m_boundElementArrayBuffer->elementArrayBuffer()) + return false; + unsigned long uoffset = static_cast<unsigned long>(offset); unsigned long n = count; @@ -968,6 +982,8 @@ void WebGLRenderingContext::drawElements(unsigned long mode, long count, unsigne m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } + if (!count) + return; if (!validateIndexArrayConservative(type, numElements) || !validateRenderingState(numElements)) { if (!validateIndexArrayPrecise(count, type, offset, numElements) || !validateRenderingState(numElements)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -1379,6 +1395,8 @@ WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionC return getLongParameter(pname); case GraphicsContext3D::RENDERBUFFER_BINDING: return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding)); + case GraphicsContext3D::RENDERER: + return WebGLGetInfo(m_context->getString(GraphicsContext3D::RENDERER)); case GraphicsContext3D::SAMPLE_BUFFERS: return getLongParameter(pname); case GraphicsContext3D::SAMPLE_COVERAGE_INVERT: @@ -1391,6 +1409,8 @@ WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionC return getWebGLIntArrayParameter(pname); case GraphicsContext3D::SCISSOR_TEST: return getBooleanParameter(pname); + case GraphicsContext3D::SHADING_LANGUAGE_VERSION: + return WebGLGetInfo("WebGL GLSL ES 1.0 (" + m_context->getString(GraphicsContext3D::SHADING_LANGUAGE_VERSION) + ")"); case GraphicsContext3D::STENCIL_BACK_FAIL: return getUnsignedLongParameter(pname); case GraphicsContext3D::STENCIL_BACK_FUNC: @@ -1438,6 +1458,10 @@ WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionC return WebGLGetInfo(m_unpackFlipY); case GraphicsContext3D::UNPACK_PREMULTIPLY_ALPHA_WEBGL: return WebGLGetInfo(m_unpackPremultiplyAlpha); + case GraphicsContext3D::VENDOR: + return WebGLGetInfo("Webkit (" + m_context->getString(GraphicsContext3D::VENDOR) + ")"); + case GraphicsContext3D::VERSION: + return WebGLGetInfo("WebGL 1.0 (" + m_context->getString(GraphicsContext3D::VERSION) + ")"); case GraphicsContext3D::VIEWPORT: return getWebGLIntArrayParameter(pname); default: @@ -1563,12 +1587,6 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode return m_context->getShaderSource(objectOrZero(shader)); } -String WebGLRenderingContext::getString(unsigned long name) -{ - WebGLStateRestorer(this, false); - return m_context->getString(name); -} - WebGLGetInfo WebGLRenderingContext::getTexParameter(unsigned long target, unsigned long pname, ExceptionCode& ec) { UNUSED_PARAM(ec); @@ -1922,8 +1940,12 @@ void WebGLRenderingContext::polygonOffset(double factor, double units) cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels) +void WebGLRenderingContext::readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels, ExceptionCode& ec) { + if (!canvas()->originClean()) { + ec = SECURITY_ERR; + return; + } // Validate input parameters. unsigned long componentsPerPixel, bytesPerComponent; if (!m_context->computeFormatAndTypeParameters(format, type, &componentsPerPixel, &bytesPerComponent)) { @@ -2165,6 +2187,7 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + checkOrigin(image); texImage2DImpl(target, level, internalformat, format, type, image->cachedImage()->image(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec); } @@ -2177,7 +2200,7 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - + checkOrigin(canvas); texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec); } @@ -2194,6 +2217,7 @@ PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* vid m_context->synthesizeGLError(GraphicsContext3D::OUT_OF_MEMORY); return 0; } + checkOrigin(video); IntRect destRect(0, 0, size.width(), size.height()); // FIXME: Turn this into a GPU-GPU texture copy instead of CPU readback. video->paintCurrentFrameInContext(buf->context(), destRect); @@ -2326,6 +2350,7 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + checkOrigin(image); texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image->cachedImage()->image(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec); } @@ -2338,7 +2363,7 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - + checkOrigin(canvas); texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec); } @@ -2703,7 +2728,7 @@ void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec) m_currentProgram->onDetached(); m_currentProgram = program; m_context->useProgram(objectOrZero(program)); - if (program) + if (program && program->object()) program->onAttached(); } cleanupAfterGraphicsCall(false); diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index d812c69..f507054 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -163,7 +163,6 @@ public: // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); String getShaderSource(WebGLShader*, ExceptionCode&); - String getString(unsigned long name); WebGLGetInfo getTexParameter(unsigned long target, unsigned long pname, ExceptionCode&); @@ -187,7 +186,7 @@ public: void linkProgram(WebGLProgram*, ExceptionCode&); void pixelStorei(unsigned long pname, long param); void polygonOffset(double factor, double units); - void readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels); + void readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels, ExceptionCode&); void releaseShaderCompiler(); void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); void sampleCoverage(double value, bool invert); diff --git a/WebCore/html/canvas/WebGLRenderingContext.idl b/WebCore/html/canvas/WebGLRenderingContext.idl index 7a63752..f76646d 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/WebCore/html/canvas/WebGLRenderingContext.idl @@ -563,7 +563,6 @@ module html { // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); [StrictTypeChecking] DOMString getShaderSource(in WebGLShader shader) raises(DOMException); - [StrictTypeChecking] DOMString getString(in unsigned long name); // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException); [StrictTypeChecking, Custom] void getTexParameter(); @@ -591,7 +590,7 @@ module html { [StrictTypeChecking] void pixelStorei(in unsigned long pname, in long param); [StrictTypeChecking] void polygonOffset(in double factor, in double units); - [StrictTypeChecking] void readPixels(in long x, in long y, in long width, in long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels); + [StrictTypeChecking] void readPixels(in long x, in long y, in long width, in long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises(DOMException); [StrictTypeChecking] void releaseShaderCompiler(); [StrictTypeChecking] void renderbufferStorage(in unsigned long target, in unsigned long internalformat, in unsigned long width, in unsigned long height); diff --git a/WebCore/html/canvas/WebGLShader.cpp b/WebCore/html/canvas/WebGLShader.cpp index 4f8bf68..1ccaad8 100644 --- a/WebCore/html/canvas/WebGLShader.cpp +++ b/WebCore/html/canvas/WebGLShader.cpp @@ -47,7 +47,8 @@ WebGLShader::WebGLShader(WebGLRenderingContext* ctx, GraphicsContext3D::WebGLEnu void WebGLShader::deleteObjectImpl(Platform3DObject object) { - context()->graphicsContext3D()->deleteShader(object); + if (!isDeleted()) + context()->graphicsContext3D()->deleteShader(object); } } diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp index 7fc84ad..c2b1c10 100644 --- a/WebCore/html/canvas/WebGLTexture.cpp +++ b/WebCore/html/canvas/WebGLTexture.cpp @@ -29,6 +29,7 @@ #include "WebGLTexture.h" +#include "WebGLFramebuffer.h" #include "WebGLRenderingContext.h" namespace WebCore { @@ -201,7 +202,8 @@ bool WebGLTexture::needToUseBlackTexture() const void WebGLTexture::deleteObjectImpl(Platform3DObject object) { - context()->graphicsContext3D()->deleteTexture(object); + if (!isDeleted()) + context()->graphicsContext3D()->deleteTexture(object); } int WebGLTexture::mapTargetToIndex(unsigned long target) diff --git a/WebCore/html/parser/HTMLDocumentParser.cpp b/WebCore/html/parser/HTMLDocumentParser.cpp index 2da403f..dc19c96 100644 --- a/WebCore/html/parser/HTMLDocumentParser.cpp +++ b/WebCore/html/parser/HTMLDocumentParser.cpp @@ -86,7 +86,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors : ScriptableDocumentParser(document) , m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(document))) , m_scriptRunner(HTMLScriptRunner::create(document, this)) - , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), document, reportErrors)) + , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), document, reportErrors, usePreHTML5ParserQuirks(document))) , m_parserScheduler(HTMLParserScheduler::create(this)) , m_endWasDelayed(false) , m_writeNestingLevel(0) @@ -98,7 +98,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission) : ScriptableDocumentParser(fragment->document()) , m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(fragment->document()))) - , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), fragment, contextElement, scriptingPermission)) + , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), fragment, contextElement, scriptingPermission, usePreHTML5ParserQuirks(fragment->document()))) , m_endWasDelayed(false) , m_writeNestingLevel(0) { diff --git a/WebCore/html/parser/HTMLTreeBuilder.cpp b/WebCore/html/parser/HTMLTreeBuilder.cpp index afac2a0..355dc8d 100644 --- a/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -323,7 +323,7 @@ private: }; -HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors) +HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks) : m_framesetOk(true) , m_document(document) , m_tree(document, FragmentScriptingAllowed, false) @@ -335,12 +335,13 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* documen , m_tokenizer(tokenizer) , m_scriptToProcessStartLine(uninitializedLineNumberValue) , m_lastScriptElementStartLine(uninitializedLineNumberValue) + , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks) { } // FIXME: Member variables should be grouped into self-initializing structs to // minimize code duplication between these constructors. -HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission) +HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission, bool usePreHTML5ParserQuirks) : m_framesetOk(true) , m_fragmentContext(fragment, contextElement, scriptingPermission) , m_document(m_fragmentContext.document()) @@ -353,6 +354,7 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fra , m_tokenizer(tokenizer) , m_scriptToProcessStartLine(uninitializedLineNumberValue) , m_lastScriptElementStartLine(uninitializedLineNumberValue) + , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks) { if (contextElement) { // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: @@ -2204,6 +2206,13 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token) if (isParsingFragment() && m_fragmentContext.scriptingPermission() == FragmentScriptingNotAllowed) m_scriptToProcess->removeAllChildren(); setInsertionMode(m_originalInsertionMode); + + // This token will not have been created by the tokenizer if a + // self-closing script tag was encountered and pre-HTML5 parser + // quirks are enabled. We must set the tokenizer's state to + // DataState explicitly if the tokenizer didn't have a chance to. + ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState || m_usePreHTML5ParserQuirks); + m_tokenizer->setState(HTMLTokenizer::DataState); return; } m_tree.openElements()->pop(); @@ -2706,6 +2715,8 @@ bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken& token) } if (token.name() == scriptTag) { processScriptStartTag(token); + if (m_usePreHTML5ParserQuirks && token.selfClosing()) + processFakeEndTag(scriptTag); return true; } if (token.name() == headTag) { diff --git a/WebCore/html/parser/HTMLTreeBuilder.h b/WebCore/html/parser/HTMLTreeBuilder.h index d522ea8..e61fe73 100644 --- a/WebCore/html/parser/HTMLTreeBuilder.h +++ b/WebCore/html/parser/HTMLTreeBuilder.h @@ -51,13 +51,13 @@ class Node; class HTMLTreeBuilder : public Noncopyable { public: - static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors) + static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks) { - return adoptPtr(new HTMLTreeBuilder(tokenizer, document, reportErrors)); + return adoptPtr(new HTMLTreeBuilder(tokenizer, document, reportErrors, usePreHTML5ParserQuirks)); } - static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission) + static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission, bool usePreHTML5ParserQuirks) { - return adoptPtr(new HTMLTreeBuilder(tokenizer, fragment, contextElement, scriptingPermission)); + return adoptPtr(new HTMLTreeBuilder(tokenizer, fragment, contextElement, scriptingPermission, usePreHTML5ParserQuirks)); } ~HTMLTreeBuilder(); @@ -110,8 +110,8 @@ private: AfterAfterFramesetMode, }; - HTMLTreeBuilder(HTMLTokenizer*, HTMLDocument*, bool reportErrors); - HTMLTreeBuilder(HTMLTokenizer*, DocumentFragment*, Element* contextElement, FragmentScriptingPermission); + HTMLTreeBuilder(HTMLTokenizer*, HTMLDocument*, bool reportErrors, bool usePreHTML5ParserQuirks); + HTMLTreeBuilder(HTMLTokenizer*, DocumentFragment*, Element* contextElement, FragmentScriptingPermission, bool usePreHTML5ParserQuirks); bool isParsingFragment() const { return !!m_fragmentContext.fragment(); } @@ -252,6 +252,8 @@ private: // created to service the legacy tree builder, but it seems to be used for // some other things now. int m_lastScriptElementStartLine; + + bool m_usePreHTML5ParserQuirks; }; } diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl index ae136b2..a08a622 100644 --- a/WebCore/inspector/Inspector.idl +++ b/WebCore/inspector/Inspector.idl @@ -37,9 +37,11 @@ module core { [notify] void addNodesToSearchResult(out Array nodeIds); [notify] void attributesUpdated(out long id, out Array attributes); [notify] void bringToFront(); + [notify] void characterDataModified(out long id, out String newValue); [notify] void childNodeCountUpdated(out long id, out int newValue); [notify] void childNodeInserted(out long parentId, out long prevId, out Object node); [notify] void childNodeRemoved(out long parentId, out long id); + [notify] void consoleMessagesCleared(); [notify] void didCommitLoad(); [notify] void evaluateForTestInFrontend(out long testCallId, out String script); [notify] void disconnectFromBackend(); @@ -47,8 +49,6 @@ module core { [notify] void removeResource(out unsigned long identifier); [notify] void reset(); [notify] void resetProfilesPanel(); - [notify] void searchingForNodeWasEnabled(); - [notify] void searchingForNodeWasDisabled(); [notify] void setChildNodes(out long parentId, out Array nodes); [notify] void setDetachedRoot(out Object root); [notify] void setDocument(out Value root); @@ -59,7 +59,6 @@ module core { [notify] void updateConsoleMessageRepeatCount(out unsigned long count); [notify] void updateFocusedNode(out long nodeId); [notify] void updateResource(out Value resource); - [notify] void consoleMessagesCleared(); #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER [notify] void addProfileHeader(out Object header); @@ -104,8 +103,7 @@ module core { [handler=Controller] void saveApplicationSettings(in String settings); [handler=Controller] void saveSessionSettings(in String settings); - [handler=Controller] void enableSearchingForNode(); - [handler=Controller] void disableSearchingForNode(); + [handler=Controller] void setSearchingForNode(in boolean enabled, out boolean newState); [handler=Controller] void setMonitoringXHREnabled(in boolean enable, out boolean newState); @@ -132,11 +130,14 @@ module core { [handler=Debug] void stepIntoStatement(); [handler=Debug] void stepOutOfFunction(); - [handler=Debug] void setPauseOnExceptionsState(in long pauseOnExceptionsState); + [handler=Debug] void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState); [handler=Debug] void editScriptSource(in String sourceID, in String newContent, out boolean success, out String result, out Value newCallFrames); [handler=Debug] void getScriptSource(in String sourceID, out String scriptSource); + [handler=Controller] void setNativeBreakpoint(in Object breakpoint, out unsigned int breakpointId); + [handler=Controller] void removeNativeBreakpoint(in unsigned int breakpointId); + [handler=Controller] void enableProfiler(in boolean always); [handler=Controller] void disableProfiler(in boolean always); diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index 5f8f190..f2ee2c1 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -111,10 +111,6 @@ #include "StorageArea.h" #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) -#include "ScriptDebugServer.h" -#endif - using namespace std; namespace WebCore { @@ -127,9 +123,11 @@ static const char* const monitoringXHRSettingName = "xhrMonitor"; static const char* const resourceTrackingAlwaysEnabledSettingName = "resourceTrackingEnabled"; static const char* const profilerAlwaysEnabledSettingName = "profilerEnabled"; -static const char* const timelineProfilerEnabledStateName = "timelineProfilerEnabled"; -static const char* const resourceTrackingEnabledStateName = "resourceTrackingEnabled"; static const char* const monitoringXHRStateName = "monitoringXHREnabled"; +static const char* const resourceTrackingEnabledStateName = "resourceTrackingEnabled"; +static const char* const searchingForNodeEnabledStateName = "searchingForNodeEnabled"; +static const char* const timelineProfilerEnabledStateName = "timelineProfilerEnabled"; +static const char* const pauseOnExceptionsStateStateName = "pauseOnExceptionsState"; static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight"; @@ -153,7 +151,7 @@ static const float maximumAttachedHeightRatio = 0.75f; static const unsigned maximumConsoleMessages = 1000; static const unsigned expireConsoleMessagesStep = 100; -static unsigned s_inspectorControllerCount; +unsigned InspectorController::s_inspectorControllerCount = 0; InspectorController::InspectorController(Page* page, InspectorClient* client) : m_inspectedPage(page) @@ -174,6 +172,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_injectedScriptHost(InjectedScriptHost::create(this)) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_attachDebuggerWhenShown(false) + , m_lastBreakpointId(0) , m_profilerAgent(InspectorProfilerAgent::create(this)) #endif { @@ -256,6 +255,10 @@ void InspectorController::getInspectorState(RefPtr<InspectorObject>* state) { (*state)->setBoolean(monitoringXHRStateName, m_monitoringXHR); (*state)->setBoolean(resourceTrackingEnabledStateName, m_resourceTrackingEnabled); +#if ENABLE(JAVASCRIPT_DEBUGGER) + if (m_debuggerAgent) + (*state)->setNumber(pauseOnExceptionsStateStateName, m_debuggerAgent->pauseOnExceptionsState()); +#endif } void InspectorController::updateInspectorStateCookie() @@ -264,6 +267,7 @@ void InspectorController::updateInspectorStateCookie() state->setBoolean(monitoringXHRStateName, m_monitoringXHR); state->setBoolean(resourceTrackingEnabledStateName, m_resourceTrackingEnabled); state->setBoolean(timelineProfilerEnabledStateName, m_timelineAgent); + state->setBoolean(searchingForNodeEnabledStateName, m_searchingForNode); m_client->updateInspectorStateCookie(state->toJSONString()); } @@ -279,6 +283,7 @@ void InspectorController::restoreInspectorStateFromCookie(const String& inspecto inspectorState->getBoolean(monitoringXHRStateName, &m_monitoringXHR); inspectorState->getBoolean(resourceTrackingEnabledStateName, &m_resourceTrackingEnabled); + inspectorState->getBoolean(searchingForNodeEnabledStateName, &m_searchingForNode); bool timelineProfilerEnabled = false; inspectorState->getBoolean(timelineProfilerEnabledStateName, &timelineProfilerEnabled); @@ -492,12 +497,13 @@ void InspectorController::setSearchingForNode(bool enabled) m_searchingForNode = enabled; if (!m_searchingForNode) hideHighlight(); - if (m_frontend) { - if (enabled) - m_frontend->searchingForNodeWasEnabled(); - else - m_frontend->searchingForNodeWasDisabled(); - } + updateInspectorStateCookie(); +} + +void InspectorController::setSearchingForNode(bool enabled, bool* newState) +{ + *newState = enabled; + setSearchingForNode(enabled); } void InspectorController::setMonitoringXHREnabled(bool enabled, bool* newState) @@ -650,10 +656,6 @@ void InspectorController::populateScriptObjects() showPanel(m_showAfterVisible); - if (m_searchingForNode) - m_frontend->searchingForNodeWasEnabled(); - - #if ENABLE(JAVASCRIPT_DEBUGGER) if (m_profilerAgent->enabled()) m_frontend->profilerWasEnabled(); @@ -674,10 +676,6 @@ void InspectorController::populateScriptObjects() for (unsigned i = 0; i < messageCount; ++i) m_consoleMessages[i]->addToFrontend(m_frontend.get(), m_injectedScriptHost.get()); -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (debuggerEnabled()) - m_frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState()); -#endif #if ENABLE(DATABASE) DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end(); for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it) @@ -790,6 +788,8 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) #if ENABLE(JAVASCRIPT_DEBUGGER) if (m_debuggerAgent) m_debuggerAgent->clearForPageNavigation(); + + m_XHRBreakpoints.clear(); #endif #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) m_profilerAgent->resetState(); @@ -1672,6 +1672,29 @@ void InspectorController::resume() m_debuggerAgent->resume(); } +void InspectorController::setNativeBreakpoint(PassRefPtr<InspectorObject> breakpoint, unsigned int* breakpointId) +{ + *breakpointId = 0; + String type; + if (!breakpoint->getString("type", &type)) + return; + if (type == "XHR") { + RefPtr<InspectorObject> condition = breakpoint->getObject("condition"); + if (!condition) + return; + String url; + if (!condition->getString("url", &url)) + return; + *breakpointId = ++m_lastBreakpointId; + m_XHRBreakpoints.set(*breakpointId, url); + } +} + +void InspectorController::removeNativeBreakpoint(unsigned int breakpointId) +{ + m_XHRBreakpoints.remove(breakpointId); +} + #endif void InspectorController::evaluateForTestInFrontend(long callId, const String& script) @@ -2085,9 +2108,9 @@ void InspectorController::willInsertDOMNodeImpl(Node* node, Node* parent) #if ENABLE(JAVASCRIPT_DEBUGGER) if (!m_debuggerAgent || !m_domAgent) return; - PassRefPtr<InspectorValue> details; - if (m_domAgent->shouldBreakOnNodeInsertion(node, parent, &details)) - m_debuggerAgent->breakProgram(details); + PassRefPtr<InspectorValue> eventData; + if (m_domAgent->shouldBreakOnNodeInsertion(node, parent, &eventData)) + m_debuggerAgent->breakProgram(DOMBreakpointDebuggerEventType, eventData); #endif } @@ -2102,9 +2125,9 @@ void InspectorController::willRemoveDOMNodeImpl(Node* node) #if ENABLE(JAVASCRIPT_DEBUGGER) if (!m_debuggerAgent || !m_domAgent) return; - PassRefPtr<InspectorValue> details; - if (m_domAgent->shouldBreakOnNodeRemoval(node, &details)) - m_debuggerAgent->breakProgram(details); + PassRefPtr<InspectorValue> eventData; + if (m_domAgent->shouldBreakOnNodeRemoval(node, &eventData)) + m_debuggerAgent->breakProgram(DOMBreakpointDebuggerEventType, eventData); #endif } @@ -2119,9 +2142,9 @@ void InspectorController::willModifyDOMAttrImpl(Element* element) #if ENABLE(JAVASCRIPT_DEBUGGER) if (!m_debuggerAgent || !m_domAgent) return; - PassRefPtr<InspectorValue> details; - if (m_domAgent->shouldBreakOnAttributeModification(element, &details)) - m_debuggerAgent->breakProgram(details); + PassRefPtr<InspectorValue> eventData; + if (m_domAgent->shouldBreakOnAttributeModification(element, &eventData)) + m_debuggerAgent->breakProgram(DOMBreakpointDebuggerEventType, eventData); #endif } @@ -2131,6 +2154,31 @@ void InspectorController::didModifyDOMAttrImpl(Element* element) m_domAgent->didModifyDOMAttr(element); } +void InspectorController::characterDataModifiedImpl(CharacterData* characterData) +{ + if (m_domAgent) + m_domAgent->characterDataModified(characterData); +} + +void InspectorController::instrumentWillSendXMLHttpRequestImpl(const KURL& url) +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + if (m_debuggerAgent) { + if (!m_XHRBreakpoints.size()) + return; + for (HashMap<unsigned int, String>::iterator it = m_XHRBreakpoints.begin(); it != m_XHRBreakpoints.end(); ++it) { + if (!url.string().contains(it->second)) + continue; + RefPtr<InspectorObject> eventData = InspectorObject::create(); + eventData->setString("type", "XHR"); + eventData->setString("url", url); + m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData); + break; + } + } +#endif +} + } // namespace WebCore diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 6752044..9e63f01 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -29,6 +29,7 @@ #ifndef InspectorController_h #define InspectorController_h +#include "CharacterData.h" #include "Console.h" #include "Cookie.h" #include "Element.h" @@ -45,6 +46,7 @@ namespace WebCore { class CachedResource; +class CharacterData; class ConsoleMessage; class Database; class Document; @@ -201,6 +203,9 @@ public: static void willRemoveDOMNode(Node*); static void willModifyDOMAttr(Element*); static void didModifyDOMAttr(Element*); + static void characterDataModified(CharacterData*); + + static void instrumentWillSendXMLHttpRequest(ScriptExecutionContext*, const KURL&); #if ENABLE(WORKERS) enum WorkerAction { WorkerCreated, WorkerDestroyed }; @@ -264,6 +269,10 @@ public: bool debuggerEnabled() const { return m_debuggerAgent; } InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); } void resume(); + + void setNativeBreakpoint(PassRefPtr<InspectorObject> breakpoint, unsigned int* breakpointId); + void removeNativeBreakpoint(unsigned int breakpointId); + #endif void evaluateForTestInFrontend(long testCallId, const String& script); @@ -288,11 +297,10 @@ private: void restoreDebugger(); void restoreProfiler(); void unbindAllResources(); + void setSearchingForNode(bool enabled); // Following are used from InspectorBackend and internally. - void setSearchingForNode(bool enabled); - void enableSearchingForNode() { setSearchingForNode(true); } - void disableSearchingForNode() { setSearchingForNode(false); } + void setSearchingForNode(bool enabled, bool* newState); void setMonitoringXHREnabled(bool enabled, bool* newState); void storeLastActivePanel(const String& panelName); @@ -331,13 +339,19 @@ private: void didEvaluateForTestInFrontend(long callId, const String& jsonResult); + static InspectorController* inspectorControllerForScriptExecutionContext(ScriptExecutionContext* context); static InspectorController* inspectorControllerForNode(Node*); + static InspectorController* inspectorControllerForDocument(Document* document); + void willInsertDOMNodeImpl(Node* node, Node* parent); void didInsertDOMNodeImpl(Node*); void willRemoveDOMNodeImpl(Node*); void didRemoveDOMNodeImpl(Node*); void willModifyDOMAttrImpl(Element*); void didModifyDOMAttrImpl(Element*); + void characterDataModifiedImpl(CharacterData*); + + void instrumentWillSendXMLHttpRequestImpl(const KURL&); #if ENABLE(JAVASCRIPT_DEBUGGER) friend class InspectorDebuggerAgent; @@ -346,6 +360,8 @@ private: void saveBreakpoints(PassRefPtr<InspectorObject> breakpoints); #endif + static unsigned s_inspectorControllerCount; + Page* m_inspectedPage; InspectorClient* m_client; OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient; @@ -400,6 +416,9 @@ private: bool m_attachDebuggerWhenShown; OwnPtr<InspectorDebuggerAgent> m_debuggerAgent; + HashMap<unsigned int, String> m_XHRBreakpoints; + unsigned int m_lastBreakpointId; + OwnPtr<InspectorProfilerAgent> m_profilerAgent; #endif #if ENABLE(WORKERS) @@ -451,18 +470,48 @@ inline void InspectorController::didModifyDOMAttr(Element* element) #endif } -inline InspectorController* InspectorController::inspectorControllerForNode(Node* node) +inline void InspectorController::characterDataModified(CharacterData* characterData) { #if ENABLE(INSPECTOR) - if (Page* page = node->document()->page()) { - if (InspectorController* inspectorController = page->inspectorController()) { - if (inspectorController->hasFrontend()) - return inspectorController; - } - } + if (InspectorController* inspectorController = inspectorControllerForNode(characterData)) + inspectorController->characterDataModifiedImpl(characterData); #endif +} - return 0; +inline void InspectorController::instrumentWillSendXMLHttpRequest(ScriptExecutionContext* context, const KURL& url) +{ +#if ENABLE(INSPECTOR) + if (InspectorController* inspectorController = inspectorControllerForScriptExecutionContext(context)) + inspectorController->instrumentWillSendXMLHttpRequestImpl(url); +#endif +} + +inline InspectorController* InspectorController::inspectorControllerForScriptExecutionContext(ScriptExecutionContext* context) +{ + if (!s_inspectorControllerCount || !context || !context->isDocument()) + return 0; + return inspectorControllerForDocument(static_cast<Document*>(context)); +} + +inline InspectorController* InspectorController::inspectorControllerForNode(Node* node) +{ + if (!s_inspectorControllerCount) + return 0; + return inspectorControllerForDocument(node->document()); +} + +inline InspectorController* InspectorController::inspectorControllerForDocument(Document* document) +{ + ASSERT(document); + Page* page = document->page(); + if (!page) + return 0; + InspectorController* inspectorController = page->inspectorController(); + if (!inspectorController) + return 0; + if (!inspectorController->hasFrontend()) + return 0; + return inspectorController; } } // namespace WebCore diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index f1df5b0..f51da73 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -43,6 +43,7 @@ #include "CSSStyleRule.h" #include "CSSStyleSelector.h" #include "CSSStyleSheet.h" +#include "CharacterData.h" #include "ContainerNode.h" #include "Cookie.h" #include "CookieJar.h" @@ -1120,6 +1121,14 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element) m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element)); } +void InspectorDOMAgent::characterDataModified(CharacterData* characterData) +{ + long id = m_documentNodeToIdMap.get(characterData); + if (!id) + return; + m_frontend->characterDataModified(id, characterData->data()); +} + bool InspectorDOMAgent::hasBreakpoint(Node* node, long type) { uint32_t rootBit = 1 << type; diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index 7d86997..89c6fd0 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -53,6 +53,7 @@ namespace WebCore { class CSSStyleDeclaration; class CSSStyleRule; class CSSStyleSheet; + class CharacterData; class Element; class Event; class InspectorDOMAgent; @@ -139,6 +140,7 @@ namespace WebCore { void didInsertDOMNode(Node*); void didRemoveDOMNode(Node*); void didModifyDOMAttr(Element*); + void characterDataModified(CharacterData*); Node* nodeForId(long nodeId); long pushNodePathToFrontend(Node* node); diff --git a/WebCore/inspector/InspectorDebuggerAgent.cpp b/WebCore/inspector/InspectorDebuggerAgent.cpp index 3875be0..4964c09 100644 --- a/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -64,7 +64,6 @@ InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorController* inspectorCon , m_frontend(frontend) , m_pausedScriptState(0) , m_breakpointsLoaded(false) - , m_breakProgramReason(InspectorValue::null()) { } @@ -173,10 +172,15 @@ void InspectorDebuggerAgent::stepOutOfFunction() ScriptDebugServer::shared().stepOutOfFunction(); } -void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState) +void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState, long* newState) { ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState)); - m_frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState()); + *newState = ScriptDebugServer::shared().pauseOnExceptionsState(); +} + +long InspectorDebuggerAgent::pauseOnExceptionsState() +{ + return ScriptDebugServer::shared().pauseOnExceptionsState(); } void InspectorDebuggerAgent::clearForPageNavigation() @@ -289,12 +293,13 @@ void InspectorDebuggerAgent::failedToParseSource(const String& url, const String void InspectorDebuggerAgent::didPause(ScriptState* scriptState) { ASSERT(scriptState && !m_pausedScriptState); - ASSERT(m_breakProgramReason); m_pausedScriptState = scriptState; - RefPtr<InspectorObject> details = InspectorObject::create(); - details->setValue("callFrames", currentCallFrames()); - details->setValue("status", m_breakProgramReason); - m_frontend->pausedScript(details); + + if (!m_breakProgramDetails) + m_breakProgramDetails = InspectorObject::create(); + m_breakProgramDetails->setValue("callFrames", currentCallFrames()); + + m_frontend->pausedScript(m_breakProgramDetails); } void InspectorDebuggerAgent::didContinue() @@ -303,17 +308,19 @@ void InspectorDebuggerAgent::didContinue() m_frontend->resumedScript(); } -void InspectorDebuggerAgent::breakProgram(PassRefPtr<InspectorValue> reason) +void InspectorDebuggerAgent::breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data) { + m_breakProgramDetails = InspectorObject::create(); + m_breakProgramDetails->setNumber("eventType", type); + m_breakProgramDetails->setValue("eventData", data); s_debuggerAgentOnBreakpoint = this; - m_breakProgramReason = reason; ScriptDebugServer::shared().breakProgram(); if (!s_debuggerAgentOnBreakpoint) return; s_debuggerAgentOnBreakpoint = 0; - m_breakProgramReason = InspectorValue::null(); + m_breakProgramDetails = 0; } } // namespace WebCore diff --git a/WebCore/inspector/InspectorDebuggerAgent.h b/WebCore/inspector/InspectorDebuggerAgent.h index 79b0a0e..8a5379d 100644 --- a/WebCore/inspector/InspectorDebuggerAgent.h +++ b/WebCore/inspector/InspectorDebuggerAgent.h @@ -43,8 +43,14 @@ namespace WebCore { class InjectedScriptHost; class InspectorController; class InspectorFrontend; +class InspectorObject; class InspectorValue; +enum DebuggerEventType { + DOMBreakpointDebuggerEventType, + NativeBreakpointDebuggerEventType +}; + class InspectorDebuggerAgent : public ScriptDebugListener, public Noncopyable { public: static PassOwnPtr<InspectorDebuggerAgent> create(InspectorController*, InspectorFrontend*); @@ -61,13 +67,14 @@ public: void getScriptSource(const String& sourceID, String* scriptSource); void pause(); - void breakProgram(PassRefPtr<InspectorValue> reason); + void breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data); void resume(); void stepOverStatement(); void stepIntoStatement(); void stepOutOfFunction(); - void setPauseOnExceptionsState(long pauseState); + void setPauseOnExceptionsState(long pauseState, long* newState); + long pauseOnExceptionsState(); void clearForPageNavigation(); @@ -95,7 +102,7 @@ private: HashMap<String, unsigned> m_breakpointsMapping; bool m_breakpointsLoaded; static InspectorDebuggerAgent* s_debuggerAgentOnBreakpoint; - RefPtr<InspectorValue> m_breakProgramReason; + RefPtr<InspectorObject> m_breakProgramDetails; }; } // namespace WebCore diff --git a/WebCore/inspector/front-end/AbstractTimelinePanel.js b/WebCore/inspector/front-end/AbstractTimelinePanel.js deleted file mode 100644 index 187ef86..0000000 --- a/WebCore/inspector/front-end/AbstractTimelinePanel.js +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.AbstractTimelinePanel = function(name) -{ - WebInspector.Panel.call(this, name); - this._items = []; - this._staleItems = []; -} - -WebInspector.AbstractTimelinePanel.prototype = { - get categories() - { - // Should be implemented by the concrete subclasses. - return {}; - }, - - populateSidebar: function() - { - // Should be implemented by the concrete subclasses. - }, - - createItemTreeElement: function(item) - { - // Should be implemented by the concrete subclasses. - }, - - createItemGraph: function(item) - { - // Should be implemented by the concrete subclasses. - }, - - get items() - { - return this._items; - }, - - createInterface: function() - { - this.containerElement = document.createElement("div"); - this.containerElement.id = "resources-container"; - this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false); - this.element.appendChild(this.containerElement); - - this.createSidebar(this.containerElement, this.element); - this.sidebarElement.id = "resources-sidebar"; - this.populateSidebar(); - - this._containerContentElement = document.createElement("div"); - this._containerContentElement.id = "resources-container-content"; - this.containerElement.appendChild(this._containerContentElement); - - this.summaryBar = new WebInspector.SummaryBar(this.categories); - this.summaryBar.element.id = "resources-summary"; - this._containerContentElement.appendChild(this.summaryBar.element); - - this._timelineGrid = new WebInspector.TimelineGrid(); - this._containerContentElement.appendChild(this._timelineGrid.element); - this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement; - }, - - createFilterPanel: function() - { - this.filterBarElement = document.createElement("div"); - this.filterBarElement.id = "resources-filter"; - this.filterBarElement.className = "scope-bar"; - this.element.appendChild(this.filterBarElement); - - function createFilterElement(category) - { - if (category === "all") - var label = WebInspector.UIString("All"); - else if (this.categories[category]) - var label = this.categories[category].title; - - var categoryElement = document.createElement("li"); - categoryElement.category = category; - categoryElement.addStyleClass(category); - categoryElement.appendChild(document.createTextNode(label)); - categoryElement.addEventListener("click", this._updateFilter.bind(this), false); - this.filterBarElement.appendChild(categoryElement); - - return categoryElement; - } - - this.filterAllElement = createFilterElement.call(this, "all"); - - // Add a divider - var dividerElement = document.createElement("div"); - dividerElement.addStyleClass("divider"); - this.filterBarElement.appendChild(dividerElement); - - for (var category in this.categories) - createFilterElement.call(this, category); - }, - - showCategory: function(category) - { - var filterClass = "filter-" + category.toLowerCase(); - this.itemsGraphsElement.addStyleClass(filterClass); - this.itemsTreeElement.childrenListElement.addStyleClass(filterClass); - }, - - hideCategory: function(category) - { - var filterClass = "filter-" + category.toLowerCase(); - this.itemsGraphsElement.removeStyleClass(filterClass); - this.itemsTreeElement.childrenListElement.removeStyleClass(filterClass); - }, - - filter: function(target, selectMultiple) - { - function unselectAll() - { - for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) { - var child = this.filterBarElement.childNodes[i]; - if (!child.category) - continue; - - child.removeStyleClass("selected"); - this.hideCategory(child.category); - } - } - - if (target === this.filterAllElement) { - if (target.hasStyleClass("selected")) { - // We can't unselect All, so we break early here - return; - } - - // If All wasn't selected, and now is, unselect everything else. - unselectAll.call(this); - } else { - // Something other than All is being selected, so we want to unselect All. - if (this.filterAllElement.hasStyleClass("selected")) { - this.filterAllElement.removeStyleClass("selected"); - this.hideCategory("all"); - } - } - - if (!selectMultiple) { - // If multiple selection is off, we want to unselect everything else - // and just select ourselves. - unselectAll.call(this); - - target.addStyleClass("selected"); - this.showCategory(target.category); - return; - } - - if (target.hasStyleClass("selected")) { - // If selectMultiple is turned on, and we were selected, we just - // want to unselect ourselves. - target.removeStyleClass("selected"); - this.hideCategory(target.category); - } else { - // If selectMultiple is turned on, and we weren't selected, we just - // want to select ourselves. - target.addStyleClass("selected"); - this.showCategory(target.category); - } - }, - - _updateFilter: function(e) - { - var isMac = WebInspector.isMac(); - var selectMultiple = false; - if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) - selectMultiple = true; - if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey) - selectMultiple = true; - - this.filter(e.target, selectMultiple); - - // When we are updating our filtering, scroll to the top so we don't end up - // in blank graph under all the resources. - this.containerElement.scrollTop = 0; - - var searchField = document.getElementById("search"); - WebInspector.doPerformSearch(searchField.value, WebInspector.shortSearchWasForcedByKeyEvent, false, true); - }, - - updateGraphDividersIfNeeded: function(force) - { - if (!this.visible) { - this.needsRefresh = true; - return false; - } - return this._timelineGrid.updateDividers(force, this.calculator); - }, - - _updateDividersLabelBarPosition: function() - { - const scrollTop = this.containerElement.scrollTop; - const offsetHeight = this.summaryBar.element.offsetHeight; - const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop); - this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop); - }, - - get needsRefresh() - { - return this._needsRefresh; - }, - - set needsRefresh(x) - { - if (this._needsRefresh === x) - return; - - this._needsRefresh = x; - - if (x) { - if (this.visible && !("_refreshTimeout" in this)) - this._refreshTimeout = setTimeout(this.refresh.bind(this), 500); - } else { - if ("_refreshTimeout" in this) { - clearTimeout(this._refreshTimeout); - delete this._refreshTimeout; - } - } - }, - - refreshIfNeeded: function() - { - if (this.needsRefresh) - this.refresh(); - }, - - show: function() - { - WebInspector.Panel.prototype.show.call(this); - - this._updateDividersLabelBarPosition(); - this.refreshIfNeeded(); - }, - - resize: function() - { - WebInspector.Panel.prototype.resize.call(this); - - this.updateGraphDividersIfNeeded(); - }, - - updateMainViewWidth: function(width) - { - this._containerContentElement.style.left = width + "px"; - this.resize(); - }, - - invalidateAllItems: function() - { - this._staleItems = this._items.slice(); - }, - - refresh: function() - { - this.needsRefresh = false; - - var staleItemsLength = this._staleItems.length; - - var boundariesChanged = false; - - for (var i = 0; i < staleItemsLength; ++i) { - var item = this._staleItems[i]; - if (!item._itemsTreeElement) { - // Create the timeline tree element and graph. - item._itemsTreeElement = this.createItemTreeElement(item); - item._itemsTreeElement._itemGraph = this.createItemGraph(item); - - this.itemsTreeElement.appendChild(item._itemsTreeElement); - this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement); - } - - if (item._itemsTreeElement.refresh) - item._itemsTreeElement.refresh(); - - if (this.calculator.updateBoundaries(item)) - boundariesChanged = true; - } - - if (boundariesChanged) { - // The boundaries changed, so all item graphs are stale. - this._staleItems = this._items.slice(); - staleItemsLength = this._staleItems.length; - } - - - const isBarOpaqueAtLeft = this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.isBarOpaqueAtLeft; - for (var i = 0; i < staleItemsLength; ++i) - this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator, isBarOpaqueAtLeft); - - this._staleItems = []; - - this.updateGraphDividersIfNeeded(); - }, - - reset: function() - { - this.containerElement.scrollTop = 0; - - if (this._calculator) - this._calculator.reset(); - - if (this._items) { - var itemsLength = this._items.length; - for (var i = 0; i < itemsLength; ++i) { - var item = this._items[i]; - delete item._itemsTreeElement; - } - } - - this._items = []; - this._staleItems = []; - - this.itemsTreeElement.removeChildren(); - this.itemsGraphsElement.removeChildren(); - - this.updateGraphDividersIfNeeded(true); - }, - - get calculator() - { - return this._calculator; - }, - - set calculator(x) - { - if (!x || this._calculator === x) - return; - - this._calculator = x; - this._calculator.reset(); - - this._staleItems = this._items.slice(); - this.refresh(); - }, - - addItem: function(item) - { - this._items.push(item); - this.refreshItem(item); - }, - - removeItem: function(item) - { - this._items.remove(item, true); - - if (item._itemsTreeElement) { - this.itemsTreeElement.removeChild(item._itemsTreeElement); - this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement); - } - - delete item._itemsTreeElement; - this.adjustScrollPosition(); - }, - - refreshItem: function(item) - { - this._staleItems.push(item); - this.needsRefresh = true; - }, - - revealAndSelectItem: function(item) - { - if (item._itemsTreeElement) { - item._itemsTreeElement.reveal(); - item._itemsTreeElement.select(true); - } - }, - - sortItems: function(sortingFunction) - { - var sortedElements = [].concat(this.itemsTreeElement.children); - sortedElements.sort(sortingFunction); - - var sortedElementsLength = sortedElements.length; - for (var i = 0; i < sortedElementsLength; ++i) { - var treeElement = sortedElements[i]; - if (treeElement === this.itemsTreeElement.children[i]) - continue; - - var wasSelected = treeElement.selected; - this.itemsTreeElement.removeChild(treeElement); - this.itemsTreeElement.insertChild(treeElement, i); - if (wasSelected) - treeElement.select(true); - - var graphElement = treeElement._itemGraph.graphElement; - this.itemsGraphsElement.insertBefore(graphElement, this.itemsGraphsElement.children[i]); - } - }, - - adjustScrollPosition: function() - { - // Prevent the container from being scrolled off the end. - if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight) - this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight); - }, - - addEventDivider: function(divider) - { - this._timelineGrid.addEventDivider(divider); - }, - - hideEventDividers: function() - { - this._timelineGrid.hideEventDividers(); - }, - - showEventDividers: function() - { - this._timelineGrid.showEventDividers(); - } -} - -WebInspector.AbstractTimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype; - -WebInspector.AbstractTimelineCalculator = function() -{ -} - -WebInspector.AbstractTimelineCalculator.prototype = { - computeSummaryValues: function(items) - { - var total = 0; - var categoryValues = {}; - - var itemsLength = items.length; - for (var i = 0; i < itemsLength; ++i) { - var item = items[i]; - var value = this._value(item); - if (typeof value === "undefined") - continue; - if (!(item.category.name in categoryValues)) - categoryValues[item.category.name] = 0; - categoryValues[item.category.name] += value; - total += value; - } - - return {categoryValues: categoryValues, total: total}; - }, - - computeBarGraphPercentages: function(item) - { - return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100}; - }, - - computeBarGraphLabels: function(item) - { - const label = this.formatValue(this._value(item)); - return {left: label, right: label, tooltip: label}; - }, - - get boundarySpan() - { - return this.maximumBoundary - this.minimumBoundary; - }, - - updateBoundaries: function(item) - { - this.minimumBoundary = 0; - - var value = this._value(item); - if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { - this.maximumBoundary = value; - return true; - } - return false; - }, - - reset: function() - { - delete this.minimumBoundary; - delete this.maximumBoundary; - }, - - _value: function(item) - { - return 0; - }, - - formatValue: function(value) - { - return value.toString(); - } -} - -WebInspector.AbstractTimelineCategory = function(name, title, color) -{ - this.name = name; - this.title = title; - this.color = color; -} - -WebInspector.AbstractTimelineCategory.prototype = { - toString: function() - { - return this.title; - } -} diff --git a/WebCore/inspector/front-end/AuditLauncherView.js b/WebCore/inspector/front-end/AuditLauncherView.js index 18daee6..a922715 100644 --- a/WebCore/inspector/front-end/AuditLauncherView.js +++ b/WebCore/inspector/front-end/AuditLauncherView.js @@ -190,7 +190,8 @@ WebInspector.AuditLauncherView.prototype = { var element = document.createElement("input"); element.type = "checkbox"; - element.addEventListener("click", this._boundCategoryClickListener, false); + if (id !== "") + element.addEventListener("click", this._boundCategoryClickListener, false); labelElement.appendChild(element); labelElement.appendChild(document.createTextNode(title)); diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js index 8518618..ec4e7cf 100644 --- a/WebCore/inspector/front-end/BreakpointManager.js +++ b/WebCore/inspector/front-end/BreakpointManager.js @@ -27,6 +27,7 @@ WebInspector.BreakpointManager = function() { this._breakpoints = {}; + this._xhrBreakpoints = {}; } WebInspector.BreakpointManager.prototype = { @@ -124,6 +125,22 @@ WebInspector.BreakpointManager.prototype = { } } InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition, didSetBreakpoint.bind(this)); + }, + + createXHRBreakpoint: function(url) + { + if (url in this._xhrBreakpoints) + return; + this._xhrBreakpoints[url] = true; + + var breakpoint = new WebInspector.XHRBreakpoint(url); + breakpoint.addEventListener("removed", this._xhrBreakpointRemoved.bind(this)); + this.dispatchEventToListeners("xhr-breakpoint-added", breakpoint); + }, + + _xhrBreakpointRemoved: function(event) + { + delete this._xhrBreakpoints[event.target.url]; } } @@ -189,6 +206,15 @@ WebInspector.Breakpoint.prototype = { this.dispatchEventToListeners("condition-changed"); }, + compareTo: function(other) + { + if (this.url != other.url) + return this.url < other.url ? -1 : 1; + if (this.line != other.line) + return this.line < other.line ? -1 : 1; + return 0; + }, + remove: function() { InspectorBackend.removeBreakpoint(this.sourceID, this.line); @@ -199,3 +225,83 @@ WebInspector.Breakpoint.prototype = { } WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype; + +WebInspector.XHRBreakpoint = function(url) +{ + this._url = url; + this._locked = false; + this.enabled = true; +} + +WebInspector.XHRBreakpoint.prototype = { + get enabled() + { + return "_id" in this; + }, + + set enabled(enabled) + { + if (this._locked) + return; + if (this.enabled === enabled) + return; + if (enabled) + this._setOnBackend(); + else + this._removeFromBackend(); + }, + + get url() + { + return this._url; + }, + + formatLabel: function() + { + var label = ""; + if (!this.url.length) + label = WebInspector.UIString("Any XHR"); + else + label = WebInspector.UIString("URL contains \"%s\"", this.url); + return label; + }, + + compareTo: function(other) + { + if (this.url != other.url) + return this.url < other.url ? -1 : 1; + return 0; + }, + + remove: function() + { + if (this._locked) + return; + if (this.enabled) + this._removeFromBackend(); + this.dispatchEventToListeners("removed"); + }, + + _setOnBackend: function() + { + this._locked = true; + var data = { type: "XHR", condition: { url: this.url } }; + InspectorBackend.setNativeBreakpoint(data, didSet.bind(this)); + + function didSet(breakpointId) + { + this._locked = false; + this._id = breakpointId; + this.dispatchEventToListeners("enable-changed"); + } + }, + + _removeFromBackend: function() + { + InspectorBackend.removeNativeBreakpoint(this._id); + delete this._id; + this.dispatchEventToListeners("enable-changed"); + } +} + +WebInspector.XHRBreakpoint.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/WebCore/inspector/front-end/BreakpointsSidebarPane.js index 9688f3e..16ab041 100644 --- a/WebCore/inspector/front-end/BreakpointsSidebarPane.js +++ b/WebCore/inspector/front-end/BreakpointsSidebarPane.js @@ -92,6 +92,42 @@ WebInspector.BreakpointsSidebarPane.prototype = { WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; +WebInspector.XHRBreakpointsSidebarPane = function() +{ + WebInspector.BreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints")); + + var addButton = document.createElement("button"); + addButton.className = "add"; + addButton.addEventListener("click", this._showEditBreakpointDialog.bind(this), false); + this.titleElement.appendChild(addButton); + + this.urlInputElement = document.createElement("span"); + this.urlInputElement.className = "breakpoint-condition editing"; +} + +WebInspector.XHRBreakpointsSidebarPane.prototype = { + _showEditBreakpointDialog: function(event) + { + event.stopPropagation(); + + if (this.urlInputElement.parentElement) + return; + + this.urlInputElement.textContent = ""; + this.bodyElement.insertBefore(this.urlInputElement, this.bodyElement.firstChild); + WebInspector.startEditing(this.urlInputElement, this._hideEditBreakpointDialog.bind(this, false), this._hideEditBreakpointDialog.bind(this, true)); + }, + + _hideEditBreakpointDialog: function(discard) + { + if (!discard) + WebInspector.breakpointManager.createXHRBreakpoint(this.urlInputElement.textContent.toLowerCase()); + this.bodyElement.removeChild(this.urlInputElement); + } +} + +WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.BreakpointsSidebarPane.prototype; + WebInspector.BreakpointItem = function(breakpoint) { this._breakpoint = breakpoint; @@ -116,6 +152,11 @@ WebInspector.BreakpointItem.prototype = { return this._element; }, + compareTo: function(other) + { + return this._breakpoint.compareTo(other._breakpoint); + }, + remove: function() { this._breakpoint.remove(); @@ -125,7 +166,7 @@ WebInspector.BreakpointItem.prototype = { { this._breakpoint.enabled = !this._breakpoint.enabled; - // without this, we'd switch to the source of the clicked breakpoint + // Breakpoint element may have it's own click handler. event.stopPropagation(); }, @@ -133,6 +174,10 @@ WebInspector.BreakpointItem.prototype = { { var checkbox = this._element.firstChild; checkbox.checked = this._breakpoint.enabled; + }, + + _breakpointClicked: function(event) + { } } @@ -155,15 +200,6 @@ WebInspector.JSBreakpointItem = function(breakpoint) } WebInspector.JSBreakpointItem.prototype = { - compareTo: function(other) - { - if (this._breakpoint.url != other._breakpoint.url) - return this._breakpoint.url < other._breakpoint.url ? -1 : 1; - if (this._breakpoint.line != other._breakpoint.line) - return this._breakpoint.line < other._breakpoint.line ? -1 : 1; - return 0; - }, - _breakpointClicked: function() { WebInspector.panels.scripts.showSourceLine(this._breakpoint.url, this._breakpoint.line); @@ -191,13 +227,6 @@ WebInspector.DOMBreakpointItem = function(breakpoint) } WebInspector.DOMBreakpointItem.prototype = { - compareTo: function(other) - { - if (this._breakpoint.type != other._breakpoint.type) - return this._breakpoint.type < other._breakpoint.type ? -1 : 1; - return 0; - }, - _breakpointClicked: function() { WebInspector.updateFocusedNode(this._breakpoint.nodeId); @@ -205,3 +234,13 @@ WebInspector.DOMBreakpointItem.prototype = { } WebInspector.DOMBreakpointItem.prototype.__proto__ = WebInspector.BreakpointItem.prototype; + +WebInspector.XHRBreakpointItem = function(breakpoint) +{ + WebInspector.BreakpointItem.call(this, breakpoint); + + var label = document.createTextNode(this._breakpoint.formatLabel()); + this._element.appendChild(label); +} + +WebInspector.XHRBreakpointItem.prototype.__proto__ = WebInspector.BreakpointItem.prototype; diff --git a/WebCore/inspector/front-end/CallStackSidebarPane.js b/WebCore/inspector/front-end/CallStackSidebarPane.js index 91f35a6..6212ea1 100644 --- a/WebCore/inspector/front-end/CallStackSidebarPane.js +++ b/WebCore/inspector/front-end/CallStackSidebarPane.js @@ -28,6 +28,11 @@ WebInspector.CallStackSidebarPane = function() WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack")); } +WebInspector.CallStackSidebarPane.DebuggerEventType = { + DOMBreakpoint: 0, + NativeBreakpoint: 1 +}; + WebInspector.CallStackSidebarPane.prototype = { update: function(callFrames, sourceIDMap) { @@ -82,36 +87,41 @@ WebInspector.CallStackSidebarPane.prototype = { } }, - updateStatus: function(status) + updateStatus: function(eventType, eventData) { var statusElement = document.createElement("div"); - statusElement.className = "info"; - - var breakpointType = status.breakpoint.type; - var substitutions = [WebInspector.DOMBreakpoint.labelForType(breakpointType), WebInspector.panels.elements.linkifyNodeById(status.breakpoint.nodeId)]; - var formatters = { - s: function(substitution) + if (eventType === WebInspector.CallStackSidebarPane.DebuggerEventType.DOMBreakpoint) { + var breakpoint = eventData.breakpoint; + var substitutions = [WebInspector.DOMBreakpoint.labelForType(breakpoint.type), WebInspector.panels.elements.linkifyNodeById(breakpoint.nodeId)]; + var formatters = { + s: function(substitution) + { + return substitution; + } + }; + function append(a, b) { - return substitution; + if (typeof b === "string") + b = document.createTextNode(b); + statusElement.appendChild(b); } - }; - function append(a, b) - { - if (typeof b === "string") - b = document.createTextNode(b); - statusElement.appendChild(b); - } - if (breakpointType === WebInspector.DOMBreakpoint.Types.SubtreeModified) { - var targetNode = WebInspector.panels.elements.linkifyNodeById(status.targetNodeId); - if (status.insertion) { - if (status.targetNodeId !== status.breakpoint.nodeId) - WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.", substitutions.concat(targetNode), formatters, "", append); - else - WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.", substitutions, formatters, "", append); + if (breakpoint.type === WebInspector.DOMBreakpoint.Types.SubtreeModified) { + var targetNode = WebInspector.panels.elements.linkifyNodeById(eventData.targetNodeId); + if (eventData.insertion) { + if (eventData.targetNodeId !== breakpoint.nodeId) + WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.", substitutions.concat(targetNode), formatters, "", append); + else + WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.", substitutions, formatters, "", append); + } else + WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.", substitutions.concat(targetNode), formatters, "", append); } else - WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.", substitutions.concat(targetNode), formatters, "", append); - } else - WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s.", substitutions, formatters, "", append); + WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s.", substitutions, formatters, "", append); + } else if (eventType === WebInspector.CallStackSidebarPane.DebuggerEventType.NativeBreakpoint && eventData.type === "XHR") + statusElement.appendChild(document.createTextNode(WebInspector.UIString("Paused on XMLHttpRequest."))); + else + return; + + statusElement.className = "info"; this.bodyElement.appendChild(statusElement); }, diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js index 9b386c3..279852e 100644 --- a/WebCore/inspector/front-end/DOMAgent.js +++ b/WebCore/inspector/front-end/DOMAgent.js @@ -98,13 +98,7 @@ WebInspector.DOMNode.prototype = { set nodeValue(value) { if (this.nodeType != Node.TEXT_NODE) return; - var self = this; - var callback = function() - { - self._nodeValue = value; - self.textContent = value; - }; - this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, callback); + this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, function() {}); }, getAttribute: function(name) @@ -384,6 +378,15 @@ WebInspector.DOMAgent.prototype = { this.document._fireDomEvent("DOMAttrModified", event); }, + _characterDataModified: function(nodeId, newValue) + { + var node = this._idToDOMNode[nodeId]; + node._nodeValue = newValue; + node.textContent = newValue; + var event = { target : node }; + this.document._fireDomEvent("DOMCharacterDataModified", event); + }, + nodeForId: function(nodeId) { return this._idToDOMNode[nodeId]; @@ -691,6 +694,11 @@ WebInspector.attributesUpdated = function() this.domAgent._attributesUpdated.apply(this.domAgent, arguments); } +WebInspector.characterDataModified = function() +{ + this.domAgent._characterDataModified.apply(this.domAgent, arguments); +} + WebInspector.setDocument = function() { this.domAgent._setDocument.apply(this.domAgent, arguments); @@ -866,6 +874,13 @@ WebInspector.DOMBreakpoint.prototype = { this.dispatchEventToListeners("enable-changed"); }, + compareTo: function(other) + { + if (this.type != other.type) + return this.type < other.type ? -1 : 1; + return 0; + }, + remove: function() { if (this.enabled) diff --git a/WebCore/inspector/front-end/DataGrid.js b/WebCore/inspector/front-end/DataGrid.js index 1ecc4f2..f68fe48 100644 --- a/WebCore/inspector/front-end/DataGrid.js +++ b/WebCore/inspector/front-end/DataGrid.js @@ -92,10 +92,8 @@ WebInspector.DataGrid = function(columns, editCallback, deleteCallback) cell.addStyleClass("sortable"); } - if (column.aligned) { - cell.addStyleClass(column.aligned); + if (column.aligned) this.aligned[columnIdentifier] = column.aligned; - } headerRow.appendChild(cell); @@ -412,6 +410,7 @@ WebInspector.DataGrid.prototype = { resizer.style.left = left + "px"; } + this.dispatchEventToListeners("width changed"); }, addCreationNode: function(hasChildren) @@ -535,6 +534,35 @@ WebInspector.DataGrid.prototype = { this.children = []; }, + sortNodes: function(comparator, descending) + { + function comparatorWrapper(a, b) + { + var aDataGirdNode = a._dataGridNode; + var bDataGirdNode = b._dataGridNode; + if (!aDataGirdNode) + return 1; // Filler row. + if (!bDataGirdNode) + return -1; // Filler row. + return descending ? comparator(bDataGirdNode, aDataGirdNode) : comparator(aDataGirdNode, bDataGirdNode); + } + + var tbody = this.dataTableBody; + var tbodyParent = tbody.parentElement; + tbodyParent.removeChild(tbody); + + var childNodes = tbody.childNodes; + var sortedNodes = Array.prototype.slice.call(childNodes); + sortedNodes.sort(comparatorWrapper.bind(this)); + + var sortedNodesLength = sortedNodes.length; + tbody.removeChildren(); + for (var i = 0; i < sortedNodesLength; ++i) { + var node = sortedNodes[i]; + tbody.appendChild(node); + } + tbodyParent.appendChild(tbody); + }, _keyDown: function(event) { @@ -772,12 +800,14 @@ WebInspector.DataGrid.prototype = { this._dataTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width = percentRightColumn; event.preventDefault(); + this.dispatchEventToListeners("width changed"); }, _endResizerDragging: function(event) { WebInspector.elementDragEnd(event); this.currentResizer = null; + this.dispatchEventToListeners("width changed"); }, ColumnResizePadding: 10, @@ -825,12 +855,16 @@ WebInspector.DataGridNode.prototype = { if (this.revealed) this._element.addStyleClass("revealed"); + this.createCells(); + return this._element; + }, + + createCells: function() + { for (var columnIdentifier in this.dataGrid.columns) { var cell = this.createCell(columnIdentifier); this._element.appendChild(cell); } - - return this._element; }, get data() @@ -964,11 +998,7 @@ WebInspector.DataGridNode.prototype = { return; this._element.removeChildren(); - - for (var columnIdentifier in this.dataGrid.columns) { - var cell = this.createCell(columnIdentifier); - this._element.appendChild(cell); - } + this.createCells(); }, createCell: function(columnIdentifier) diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index 72b23e1..d6437fc 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -74,7 +74,7 @@ WebInspector.ElementsPanel = function() this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPanes.computedStyle); this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); - if (Preferences.domBreakpointsEnabled) + if (Preferences.nativeInstrumentationEnabled) this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane(); this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPane(); @@ -148,7 +148,7 @@ WebInspector.ElementsPanel.prototype = { WebInspector.Panel.prototype.hide.call(this); WebInspector.highlightDOMNode(0); - InspectorBackend.disableSearchingForNode(); + this.setSearchingForNode(false); }, resize: function() @@ -171,7 +171,7 @@ WebInspector.ElementsPanel.prototype = { delete this.currentQuery; - if (Preferences.domBreakpointsEnabled) + if (Preferences.nativeInstrumentationEnabled) this.sidebarPanes.domBreakpoints.reset(); }, @@ -186,6 +186,7 @@ WebInspector.ElementsPanel.prototype = { inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this)); inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this)); inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this)); + inspectedRootDocument.addEventListener("DOMCharacterDataModified", this._characterDataModified.bind(this)); this.rootDOMNode = inspectedRootDocument; @@ -247,16 +248,6 @@ WebInspector.ElementsPanel.prototype = { InspectorBackend.performSearch(whitespaceTrimmedQuery, false); }, - searchingForNodeWasEnabled: function() - { - this._nodeSearchButton.toggled = true; - }, - - searchingForNodeWasDisabled: function() - { - this._nodeSearchButton.toggled = false; - }, - populateHrefContextMenu: function(contextMenu, event, anchorElement) { if (!anchorElement.href) @@ -491,6 +482,13 @@ WebInspector.ElementsPanel.prototype = { this._updateModifiedNodesSoon(); }, + _characterDataModified: function(event) + { + this.recentlyModifiedNodes.push({node: event.target, updated: true}); + if (this.visible) + this._updateModifiedNodesSoon(); + }, + _nodeInserted: function(event) { this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true}); @@ -1152,12 +1150,29 @@ WebInspector.ElementsPanel.prototype = { this.treeOutline.updateSelection(); }, + updateFocusedNode: function(nodeId) + { + var node = WebInspector.domAgent.nodeForId(nodeId); + if (!node) + return; + + this.focusedDOMNode = node; + this._nodeSearchButton.toggled = false; + }, + + _setSearchingForNode: function(enabled) + { + this._nodeSearchButton.toggled = enabled; + }, + + setSearchingForNode: function(enabled) + { + InspectorBackend.setSearchingForNode(enabled, this._setSearchingForNode.bind(this)); + }, + toggleSearchingForNode: function() { - if (!this._nodeSearchButton.toggled) - InspectorBackend.enableSearchingForNode(); - else - InspectorBackend.disableSearchingForNode(); + this.setSearchingForNode(!this._nodeSearchButton.toggled); }, elementsToRestoreScrollPositionsFor: function() diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index e261234..1479c9a 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -637,10 +637,12 @@ WebInspector.ElementsTreeElement.prototype = { this.listItemElement.scrollIntoViewIfNeeded(false); }, - onselect: function() + onselect: function(treeElement, selectedByUser) { this.treeOutline.suppressRevealAndSelect = true; this.treeOutline.focusedDOMNode = this.representedObject; + if (selectedByUser) + WebInspector.highlightDOMNode(this.representedObject.id); this.updateSelection(); this.treeOutline.suppressRevealAndSelect = false; }, @@ -752,7 +754,7 @@ WebInspector.ElementsTreeElement.prototype = { contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this)); contextMenu.appendItem(WebInspector.UIString("Delete Node"), this.remove.bind(this)); - if (Preferences.domBreakpointsEnabled) { + if (Preferences.nativeInstrumentationEnabled) { // Add debbuging-related actions contextMenu.appendSeparator(); @@ -1125,7 +1127,7 @@ WebInspector.ElementsTreeElement.prototype = { delete this._editing; var textNode; - if (this.representedObject.nodeType == Node.ELEMENT_NODE) { + if (this.representedObject.nodeType === Node.ELEMENT_NODE) { // We only show text nodes inline in elements if the element only // has a single child, and that child is a text node. textNode = this.representedObject.firstChild; @@ -1133,9 +1135,6 @@ WebInspector.ElementsTreeElement.prototype = { textNode = this.representedObject; textNode.nodeValue = newText; - - // Need to restore attributes / node structure. - this.updateTitle(); }, _editingCancelled: function(element, context) diff --git a/WebCore/inspector/front-end/GoToLineDialog.js b/WebCore/inspector/front-end/GoToLineDialog.js new file mode 100644 index 0000000..c96344c --- /dev/null +++ b/WebCore/inspector/front-end/GoToLineDialog.js @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.GoToLineDialog = function(view) +{ + this._element = document.createElement("div"); + this._element.className = "go-to-line-dialog"; + this._element.addEventListener("keydown", this._onKeyDown.bind(this), false); + this._closeKeys = [ + WebInspector.KeyboardShortcut.Keys.Enter.code, + WebInspector.KeyboardShortcut.Keys.Esc.code, + ]; + + var dialogWindow = this._element; + + dialogWindow.createChild("label").innerText = WebInspector.UIString("Go to line: "); + + this._input = dialogWindow.createChild("input"); + this._input.setAttribute("type", "text"); + this._input.setAttribute("size", 6); + var linesCount = view.sourceFrame.textModel.linesCount; + if (linesCount) + this._input.setAttribute("title", WebInspector.UIString("1 - %d", linesCount)); + var blurHandler = this._onBlur.bind(this); + this._input.addEventListener("blur", blurHandler, false); + + + var go = dialogWindow.createChild("button"); + go.innerText = WebInspector.UIString("Go"); + go.addEventListener("click", this._onClick.bind(this), false); + go.addEventListener("mousedown", function(e) { + // Ok button click will close the dialog, removing onBlur listener + // to let click event be handled. + this._input.removeEventListener("blur", blurHandler, false); + }.bind(this), false); + + this._view = view; + view.element.appendChild(this._element); + + this._previousFocusElement = WebInspector.currentFocusElement; + WebInspector.currentFocusElement = this._input; + this._input.select(); +} + +WebInspector.GoToLineDialog.show = function(sourceView) +{ + if (this._instance) + return; + this._instance = new WebInspector.GoToLineDialog(sourceView); +} + +WebInspector.GoToLineDialog.prototype = { + _hide: function() + { + if (this._isHiding) + return; + this._isHiding = true; + + WebInspector.currentFocusElement = this._previousFocusElement; + WebInspector.GoToLineDialog._instance = null; + this._element.parentElement.removeChild(this._element); + }, + + _onBlur: function(event) + { + this._hide(); + }, + + _onKeyDown: function(event) + { + if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Tab.code) { + event.preventDefault(); + return; + } + + if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) + this._highlightSelectedLine(); + + if (this._closeKeys.indexOf(event.keyCode) >= 0) { + this._hide(); + event.stopPropagation(); + } + }, + + _onClick: function(event) + { + this._highlightSelectedLine(); + this._hide(); + }, + + _highlightSelectedLine: function() + { + var value = this._input.value; + var lineNumber = parseInt(value, 10); + if (!isNaN(lineNumber) && lineNumber > 0) { + lineNumber = Math.min(lineNumber, this._view.sourceFrame.textModel.linesCount); + this._view.highlightLine(lineNumber); + } + } +}; diff --git a/WebCore/inspector/front-end/Images/networkIcon.png b/WebCore/inspector/front-end/Images/networkIcon.png Binary files differnew file mode 100644 index 0000000..982424d --- /dev/null +++ b/WebCore/inspector/front-end/Images/networkIcon.png diff --git a/WebCore/inspector/front-end/Images/paneAddButtons.png b/WebCore/inspector/front-end/Images/paneAddButtons.png Binary files differnew file mode 100644 index 0000000..f1c0047 --- /dev/null +++ b/WebCore/inspector/front-end/Images/paneAddButtons.png diff --git a/WebCore/inspector/front-end/NetworkPanel.js b/WebCore/inspector/front-end/NetworkPanel.js new file mode 100644 index 0000000..f07b3b0 --- /dev/null +++ b/WebCore/inspector/front-end/NetworkPanel.js @@ -0,0 +1,1414 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> + * Copyright (C) 2009, 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.NetworkPanel = function() +{ + WebInspector.Panel.call(this, "network"); + + this._resources = []; + this._staleResources = []; + this._resourceGridNodes = {}; + this._mainResourceLoadTime = -1; + this._mainResourceDOMContentTime = -1; + + this._viewsContainerElement = document.createElement("div"); + this._viewsContainerElement.id = "network-views"; + this.element.appendChild(this._viewsContainerElement); + + this._createSortingFunctions(); + this._createTimelineGrid(); + this._createTable(); + this._createStatusbarButtons(); + + this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), true); + + this.calculator = new WebInspector.NetworkTransferTimeCalculator(); + this.filter(this.filterAllElement, false); +} + +WebInspector.NetworkPanel.prototype = { + get toolbarItemLabel() + { + return WebInspector.UIString("Network"); + }, + + get statusBarItems() + { + return [this._largerResourcesButton.element, this._clearButton.element]; + }, + + isCategoryVisible: function(categoryName) + { + return true; + }, + + elementsToRestoreScrollPositionsFor: function() + { + return [this.containerElement]; + }, + + resize: function() + { + WebInspector.Panel.prototype.resize.call(this); + this._dataGrid.updateWidths(); + }, + + _createTimelineGrid: function() + { + this._timelineGrid = new WebInspector.TimelineGrid(); + this._timelineGrid.element.addStyleClass("network-timeline-grid"); + this.element.appendChild(this._timelineGrid.element); + }, + + _createTable: function() + { + this.containerElement = document.createElement("div"); + this.containerElement.id = "network-container"; + this.element.appendChild(this.containerElement); + + var columns = {url: {}, method: {}, status: {}, type: {}, size: {}, time: {}, timeline: {}}; + columns.url.title = WebInspector.UIString("URL"); + columns.url.sortable = true; + columns.url.width = "20%"; + columns.url.disclosure = true; + + columns.method.title = WebInspector.UIString("Method"); + columns.method.sortable = true; + columns.method.width = "7%"; + + columns.status.title = WebInspector.UIString("Status"); + columns.status.sortable = true; + columns.status.width = "8%"; + + columns.type.title = WebInspector.UIString("Type"); + columns.type.sortable = true; + columns.type.width = "7%"; + + columns.size.title = WebInspector.UIString("Size"); + columns.size.sortable = true; + columns.size.width = "10%"; + columns.size.aligned = "right"; + + columns.time.title = WebInspector.UIString("Time"); + columns.time.sortable = true; + columns.time.width = "10%"; + columns.time.aligned = "right"; + + columns.timeline.title = ""; + columns.timeline.sortable = true; + columns.timeline.width = "40%"; + columns.timeline.sort = true; + + this._dataGrid = new WebInspector.DataGrid(columns); + this.element.appendChild(this._dataGrid.element); + this._dataGrid.addEventListener("sorting changed", this._sortItems, this); + this._dataGrid.addEventListener("width changed", this._updateDividersIfNeeded, this); + }, + + _createSortingFunctions: function() + { + this._sortingFunctions = {}; + this._sortingFunctions.url = WebInspector.NetworkDataGridNode.URLComparator; + this._sortingFunctions.method = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "method"); + this._sortingFunctions.status = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "statusCode"); + this._sortingFunctions.type = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "mimeType"); + this._sortingFunctions.size = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "resourceSize"); + this._sortingFunctions.time = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "duration"); + this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "startTime"); + }, + + filter: function(target, selectMultiple) + { + }, + + _updateFilter: function(e) + { + var isMac = WebInspector.isMac(); + var selectMultiple = false; + if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + + this.filter(e.target, selectMultiple); + + // When we are updating our filtering, scroll to the top so we don't end up + // in blank graph under all the resources. + this.containerElement.scrollTop = 0; + + var searchField = document.getElementById("search"); + WebInspector.doPerformSearch(searchField.value, WebInspector.shortSearchWasForcedByKeyEvent, false, true); + }, + + _scheduleRefresh: function() + { + if (this._needsRefresh) + return; + + this._needsRefresh = true; + + if (this.visible && !("_refreshTimeout" in this)) + this._refreshTimeout = setTimeout(this.refresh.bind(this), 500); + }, + + _sortItems: function() + { + var columnIdentifier = this._dataGrid.sortColumnIdentifier; + var sortingFunction = this._sortingFunctions[columnIdentifier]; + if (!sortingFunction) + return; + this._dataGrid.sortNodes(sortingFunction, this._dataGrid.sortOrder === "descending"); + }, + + _updateDividersIfNeeded: function(force) + { + this._timelineGrid.element.style.left = this._dataGrid.resizers[this._dataGrid.resizers.length - 1].style.left; + + var proceed = true; + if (!this.visible) { + this._scheduleRefresh(); + proceed = false; + } else + proceed = this._timelineGrid.updateDividers(force, this.calculator); + + if (!proceed) + return; + + if (this.calculator.startAtZero || !this.calculator.computePercentageFromEventTime) { + // If our current sorting method starts at zero, that means it shows all + // resources starting at the same point, and so onLoad event and DOMContent + // event lines really wouldn't make much sense here, so don't render them. + // Additionally, if the calculator doesn't have the computePercentageFromEventTime + // function defined, we are probably sorting by size, and event times aren't relevant + // in this case. + return; + } + + this._timelineGrid.removeEventDividers(); + if (this._mainResourceLoadTime !== -1) { + var percent = this.calculator.computePercentageFromEventTime(this._mainResourceLoadTime); + + var loadDivider = document.createElement("div"); + loadDivider.className = "network-event-divider network-red-divider"; + + var loadDividerPadding = document.createElement("div"); + loadDividerPadding.className = "network-event-divider-padding"; + loadDividerPadding.title = WebInspector.UIString("Load event fired"); + loadDividerPadding.appendChild(loadDivider); + loadDividerPadding.style.left = percent + "%"; + this._timelineGrid.addEventDivider(loadDividerPadding); + } + + if (this._mainResourceDOMContentTime !== -1) { + var percent = this.calculator.computePercentageFromEventTime(this._mainResourceDOMContentTime); + + var domContentDivider = document.createElement("div"); + domContentDivider.className = "network-event-divider network-blue-divider"; + + var domContentDividerPadding = document.createElement("div"); + domContentDividerPadding.className = "network-event-divider-padding"; + domContentDividerPadding.title = WebInspector.UIString("DOMContent event fired"); + domContentDividerPadding.appendChild(domContentDivider); + domContentDividerPadding.style.left = percent + "%"; + this._timelineGrid.addEventDivider(domContentDividerPadding); + } + }, + + _refreshIfNeeded: function() + { + if (this._needsRefresh) + this.refresh(); + }, + + _invalidateAllItems: function() + { + this._staleResources = this._resources.slice(); + }, + + get calculator() + { + return this._calculator; + }, + + set calculator(x) + { + if (!x || this._calculator === x) + return; + + this._calculator = x; + this._calculator.reset(); + + this._invalidateAllItems(); + this.refresh(); + }, + + _resourceGridNode: function(resource) + { + return this._resourceGridNodes[resource.identifier]; + }, + + revealAndSelectItem: function(resource) + { + var node = this._resourceGridNode(resource); + if (node) { + node.reveal(); + node.select(true); + } + }, + + addEventDivider: function(divider) + { + this._timelineGrid.addEventDivider(divider); + }, + + get resourceTrackingEnabled() + { + return this._resourceTrackingEnabled; + }, + + _createStatusbarButtons: function() + { + this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-status-bar-item"); + this._clearButton.addEventListener("click", this.reset.bind(this), false); + + this._largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "network-larger-resources-status-bar-item"); + WebInspector.applicationSettings.addEventListener("loaded", this._settingsLoaded, this); + this._largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false); + }, + + _settingsLoaded: function() + { + this._largerResourcesButton.toggled = WebInspector.applicationSettings.resourcesLargeRows; + if (!WebInspector.applicationSettings.resourcesLargeRows) + this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows); + }, + + set mainResourceLoadTime(x) + { + if (this._mainResourceLoadTime === x) + return; + + this._mainResourceLoadTime = x || -1; + // Update the dividers to draw the new line + this._updateDividersIfNeeded(true); + }, + + set mainResourceDOMContentTime(x) + { + if (this._mainResourceDOMContentTime === x) + return; + + this._mainResourceDOMContentTime = x || -1; + this._updateDividersIfNeeded(true); + }, + + show: function() + { + WebInspector.Panel.prototype.show.call(this); + + this._refreshIfNeeded(); + + var visibleView = this.visibleView; + if (this.visibleResource) { + this.visibleView.headersVisible = true; + this.visibleView.show(this._viewsContainerElement); + } else if (visibleView) + visibleView.show(); + + // Hide any views that are visible that are not this panel's current visible view. + // This can happen when a ResourceView is visible in the Scripts panel then switched + // to the this panel. + var resourcesLength = this._resources.length; + for (var i = 0; i < resourcesLength; ++i) { + var resource = this._resources[i]; + var view = resource._resourcesView; + if (!view || view === visibleView) + continue; + view.visible = false; + } + this._dataGrid.updateWidths(); + }, + + get searchableViews() + { + var views = []; + + const visibleView = this.visibleView; + if (visibleView && visibleView.performSearch) + views.push(visibleView); + + var resourcesLength = this._resources.length; + for (var i = 0; i < resourcesLength; ++i) { + var resource = this._resources[i]; + if (!this._resourceGridNode(resource) || !this._resourceGridNode(resource).selectable) + continue; + var resourceView = this.resourceViewForResource(resource); + if (!resourceView.performSearch || resourceView === visibleView) + continue; + views.push(resourceView); + } + + return views; + }, + + searchMatchFound: function(view, matches) + { + this._resourceGridNode(view.resource).searchMatches = matches; + }, + + searchCanceled: function(startingNewSearch) + { + WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch); + + if (startingNewSearch || !this._resources) + return; + }, + + performSearch: function(query) + { + WebInspector.Panel.prototype.performSearch.call(this, query); + }, + + get visibleView() + { + if (this.visibleResource) + return this.visibleResource._resourcesView; + return null; + }, + + refresh: function() + { + this._needsRefresh = false; + if ("_refreshTimeout" in this) { + clearTimeout(this._refreshTimeout); + delete this._refreshTimeout; + } + + var staleItemsLength = this._staleResources.length; + + var boundariesChanged = false; + + for (var i = 0; i < staleItemsLength; ++i) { + var resource = this._staleResources[i]; + var node = this._resourceGridNode(resource); + if (!node) { + // Create the timeline tree element and graph. + node = new WebInspector.NetworkDataGridNode(resource); + this._resourceGridNodes[resource.identifier] = node; + this._dataGrid.appendChild(node); + } + node.refreshResource(); + + if (this.calculator.updateBoundaries(resource)) + boundariesChanged = true; + } + + if (boundariesChanged) { + // The boundaries changed, so all item graphs are stale. + this._invalidateAllItems(); + staleItemsLength = this._staleResources.length; + } + + for (var i = 0; i < staleItemsLength; ++i) + this._resourceGridNode(this._staleResources[i]).refreshGraph(this.calculator); + + this._staleResources = []; + this._sortItems(); + this._dataGrid.updateWidths(); + }, + + reset: function() + { + this._popoverHelper.hidePopup(); + this.closeVisibleResource(); + + delete this.currentQuery; + this.searchCanceled(); + + if (this._resources) { + var resourcesLength = this._resources.length; + for (var i = 0; i < resourcesLength; ++i) { + var resource = this._resources[i]; + + resource.warnings = 0; + resource.errors = 0; + + delete resource._resourcesView; + } + } + + // Begin reset timeline + this.containerElement.scrollTop = 0; + + if (this._calculator) + this._calculator.reset(); + + if (this._resources) { + var itemsLength = this._resources.length; + for (var i = 0; i < itemsLength; ++i) { + var item = this._resources[i]; + } + } + + this._resources = []; + this._staleResources = []; + this._resourceGridNodes = {}; + + this._dataGrid.removeChildren(); + this._updateDividersIfNeeded(true); + // End reset timeline. + + this._mainResourceLoadTime = -1; + this._mainResourceDOMContentTime = -1; + + this._viewsContainerElement.removeChildren(); + }, + + addResource: function(resource) + { + this._resources.push(resource); + this.refreshResource(resource); + }, + + refreshResource: function(resource) + { + this._staleResources.push(resource); + this._scheduleRefresh(); + }, + + recreateViewForResourceIfNeeded: function(resource) + { + if (!resource || !resource._resourcesView) + return; + + var newView = this._createResourceView(resource); + if (newView.__proto__ === resource._resourcesView.__proto__) + return; + + if (!this.currentQuery && this._resourceGridNode(resource)) + this._resourceGridNode(resource).updateErrorsAndWarnings(); + + var oldView = resource._resourcesView; + var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null; + + resource._resourcesView.detach(); + delete resource._resourcesView; + + resource._resourcesView = newView; + + newView.headersVisible = oldView.headersVisible; + + if (oldViewParentNode) + newView.show(oldViewParentNode); + + WebInspector.panels.scripts.viewRecreated(oldView, newView); + }, + + canShowSourceLine: function(url, line) + { + return this._resourceTrackingEnabled && !!WebInspector.resourceForURL(url); + }, + + showSourceLine: function(url, line) + { + this.showResource(WebInspector.resourceForURL(url), line); + }, + + showResource: function(resource, line) + { + if (!resource) + return; + + this._popoverHelper.hidePopup(); + + this.containerElement.addStyleClass("viewing-resource"); + + if (this.visibleResource && this.visibleResource._resourcesView) + this.visibleResource._resourcesView.hide(); + + var view = this.resourceViewForResource(resource); + view.headersVisible = true; + view.show(this._viewsContainerElement); + + if (line) { + view.selectContentTab(true); + if (view.revealLine) + view.revealLine(line); + if (view.highlightLine) + view.highlightLine(line); + } + + this.revealAndSelectItem(resource); + + this.visibleResource = resource; + + this.updateSidebarWidth(); + }, + + showView: function(view) + { + if (!view) + return; + this.showResource(view.resource); + }, + + closeVisibleResource: function() + { + this.containerElement.removeStyleClass("viewing-resource"); + + if (this.visibleResource && this.visibleResource._resourcesView) + this.visibleResource._resourcesView.hide(); + delete this.visibleResource; + + if (this._lastSelectedGraphTreeElement) + this._lastSelectedGraphTreeElement.select(true); + + this.updateSidebarWidth(); + }, + + resourceViewForResource: function(resource) + { + if (!resource) + return null; + if (!resource._resourcesView) + resource._resourcesView = this._createResourceView(resource); + return resource._resourcesView; + }, + + sourceFrameForResource: function(resource) + { + var view = this.resourceViewForResource(resource); + if (!view) + return null; + + if (!view.setupSourceFrameIfNeeded) + return null; + + // Setting up the source frame requires that we be attached. + if (!this.element.parentNode) + this.attach(); + + view.setupSourceFrameIfNeeded(); + return view.sourceFrame; + }, + + _toggleLargerResources: function() + { + WebInspector.applicationSettings.resourcesLargeRows = !WebInspector.applicationSettings.resourcesLargeRows; + this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows); + }, + + _setLargerResources: function(enabled) + { + this._largerResourcesButton.toggled = enabled; + if (!enabled) { + this._largerResourcesButton.title = WebInspector.UIString("Use large resource rows."); + this._dataGrid.element.addStyleClass("small"); + } else { + this._largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); + this._dataGrid.element.removeStyleClass("small"); + } + }, + + _createResourceView: function(resource) + { + switch (resource.category) { + case WebInspector.resourceCategories.documents: + case WebInspector.resourceCategories.stylesheets: + case WebInspector.resourceCategories.scripts: + case WebInspector.resourceCategories.xhr: + return new WebInspector.SourceView(resource); + case WebInspector.resourceCategories.images: + return new WebInspector.ImageView(resource); + case WebInspector.resourceCategories.fonts: + return new WebInspector.FontView(resource); + default: + return new WebInspector.ResourceView(resource); + } + }, + + _getPopoverAnchor: function(element) + { + var anchor = element.enclosingNodeOrSelfWithClass("network-graph-bar") || element.enclosingNodeOrSelfWithClass("network-graph-label"); + if (!anchor) + return null; + var resource = anchor.parentElement.resource; + return resource && resource.timing ? anchor : null; + }, + + _showPopover: function(anchor) + { + var tableElement = document.createElement("table"); + var resource = anchor.parentElement.resource; + var rows = []; + + function addRow(title, start, end, color) + { + var row = {}; + row.title = title; + row.start = start; + row.end = end; + rows.push(row); + } + + if (resource.timing.proxyStart !== -1) + addRow(WebInspector.UIString("Proxy"), resource.timing.proxyStart, resource.timing.proxyEnd); + + if (resource.timing.dnsStart !== -1) + addRow(WebInspector.UIString("DNS Lookup"), resource.timing.dnsStart, resource.timing.dnsEnd); + + if (resource.timing.connectStart !== -1) { + if (resource.connectionReused) + addRow(WebInspector.UIString("Blocking"), resource.timing.connectStart, resource.timing.connectEnd); + else { + var connectStart = resource.timing.connectStart; + // Connection includes DNS, subtract it here. + if (resource.timing.dnsStart !== -1) + connectStart += resource.timing.dnsEnd - resource.timing.dnsStart; + addRow(WebInspector.UIString("Connecting"), connectStart, resource.timing.connectEnd); + } + } + + if (resource.timing.sslStart !== -1) + addRow(WebInspector.UIString("SSL"), resource.timing.sslStart, resource.timing.sslEnd); + + var sendStart = resource.timing.sendStart; + if (resource.timing.sslStart !== -1) + sendStart += resource.timing.sslEnd - resource.timing.sslStart; + + addRow(WebInspector.UIString("Sending"), resource.timing.sendStart, resource.timing.sendEnd); + addRow(WebInspector.UIString("Waiting"), resource.timing.sendEnd, resource.timing.receiveHeadersEnd); + addRow(WebInspector.UIString("Receiving"), (resource.responseReceivedTime - resource.timing.requestTime) * 1000, (resource.endTime - resource.timing.requestTime) * 1000); + + const chartWidth = 200; + var total = (resource.endTime - resource.timing.requestTime) * 1000; + var scale = chartWidth / total; + + for (var i = 0; i < rows.length; ++i) { + var tr = document.createElement("tr"); + tableElement.appendChild(tr); + + var td = document.createElement("td"); + td.textContent = rows[i].title; + tr.appendChild(td); + + td = document.createElement("td"); + td.width = chartWidth + "px"; + + var row = document.createElement("div"); + row.className = "network-timing-row"; + td.appendChild(row); + + var bar = document.createElement("span"); + bar.className = "network-timing-bar"; + bar.style.left = scale * rows[i].start + "px"; + bar.style.right = scale * (total - rows[i].end) + "px"; + bar.style.backgroundColor = rows[i].color; + bar.textContent = "\u200B"; // Important for 0-time items to have 0 width. + row.appendChild(bar); + + var title = document.createElement("span"); + title.className = "network-timing-bar-title"; + if (total - rows[i].end < rows[i].start) + title.style.right = (scale * (total - rows[i].end) + 3) + "px"; + else + title.style.left = (scale * rows[i].start + 3) + "px"; + title.textContent = Number.millisToString(rows[i].end - rows[i].start); + row.appendChild(title); + + tr.appendChild(td); + } + + var popover = new WebInspector.Popover(tableElement); + popover.show(anchor); + return popover; + }, + + hide: function() + { + WebInspector.Panel.prototype.hide.call(this); + this._popoverHelper.hidePopup(); + } +} + +WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; + +WebInspector.getResourceContent = function(identifier, callback) +{ + InspectorBackend.getResourceContent(identifier, callback); +} + +WebInspector.NetworkBaseCalculator = function() +{ +} + +WebInspector.NetworkBaseCalculator.prototype = { + computeSummaryValues: function(items) + { + var total = 0; + var categoryValues = {}; + + var itemsLength = items.length; + for (var i = 0; i < itemsLength; ++i) { + var item = items[i]; + var value = this._value(item); + if (typeof value === "undefined") + continue; + if (!(item.category.name in categoryValues)) + categoryValues[item.category.name] = 0; + categoryValues[item.category.name] += value; + total += value; + } + + return {categoryValues: categoryValues, total: total}; + }, + + computeBarGraphPercentages: function(item) + { + return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100}; + }, + + computeBarGraphLabels: function(item) + { + const label = this.formatValue(this._value(item)); + return {left: label, right: label, tooltip: label}; + }, + + get boundarySpan() + { + return this.maximumBoundary - this.minimumBoundary; + }, + + updateBoundaries: function(item) + { + this.minimumBoundary = 0; + + var value = this._value(item); + if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { + this.maximumBoundary = value; + return true; + } + return false; + }, + + reset: function() + { + delete this.minimumBoundary; + delete this.maximumBoundary; + }, + + _value: function(item) + { + return 0; + }, + + formatValue: function(value) + { + return value.toString(); + } +} + +WebInspector.NetworkTimeCalculator = function(startAtZero) +{ + WebInspector.NetworkBaseCalculator.call(this); + this.startAtZero = startAtZero; +} + +WebInspector.NetworkTimeCalculator.prototype = { + computeSummaryValues: function(resources) + { + var resourcesByCategory = {}; + var resourcesLength = resources.length; + for (var i = 0; i < resourcesLength; ++i) { + var resource = resources[i]; + if (!(resource.category.name in resourcesByCategory)) + resourcesByCategory[resource.category.name] = []; + resourcesByCategory[resource.category.name].push(resource); + } + + var earliestStart; + var latestEnd; + var categoryValues = {}; + for (var category in resourcesByCategory) { + resourcesByCategory[category].sort(WebInspector.Resource.CompareByTime); + categoryValues[category] = 0; + + var segment = {start: -1, end: -1}; + + var categoryResources = resourcesByCategory[category]; + var resourcesLength = categoryResources.length; + for (var i = 0; i < resourcesLength; ++i) { + var resource = categoryResources[i]; + if (resource.startTime === -1 || resource.endTime === -1) + continue; + + if (typeof earliestStart === "undefined") + earliestStart = resource.startTime; + else + earliestStart = Math.min(earliestStart, resource.startTime); + + if (typeof latestEnd === "undefined") + latestEnd = resource.endTime; + else + latestEnd = Math.max(latestEnd, resource.endTime); + + if (resource.startTime <= segment.end) { + segment.end = Math.max(segment.end, resource.endTime); + continue; + } + + categoryValues[category] += segment.end - segment.start; + + segment.start = resource.startTime; + segment.end = resource.endTime; + } + + // Add the last segment + categoryValues[category] += segment.end - segment.start; + } + + return {categoryValues: categoryValues, total: latestEnd - earliestStart}; + }, + + computeBarGraphPercentages: function(resource) + { + if (resource.startTime !== -1) + var start = ((resource.startTime - this.minimumBoundary) / this.boundarySpan) * 100; + else + var start = 0; + + if (resource.responseReceivedTime !== -1) + var middle = ((resource.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100; + else + var middle = (this.startAtZero ? start : 100); + + if (resource.endTime !== -1) + var end = ((resource.endTime - this.minimumBoundary) / this.boundarySpan) * 100; + else + var end = (this.startAtZero ? middle : 100); + + if (this.startAtZero) { + end -= start; + middle -= start; + start = 0; + } + + return {start: start, middle: middle, end: end}; + }, + + computePercentageFromEventTime: function(eventTime) + { + // This function computes a percentage in terms of the total loading time + // of a specific event. If startAtZero is set, then this is useless, and we + // want to return 0. + if (eventTime !== -1 && !this.startAtZero) + return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100; + + return 0; + }, + + computeBarGraphLabels: function(resource) + { + var rightLabel = ""; + if (resource.responseReceivedTime !== -1 && resource.endTime !== -1) + rightLabel = this.formatValue(resource.endTime - resource.responseReceivedTime); + + var hasLatency = resource.latency > 0; + if (hasLatency) + var leftLabel = this.formatValue(resource.latency); + else + var leftLabel = rightLabel; + + if (resource.timing) + return {left: leftLabel, right: rightLabel}; + + if (hasLatency && rightLabel) { + var total = this.formatValue(resource.duration); + var tooltip = WebInspector.UIString("%s latency, %s download (%s total)", leftLabel, rightLabel, total); + } else if (hasLatency) + var tooltip = WebInspector.UIString("%s latency", leftLabel); + else if (rightLabel) + var tooltip = WebInspector.UIString("%s download", rightLabel); + + if (resource.cached) + tooltip = WebInspector.UIString("%s (from cache)", tooltip); + return {left: leftLabel, right: rightLabel, tooltip: tooltip}; + }, + + updateBoundaries: function(resource) + { + var didChange = false; + + var lowerBound; + if (this.startAtZero) + lowerBound = 0; + else + lowerBound = this._lowerBound(resource); + + if (lowerBound !== -1 && (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary)) { + this.minimumBoundary = lowerBound; + didChange = true; + } + + var upperBound = this._upperBound(resource); + if (upperBound !== -1 && (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary)) { + this.maximumBoundary = upperBound; + didChange = true; + } + + return didChange; + }, + + formatValue: function(value) + { + return Number.secondsToString(value, WebInspector.UIString); + }, + + _lowerBound: function(resource) + { + return 0; + }, + + _upperBound: function(resource) + { + return 0; + } +} + +WebInspector.NetworkTimeCalculator.prototype.__proto__ = WebInspector.NetworkBaseCalculator.prototype; + +WebInspector.NetworkTransferTimeCalculator = function() +{ + WebInspector.NetworkTimeCalculator.call(this, false); +} + +WebInspector.NetworkTransferTimeCalculator.prototype = { + formatValue: function(value) + { + return Number.secondsToString(value, WebInspector.UIString); + }, + + _lowerBound: function(resource) + { + return resource.startTime; + }, + + _upperBound: function(resource) + { + return resource.endTime; + } +} + +WebInspector.NetworkTransferTimeCalculator.prototype.__proto__ = WebInspector.NetworkTimeCalculator.prototype; + +WebInspector.NetworkTransferDurationCalculator = function() +{ + WebInspector.NetworkTimeCalculator.call(this, true); +} + +WebInspector.NetworkTransferDurationCalculator.prototype = { + formatValue: function(value) + { + return Number.secondsToString(value, WebInspector.UIString); + }, + + _upperBound: function(resource) + { + return resource.duration; + } +} + +WebInspector.NetworkTransferDurationCalculator.prototype.__proto__ = WebInspector.NetworkTimeCalculator.prototype; + +WebInspector.NetworkTransferSizeCalculator = function() +{ + WebInspector.NetworkBaseCalculator.call(this); +} + +WebInspector.NetworkTransferSizeCalculator.prototype = { + computeBarGraphLabels: function(resource) + { + var networkBytes = this._networkBytes(resource); + var resourceBytes = this._value(resource); + if (networkBytes && networkBytes !== resourceBytes) { + // Transferred size is not the same as reported resource length. + var networkBytesString = this.formatValue(networkBytes); + var left = networkBytesString; + var right = this.formatValue(resourceBytes); + var tooltip = right ? WebInspector.UIString("%s (%s transferred)", right, networkBytesString) : right; + } else { + var left = this.formatValue(resourceBytes); + var right = left; + var tooltip = left; + } + if (resource.cached) + tooltip = WebInspector.UIString("%s (from cache)", tooltip); + return {left: left, right: right, tooltip: tooltip}; + }, + + computeBarGraphPercentages: function(item) + { + const resourceBytesAsPercent = (this._value(item) / this.boundarySpan) * 100; + const networkBytesAsPercent = this._networkBytes(item) ? (this._networkBytes(item) / this.boundarySpan) * 100 : resourceBytesAsPercent; + return {start: 0, middle: networkBytesAsPercent, end: resourceBytesAsPercent}; + }, + + _value: function(resource) + { + return resource.resourceSize; + }, + + _networkBytes: function(resource) + { + return resource.transferSize; + }, + + formatValue: function(value) + { + return Number.bytesToString(value, WebInspector.UIString); + } +} + +WebInspector.NetworkTransferSizeCalculator.prototype.__proto__ = WebInspector.NetworkBaseCalculator.prototype; + +WebInspector.NetworkDataGridNode = function(resource) +{ + WebInspector.DataGridNode.call(this, {}); + this._resource = resource; +} + +WebInspector.NetworkDataGridNode.prototype = { + createCells: function() + { + this._urlCell = this._createDivInTD("url-column"); + this._methodCell = this._createDivInTD("optional-column"); + this._statusCell = this._createDivInTD("optional-column"); + this._typeCell = this._createDivInTD("optional-column"); + this._sizeCell = this._createDivInTD("optional-column right"); + this._timeCell = this._createDivInTD("optional-column right"); + this._createTimelineCell(); + }, + + _createDivInTD: function(className) { + var td = document.createElement("td"); + if (className) + td.className = className; + var div = document.createElement("div"); + td.appendChild(div); + this._element.appendChild(td); + return div; + }, + + + _createTimelineCell: function() + { + this._graphElement = document.createElement("div"); + this._graphElement.className = "network-graph-side"; + this._graphElement.addEventListener("mouseover", this._refreshLabelPositions.bind(this), false); + + this._barAreaElement = document.createElement("div"); + // this._barAreaElement.className = "network-graph-bar-area hidden"; + this._barAreaElement.className = "network-graph-bar-area"; + this._barAreaElement.resource = this._resource; + this._graphElement.appendChild(this._barAreaElement); + + this._barLeftElement = document.createElement("div"); + this._barLeftElement.className = "network-graph-bar waiting"; + this._barAreaElement.appendChild(this._barLeftElement); + + this._barRightElement = document.createElement("div"); + this._barRightElement.className = "network-graph-bar"; + this._barAreaElement.appendChild(this._barRightElement); + + this._labelLeftElement = document.createElement("div"); + this._labelLeftElement.className = "network-graph-label waiting"; + this._barAreaElement.appendChild(this._labelLeftElement); + + this._labelRightElement = document.createElement("div"); + this._labelRightElement.className = "network-graph-label"; + this._barAreaElement.appendChild(this._labelRightElement); + + this._timelineCell = document.createElement("td"); + this._element.appendChild(this._timelineCell); + this._timelineCell.appendChild(this._graphElement); + }, + + refreshResource: function() + { + this._refreshURLCell(); + + this._methodCell.textContent = this._resource.requestMethod; + + this._refreshStatusCell(); + + if (this._resource.mimeType) { + this._typeCell.removeStyleClass("network-dim-cell"); + this._typeCell.textContent = this._resource.mimeType; + } else { + this._typeCell.addStyleClass("network-dim-cell"); + this._typeCell.textContent = WebInspector.UIString("Pending"); + } + + this._refreshSizeCell(); + this._refreshTimeCell(); + + if (this._resource.cached) + this._graphElement.addStyleClass("resource-cached"); + + if (!this._element.hasStyleClass("network-category-" + this._resource.category.name)) { + this._element.removeMatchingStyleClasses("network-category-\\w+"); + this._element.addStyleClass("network-category-" + this._resource.category.name); + } + }, + + _refreshURLCell: function() + { + this._urlCell.removeChildren(); + + if (this._resource.category === WebInspector.resourceCategories.images) { + var previewImage = document.createElement("img"); + previewImage.className = "image-network-icon-preview"; + previewImage.src = this._resource.url; + + var iconElement = document.createElement("div"); + iconElement.className = "icon"; + iconElement.appendChild(previewImage); + } else { + var iconElement = document.createElement("img"); + iconElement.className = "icon"; + } + this._urlCell.appendChild(iconElement); + this._urlCell.appendChild(document.createTextNode(this._fileName())); + + + var subtitle = this._resource.displayDomain; + + if (this._resource.path && this._resource.lastPathComponent) { + var lastPathComponentIndex = this._resource.path.lastIndexOf("/" + this._resource.lastPathComponent); + if (lastPathComponentIndex != -1) + subtitle += this._resource.path.substring(0, lastPathComponentIndex); + } + + var subtitleElement = document.createElement("div"); + subtitleElement.className = "network-grid-subtitle"; + subtitleElement.textContent = subtitle; + this._urlCell.appendChild(subtitleElement); + + + this._urlCell.title = this._resource.url; + }, + + _fileName: function() + { + var fileName = this._resource.displayName; + if (this._resource.queryString) + fileName += "?" + this._resource.queryString; + return fileName; + }, + + _refreshStatusCell: function() + { + this._statusCell.removeChildren(); + + if (this._resource.statusCode) { + var img = document.createElement("img"); + if (this._resource.statusCode < 300) + img.src = "Images/successGreenDot.png"; + else if (this._resource.statusCode < 400) + img.src = "Images/warningOrangeDot.png"; + else + img.src = "Images/errorRedDot.png"; + + img.className = "resource-status-image"; + this._statusCell.appendChild(img); + this._statusCell.appendChild(document.createTextNode(this._resource.statusCode)); + this._statusCell.removeStyleClass("network-dim-cell"); + this._appendSubtitle(this._statusCell, this._resource.statusText); + this._statusCell.title = this._resource.statusCode + " " + this._resource.statusText; + } else { + this._statusCell.addStyleClass("network-dim-cell"); + this._statusCell.textContent = WebInspector.UIString("Pending"); + } + }, + + _refreshSizeCell: function() + { + var resourceSize = typeof this._resource.resourceSize === "number" ? Number.bytesToString(this._resource.resourceSize) : "?"; + var transferSize = typeof this._resource.transferSize === "number" ? Number.bytesToString(this._resource.transferSize) : "?"; + var fromCache = this._resource.cached; + this._sizeCell.textContent = !fromCache ? resourceSize : WebInspector.UIString("(from cache)"); + if (fromCache) + this._sizeCell.addStyleClass("network-dim-cell"); + else + this._sizeCell.removeStyleClass("network-dim-cell"); + if (!fromCache) + this._appendSubtitle(this._sizeCell, transferSize); + }, + + _refreshTimeCell: function() + { + if (this._resource.duration > 0) { + this._timeCell.removeStyleClass("network-dim-cell"); + this._timeCell.textContent = Number.secondsToString(this._resource.duration); + this._appendSubtitle(this._timeCell, Number.secondsToString(this._resource.latency)); + } else { + this._timeCell.addStyleClass("network-dim-cell"); + this._timeCell.textContent = WebInspector.UIString("Pending"); + } + }, + + _appendSubtitle: function(cellElement, subtitleText) + { + var subtitleElement = document.createElement("div"); + subtitleElement.className = "network-grid-subtitle"; + subtitleElement.textContent = subtitleText; + cellElement.appendChild(subtitleElement); + }, + + refreshGraph: function(calculator) + { + var percentages = calculator.computeBarGraphPercentages(this._resource); + var labels = calculator.computeBarGraphLabels(this._resource); + + this._percentages = percentages; + + this._barAreaElement.removeStyleClass("hidden"); + + if (!this._graphElement.hasStyleClass("network-category-" + this._resource.category.name)) { + this._graphElement.removeMatchingStyleClasses("network-category-\\w+"); + this._graphElement.addStyleClass("network-category-" + this._resource.category.name); + } + + this._barLeftElement.style.setProperty("left", percentages.start + "%"); + this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%"); + + this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%"); + this._barRightElement.style.setProperty("left", percentages.middle + "%"); + + this._labelLeftElement.textContent = labels.left; + this._labelRightElement.textContent = labels.right; + + var tooltip = (labels.tooltip || ""); + this._barLeftElement.title = tooltip; + this._labelLeftElement.title = tooltip; + this._labelRightElement.title = tooltip; + this._barRightElement.title = tooltip; + }, + + _refreshLabelPositions: function() + { + this._labelLeftElement.style.removeProperty("left"); + this._labelLeftElement.style.removeProperty("right"); + this._labelLeftElement.removeStyleClass("before"); + this._labelLeftElement.removeStyleClass("hidden"); + + this._labelRightElement.style.removeProperty("left"); + this._labelRightElement.style.removeProperty("right"); + this._labelRightElement.removeStyleClass("after"); + this._labelRightElement.removeStyleClass("hidden"); + + const labelPadding = 10; + const barRightElementOffsetWidth = this._barRightElement.offsetWidth; + const barLeftElementOffsetWidth = this._barLeftElement.offsetWidth; + + if (this._barLeftElement) { + var leftBarWidth = barLeftElementOffsetWidth - labelPadding; + var rightBarWidth = (barRightElementOffsetWidth - barLeftElementOffsetWidth) - labelPadding; + } else { + var leftBarWidth = (barLeftElementOffsetWidth - barRightElementOffsetWidth) - labelPadding; + var rightBarWidth = barRightElementOffsetWidth - labelPadding; + } + + const labelLeftElementOffsetWidth = this._labelLeftElement.offsetWidth; + const labelRightElementOffsetWidth = this._labelRightElement.offsetWidth; + + const labelBefore = (labelLeftElementOffsetWidth > leftBarWidth); + const labelAfter = (labelRightElementOffsetWidth > rightBarWidth); + const graphElementOffsetWidth = this._graphElement.offsetWidth; + + if (labelBefore && (graphElementOffsetWidth * (this._percentages.start / 100)) < (labelLeftElementOffsetWidth + 10)) + var leftHidden = true; + + if (labelAfter && (graphElementOffsetWidth * ((100 - this._percentages.end) / 100)) < (labelRightElementOffsetWidth + 10)) + var rightHidden = true; + + if (barLeftElementOffsetWidth == barRightElementOffsetWidth) { + // The left/right label data are the same, so a before/after label can be replaced by an on-bar label. + if (labelBefore && !labelAfter) + leftHidden = true; + else if (labelAfter && !labelBefore) + rightHidden = true; + } + + if (labelBefore) { + if (leftHidden) + this._labelLeftElement.addStyleClass("hidden"); + this._labelLeftElement.style.setProperty("right", (100 - this._percentages.start) + "%"); + this._labelLeftElement.addStyleClass("before"); + } else { + this._labelLeftElement.style.setProperty("left", this._percentages.start + "%"); + this._labelLeftElement.style.setProperty("right", (100 - this._percentages.middle) + "%"); + } + + if (labelAfter) { + if (rightHidden) + this._labelRightElement.addStyleClass("hidden"); + this._labelRightElement.style.setProperty("left", this._percentages.end + "%"); + this._labelRightElement.addStyleClass("after"); + } else { + this._labelRightElement.style.setProperty("left", this._percentages.middle + "%"); + this._labelRightElement.style.setProperty("right", (100 - this._percentages.end) + "%"); + } + } +} + +WebInspector.NetworkDataGridNode.URLComparator = function(a, b) +{ + var aFileName = a._resource.displayName + (a._resource.queryString ? a._resource.queryString : ""); + var bFileName = b._resource.displayName + (b._resource.queryString ? b._resource.queryString : ""); + if (aFileName > bFileName) + return 1; + if (bFileName > aFileName) + return -1; + return 0; +} + +WebInspector.NetworkDataGridNode.ResourcePropertyComparator = function(propertyName, a, b) +{ + var aValue = a._resource[propertyName]; + var bValue = b._resource[propertyName]; + if (aValue > bValue) + return 1; + if (bValue > aValue) + return -1; + return 0; +} + +WebInspector.NetworkDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; diff --git a/WebCore/inspector/front-end/ResourceCategory.js b/WebCore/inspector/front-end/ResourceCategory.js index 6e94265..84f2cf9 100644 --- a/WebCore/inspector/front-end/ResourceCategory.js +++ b/WebCore/inspector/front-end/ResourceCategory.js @@ -28,12 +28,19 @@ WebInspector.ResourceCategory = function(name, title, color) { - WebInspector.AbstractTimelineCategory.call(this, name, title, color); + this.name = name; + this.title = title; + this.color = color; this.resources = []; } WebInspector.ResourceCategory.prototype = { + toString: function() + { + return this.title; + }, + addResource: function(resource) { var a = resource; @@ -61,5 +68,3 @@ WebInspector.ResourceCategory.prototype = { this.resources = []; } } - -WebInspector.ResourceCategory.prototype.__proto__ = WebInspector.AbstractTimelineCategory.prototype; diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index f329b1a..aa021ff 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -29,7 +29,10 @@ WebInspector.ResourcesPanel = function() { - WebInspector.AbstractTimelinePanel.call(this, "resources"); + WebInspector.Panel.call(this, "resources"); + + this._items = []; + this._staleItems = []; this._createPanelEnabler(); @@ -82,6 +85,299 @@ WebInspector.ResourcesPanel.prototype = { return (this.itemsGraphsElement.hasStyleClass("filter-all") || this.itemsGraphsElement.hasStyleClass("filter-" + categoryName.toLowerCase())); }, + get items() + { + return this._items; + }, + + createInterface: function() + { + this.containerElement = document.createElement("div"); + this.containerElement.id = "resources-container"; + this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false); + this.element.appendChild(this.containerElement); + + this.createSidebar(this.containerElement, this.element); + this.sidebarElement.id = "resources-sidebar"; + this.populateSidebar(); + + this._containerContentElement = document.createElement("div"); + this._containerContentElement.id = "resources-container-content"; + this.containerElement.appendChild(this._containerContentElement); + + this.summaryBar = new WebInspector.SummaryBar(this.categories); + this.summaryBar.element.id = "resources-summary"; + this._containerContentElement.appendChild(this.summaryBar.element); + + this._timelineGrid = new WebInspector.TimelineGrid(); + this._containerContentElement.appendChild(this._timelineGrid.element); + this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement; + }, + + createFilterPanel: function() + { + this.filterBarElement = document.createElement("div"); + this.filterBarElement.id = "resources-filter"; + this.filterBarElement.className = "scope-bar"; + this.element.appendChild(this.filterBarElement); + + function createFilterElement(category) + { + if (category === "all") + var label = WebInspector.UIString("All"); + else if (this.categories[category]) + var label = this.categories[category].title; + + var categoryElement = document.createElement("li"); + categoryElement.category = category; + categoryElement.addStyleClass(category); + categoryElement.appendChild(document.createTextNode(label)); + categoryElement.addEventListener("click", this._updateFilter.bind(this), false); + this.filterBarElement.appendChild(categoryElement); + + return categoryElement; + } + + this.filterAllElement = createFilterElement.call(this, "all"); + + // Add a divider + var dividerElement = document.createElement("div"); + dividerElement.addStyleClass("divider"); + this.filterBarElement.appendChild(dividerElement); + + for (var category in this.categories) + createFilterElement.call(this, category); + }, + + showCategory: function(category) + { + var filterClass = "filter-" + category.toLowerCase(); + this.itemsGraphsElement.addStyleClass(filterClass); + this.itemsTreeElement.childrenListElement.addStyleClass(filterClass); + }, + + hideCategory: function(category) + { + var filterClass = "filter-" + category.toLowerCase(); + this.itemsGraphsElement.removeStyleClass(filterClass); + this.itemsTreeElement.childrenListElement.removeStyleClass(filterClass); + }, + + filter: function(target, selectMultiple) + { + function unselectAll() + { + for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) { + var child = this.filterBarElement.childNodes[i]; + if (!child.category) + continue; + + child.removeStyleClass("selected"); + this.hideCategory(child.category); + } + } + + if (target === this.filterAllElement) { + if (target.hasStyleClass("selected")) { + // We can't unselect All, so we break early here + return; + } + + // If All wasn't selected, and now is, unselect everything else. + unselectAll.call(this); + } else { + // Something other than All is being selected, so we want to unselect All. + if (this.filterAllElement.hasStyleClass("selected")) { + this.filterAllElement.removeStyleClass("selected"); + this.hideCategory("all"); + } + } + + if (!selectMultiple) { + // If multiple selection is off, we want to unselect everything else + // and just select ourselves. + unselectAll.call(this); + + target.addStyleClass("selected"); + this.showCategory(target.category); + return; + } + + if (target.hasStyleClass("selected")) { + // If selectMultiple is turned on, and we were selected, we just + // want to unselect ourselves. + target.removeStyleClass("selected"); + this.hideCategory(target.category); + } else { + // If selectMultiple is turned on, and we weren't selected, we just + // want to select ourselves. + target.addStyleClass("selected"); + this.showCategory(target.category); + } + }, + + _updateFilter: function(e) + { + var isMac = WebInspector.isMac(); + var selectMultiple = false; + if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + + this.filter(e.target, selectMultiple); + + // When we are updating our filtering, scroll to the top so we don't end up + // in blank graph under all the resources. + this.containerElement.scrollTop = 0; + + var searchField = document.getElementById("search"); + WebInspector.doPerformSearch(searchField.value, WebInspector.shortSearchWasForcedByKeyEvent, false, true); + }, + + _updateDividersLabelBarPosition: function() + { + const scrollTop = this.containerElement.scrollTop; + const offsetHeight = this.summaryBar.element.offsetHeight; + const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop); + this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop); + }, + + get needsRefresh() + { + return this._needsRefresh; + }, + + set needsRefresh(x) + { + if (this._needsRefresh === x) + return; + + this._needsRefresh = x; + + if (x) { + if (this.visible && !("_refreshTimeout" in this)) + this._refreshTimeout = setTimeout(this.refresh.bind(this), 500); + } else { + if ("_refreshTimeout" in this) { + clearTimeout(this._refreshTimeout); + delete this._refreshTimeout; + } + } + }, + + refreshIfNeeded: function() + { + if (this.needsRefresh) + this.refresh(); + }, + + resize: function() + { + WebInspector.Panel.prototype.resize.call(this); + + this.updateGraphDividersIfNeeded(); + }, + + invalidateAllItems: function() + { + this._staleItems = this._items.slice(); + }, + + get calculator() + { + return this._calculator; + }, + + set calculator(x) + { + if (!x || this._calculator === x) + return; + + this._calculator = x; + this._calculator.reset(); + + this._staleItems = this._items.slice(); + this.refresh(); + }, + + addItem: function(item) + { + this._items.push(item); + this.refreshItem(item); + }, + + removeItem: function(item) + { + this._items.remove(item, true); + + if (item._itemsTreeElement) { + this.itemsTreeElement.removeChild(item._itemsTreeElement); + this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement); + } + + delete item._itemsTreeElement; + this.adjustScrollPosition(); + }, + + refreshItem: function(item) + { + this._staleItems.push(item); + this.needsRefresh = true; + }, + + revealAndSelectItem: function(item) + { + if (item._itemsTreeElement) { + item._itemsTreeElement.reveal(); + item._itemsTreeElement.select(true); + } + }, + + sortItems: function(sortingFunction) + { + var sortedElements = [].concat(this.itemsTreeElement.children); + sortedElements.sort(sortingFunction); + + var sortedElementsLength = sortedElements.length; + for (var i = 0; i < sortedElementsLength; ++i) { + var treeElement = sortedElements[i]; + if (treeElement === this.itemsTreeElement.children[i]) + continue; + + var wasSelected = treeElement.selected; + this.itemsTreeElement.removeChild(treeElement); + this.itemsTreeElement.insertChild(treeElement, i); + if (wasSelected) + treeElement.select(true); + + var graphElement = treeElement._itemGraph.graphElement; + this.itemsGraphsElement.insertBefore(graphElement, this.itemsGraphsElement.children[i]); + } + }, + + adjustScrollPosition: function() + { + // Prevent the container from being scrolled off the end. + if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight) + this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight); + }, + + addEventDivider: function(divider) + { + this._timelineGrid.addEventDivider(divider); + }, + + hideEventDividers: function() + { + this._timelineGrid.hideEventDividers(); + }, + + showEventDividers: function() + { + this._timelineGrid.showEventDividers(); + }, + populateSidebar: function() { this.timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); @@ -223,7 +519,10 @@ WebInspector.ResourcesPanel.prototype = { show: function() { - WebInspector.AbstractTimelinePanel.prototype.show.call(this); + WebInspector.Panel.prototype.show.call(this); + + this._updateDividersLabelBarPosition(); + this.refreshIfNeeded(); var visibleView = this.visibleView; if (this.visibleResource) { @@ -329,7 +628,44 @@ WebInspector.ResourcesPanel.prototype = { refresh: function() { - WebInspector.AbstractTimelinePanel.prototype.refresh.call(this); + this.needsRefresh = false; + + var staleItemsLength = this._staleItems.length; + + var boundariesChanged = false; + + for (var i = 0; i < staleItemsLength; ++i) { + var item = this._staleItems[i]; + if (!item._itemsTreeElement) { + // Create the timeline tree element and graph. + item._itemsTreeElement = this.createItemTreeElement(item); + item._itemsTreeElement._itemGraph = this.createItemGraph(item); + + this.itemsTreeElement.appendChild(item._itemsTreeElement); + this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement); + } + + if (item._itemsTreeElement.refresh) + item._itemsTreeElement.refresh(); + + if (this.calculator.updateBoundaries(item)) + boundariesChanged = true; + } + + if (boundariesChanged) { + // The boundaries changed, so all item graphs are stale. + this._staleItems = this._items.slice(); + staleItemsLength = this._staleItems.length; + } + + + const isBarOpaqueAtLeft = this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.isBarOpaqueAtLeft; + for (var i = 0; i < staleItemsLength; ++i) + this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator, isBarOpaqueAtLeft); + + this._staleItems = []; + + this.updateGraphDividersIfNeeded(); this._sortResourcesIfNeeded(); this._updateSummaryGraph(); @@ -373,7 +709,28 @@ WebInspector.ResourcesPanel.prototype = { } } - WebInspector.AbstractTimelinePanel.prototype.reset.call(this); + // Begin reset timeline + this.containerElement.scrollTop = 0; + + if (this._calculator) + this._calculator.reset(); + + if (this._items) { + var itemsLength = this._items.length; + for (var i = 0; i < itemsLength; ++i) { + var item = this._items[i]; + delete item._itemsTreeElement; + } + } + + this._items = []; + this._staleItems = []; + + this.itemsTreeElement.removeChildren(); + this.itemsGraphsElement.removeChildren(); + + this.updateGraphDividersIfNeeded(true); + // End reset timeline. this.mainResourceLoadTime = -1; this.mainResourceDOMContentTime = -1; @@ -585,7 +942,12 @@ WebInspector.ResourcesPanel.prototype = { updateGraphDividersIfNeeded: function(force) { - var proceed = WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded.call(this, force); + var proceed = true; + if (!this.visible) { + this.needsRefresh = true; + proceed = false; + } else + proceed = this._timelineGrid.updateDividers(force, this.calculator); if (!proceed) return; @@ -739,8 +1101,7 @@ WebInspector.ResourcesPanel.prototype = { updateMainViewWidth: function(width) { this.viewsContainerElement.style.left = width + "px"; - - WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth.call(this, width); + this._containerContentElement.style.left = width + "px"; this.resize(); }, @@ -918,16 +1279,86 @@ WebInspector.ResourcesPanel.prototype = { } } -WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.AbstractTimelinePanel.prototype; +WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype; WebInspector.getResourceContent = function(identifier, callback) { InspectorBackend.getResourceContent(identifier, callback); } +WebInspector.ResourceBaseCalculator = function() +{ +} + +WebInspector.ResourceBaseCalculator.prototype = { + computeSummaryValues: function(items) + { + var total = 0; + var categoryValues = {}; + + var itemsLength = items.length; + for (var i = 0; i < itemsLength; ++i) { + var item = items[i]; + var value = this._value(item); + if (typeof value === "undefined") + continue; + if (!(item.category.name in categoryValues)) + categoryValues[item.category.name] = 0; + categoryValues[item.category.name] += value; + total += value; + } + + return {categoryValues: categoryValues, total: total}; + }, + + computeBarGraphPercentages: function(item) + { + return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100}; + }, + + computeBarGraphLabels: function(item) + { + const label = this.formatValue(this._value(item)); + return {left: label, right: label, tooltip: label}; + }, + + get boundarySpan() + { + return this.maximumBoundary - this.minimumBoundary; + }, + + updateBoundaries: function(item) + { + this.minimumBoundary = 0; + + var value = this._value(item); + if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { + this.maximumBoundary = value; + return true; + } + return false; + }, + + reset: function() + { + delete this.minimumBoundary; + delete this.maximumBoundary; + }, + + _value: function(item) + { + return 0; + }, + + formatValue: function(value) + { + return value.toString(); + } +} + WebInspector.ResourceTimeCalculator = function(startAtZero) { - WebInspector.AbstractTimelineCalculator.call(this); + WebInspector.ResourceBaseCalculator.call(this); this.startAtZero = startAtZero; } @@ -1092,7 +1523,7 @@ WebInspector.ResourceTimeCalculator.prototype = { } } -WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype; +WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.ResourceBaseCalculator.prototype; WebInspector.ResourceTransferTimeCalculator = function() { @@ -1139,7 +1570,7 @@ WebInspector.ResourceTransferDurationCalculator.prototype.__proto__ = WebInspect WebInspector.ResourceTransferSizeCalculator = function() { - WebInspector.AbstractTimelineCalculator.call(this); + WebInspector.ResourceBaseCalculator.call(this); } WebInspector.ResourceTransferSizeCalculator.prototype = { @@ -1186,7 +1617,7 @@ WebInspector.ResourceTransferSizeCalculator.prototype = { } } -WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype; +WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.ResourceBaseCalculator.prototype; WebInspector.ResourceSidebarTreeElement = function(resource) { diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 715339d..8283528 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -104,7 +104,6 @@ WebInspector.ScriptsPanel = function() this.sidebarButtonsElement.appendChild(this.stepOutButton); this.toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate all breakpoints."), "toggle-breakpoints"); - // Breakpoints should be activated by default, so emulate a click to toggle on. this.toggleBreakpointsButton.toggled = true; this.toggleBreakpointsButton.addEventListener("click", this.toggleBreakpointsClicked.bind(this), false); this.sidebarButtonsElement.appendChild(this.toggleBreakpointsButton.element); @@ -133,8 +132,13 @@ WebInspector.ScriptsPanel = function() this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); this.sidebarPanes.jsBreakpoints = WebInspector.createJSBreakpointsSidebarPane(); - if (Preferences.domBreakpointsEnabled) + if (Preferences.nativeInstrumentationEnabled) { this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane(); + this.sidebarPanes.domBreakpoints.expanded = true; + this.sidebarPanes.xhrBreakpoints = WebInspector.createXHRBreakpointsSidebarPane(); + this.sidebarPanes.xhrBreakpoints.expanded = true; + } + this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane(); for (var pane in this.sidebarPanes) @@ -145,8 +149,6 @@ WebInspector.ScriptsPanel = function() this.sidebarPanes.scopechain.expanded = true; this.sidebarPanes.jsBreakpoints.expanded = true; - if (Preferences.domBreakpointsEnabled) - this.sidebarPanes.domBreakpoints.expanded = true; var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel."); var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower."); @@ -387,8 +389,8 @@ WebInspector.ScriptsPanel.prototype = { this.sidebarPanes.callstack.update(details.callFrames, this._sourceIDMap); this.sidebarPanes.callstack.selectedCallFrame = details.callFrames[0]; - if (details.status) - this.sidebarPanes.callstack.updateStatus(details.status); + if ("eventType" in details) + this.sidebarPanes.callstack.updateStatus(details.eventType, details.eventData); WebInspector.currentPanel = this; window.focus(); @@ -467,8 +469,10 @@ WebInspector.ScriptsPanel.prototype = { this.sidebarPanes.watchExpressions.refreshExpressions(); if (!preserveItems) { this.sidebarPanes.jsBreakpoints.reset(); - if (Preferences.domBreakpointsEnabled) + if (Preferences.nativeInstrumentationEnabled) { this.sidebarPanes.domBreakpoints.reset(); + this.sidebarPanes.xhrBreakpoints.reset(); + } this.sidebarPanes.workers.reset(); } }, @@ -891,7 +895,7 @@ WebInspector.ScriptsPanel.prototype = { _togglePauseOnExceptions: function() { - InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states); + InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states, this.updatePauseOnExceptionsState.bind(this)); }, _togglePause: function() @@ -998,6 +1002,9 @@ WebInspector.ScriptsPanel.prototype = { this._shortcuts[shortcut2.key] = handler; section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step out")); + shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor("g", platformSpecificModifier); + this._shortcuts[shortcut1.key] = this.showGoToLineDialog.bind(this); + section.addAlternateKeys([ shortcut1.name ], WebInspector.UIString("Go to Line")); this.sidebarPanes.callstack.registerShortcuts(section); }, @@ -1067,6 +1074,13 @@ WebInspector.ScriptsPanel.prototype = { this._searchView.jumpToLastSearchResult(); else this._searchView.jumpToPreviousSearchResult(); + }, + + showGoToLineDialog: function(e) + { + var view = this.visibleView; + if (view) + WebInspector.GoToLineDialog.show(view); } } diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index 63f2641..c6da14d 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -42,10 +42,10 @@ var Preferences = { showColorNicknames: true, debuggerAlwaysEnabled: false, profilerAlwaysEnabled: false, - auditsPanelEnabled: true, onlineDetectionEnabled: true, - domBreakpointsEnabled: false, - resourceExportEnabled: false + nativeInstrumentationEnabled: false, + resourceExportEnabled: false, + networkPanelEnabled: false } WebInspector.Settings = function(sessionScope) diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index a9033f2..aecd57b 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -498,7 +498,8 @@ WebInspector.SourceFrame.prototype = { self._hidePopup(); delete self._hidePopupTimer; } - this._hidePopupTimer = setTimeout(doHide, 500); + if (!("_hidePopupTimer" in this)) + this._hidePopupTimer = setTimeout(doHide, 500); } this._hoverElement = event.target; diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index c222f0e..11382cd 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -1,7 +1,6 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource prefix="/webkit/inspector"> <file>inspector.html</file> - <file>AbstractTimelinePanel.js</file> <file>ApplicationCacheItemsView.js</file> <file>AuditCategories.js</file> <file>AuditFormatters.js</file> @@ -42,6 +41,7 @@ <file>ExtensionRegistryStub.js</file> <file>ExtensionServer.js</file> <file>FontView.js</file> + <file>GoToLineDialog.js</file> <file>HAREntry.js</file> <file>HeapSnapshotView.js</file> <file>HelpScreen.js</file> @@ -53,6 +53,7 @@ <file>InspectorFrontendHostStub.js</file> <file>KeyboardShortcut.js</file> <file>MetricsSidebarPane.js</file> + <file>NetworkPanel.js</file> <file>Object.js</file> <file>ObjectPropertiesSection.js</file> <file>Panel.js</file> @@ -106,10 +107,12 @@ <file>WelcomeView.js</file> <file>WorkersSidebarPane.js</file> <file>audits.css</file> + <file>goToLineDialog.css</file> <file>heapProfiler.css</file> <file>helpScreen.css</file> <file>inspector.css</file> <file>inspectorSyntaxHighlight.css</file> + <file>networkPanel.css</file> <file>popover.css</file> <file>textViewer.css</file> <file>Images/applicationCache.png</file> @@ -164,7 +167,9 @@ <file>Images/grayConnectorPoint.png</file> <file>Images/largerResourcesButtonGlyph.png</file> <file>Images/localStorage.png</file> + <file>Images/networkIcon.png</file> <file>Images/nodeSearchButtonGlyph.png</file> + <file>Images/paneAddButtons.png</file> <file>Images/paneBottomGrow.png</file> <file>Images/paneBottomGrowActive.png</file> <file>Images/paneGrowHandleLine.png</file> diff --git a/WebCore/inspector/front-end/goToLineDialog.css b/WebCore/inspector/front-end/goToLineDialog.css new file mode 100644 index 0000000..725e4c8 --- /dev/null +++ b/WebCore/inspector/front-end/goToLineDialog.css @@ -0,0 +1,39 @@ +.go-to-line-dialog { + position: absolute; + top: 40%; + left: 40%; + z-index: 1900; + + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#E9E9E9), to(#CFCFCF)); + display: -webkit-box; + -webkit-box-orient: vertical; + padding: 10px; + border-radius: 10px; + border: 1px solid gray; + -webkit-box-shadow: rgb(40,40,40) 0px 0px 50px; + + font-size: 11px; + font-family: 'Lucida Grande', sans-serif; +} + +.go-to-line-dialog input { + font-size: 11px; +} + +.go-to-line-dialog button { + font-size: 11px; + color: rgb(6, 6, 6); + border: 1px solid rgb(165, 165, 165); + background-color: rgb(237, 237, 237); + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223))); + -webkit-border-radius: 12px; + -webkit-appearance: none; + + padding: 3px 20px; + margin: 0 0 0 10px; +} + +.go-to-line-dialog button:active { + background-color: rgb(215, 215, 215); + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239))); +} diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index 6d8571c..848afdc 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -207,6 +207,10 @@ body.attached #search-results-matches { background-image: url(Images/resourcesIcon.png); } +.toolbar-item.network .toolbar-icon { + background-image: url(Images/networkIcon.png); +} + .toolbar-item.scripts .toolbar-icon { background-image: url(Images/scriptsIcon.png); } @@ -1677,6 +1681,29 @@ li.editing .swatch, li.editing .enabled-button, li.editing-sub-part .delete-but color: black; } +.pane > .title > button.add { + float: right; + width: 23px; + height: 17px; + color: transparent; + background-color: transparent; + border: none; + background-image: url(Images/paneAddButtons.png); + background-repeat: no-repeat; + margin: 1px 0 0 0; + padding: 0; + -webkit-border-radius: 0; + -webkit-appearance: none; +} + +.pane > .title > button.add:hover { + background-position: -23px 0px; +} + +.pane > .title > button.add:active { + background-position: -46px 0px; +} + .pane > .body { position: relative; display: none; @@ -1701,6 +1728,14 @@ li.editing .swatch, li.editing .enabled-button, li.editing-sub-part .delete-but display: block; } +.pane > .body .breakpoint-condition { + display: block; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 25px; + margin-right: 10px; +} + .pane.expanded:nth-last-of-type(1) { border-bottom: 1px solid rgb(189, 189, 189); } @@ -1950,8 +1985,6 @@ body.inactive .sidebar { padding-right: 14px; overflow-x: hidden; overflow-y: overlay; - background-image: -webkit-gradient(linear, left top, left bottom, from(white), color-stop(0.5, white), color-stop(0.5, rgb(234, 243, 255)), to(rgb(234, 243, 255))); - -webkit-background-size: 1px 32px; } .data-grid.inline .data-container { diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index 0536ee6..949b18f 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -30,9 +30,11 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="audits.css"> + <link rel="stylesheet" type="text/css" href="goToLineDialog.css"> <link rel="stylesheet" type="text/css" href="heapProfiler.css"> <link rel="stylesheet" type="text/css" href="inspector.css"> <link rel="stylesheet" type="text/css" href="inspectorSyntaxHighlight.css"> + <link rel="stylesheet" type="text/css" href="networkPanel.css"> <link rel="stylesheet" type="text/css" href="popover.css"> <link rel="stylesheet" type="text/css" href="textViewer.css"> <script type="text/javascript" src="utilities.js"></script> @@ -58,7 +60,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="ConsoleView.js"></script> <script type="text/javascript" src="Panel.js"></script> <script type="text/javascript" src="TimelineGrid.js"></script> - <script type="text/javascript" src="AbstractTimelinePanel.js"></script> <script type="text/javascript" src="Resource.js"></script> <script type="text/javascript" src="ResourceCategory.js"></script> <script type="text/javascript" src="Database.js"></script> @@ -92,6 +93,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StatusBarButton.js"></script> <script type="text/javascript" src="SummaryBar.js"></script> <script type="text/javascript" src="ElementsPanel.js"></script> + <script type="text/javascript" src="NetworkPanel.js"></script> <script type="text/javascript" src="ResourcesPanel.js"></script> <script type="text/javascript" src="InjectedFakeWorker.js"></script> <script type="text/javascript" src="ScriptsPanel.js"></script> @@ -138,6 +140,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="TimelineOverviewPane.js"></script> <script type="text/javascript" src="TestController.js"></script> <script type="text/javascript" src="HelpScreen.js"></script> + <script type="text/javascript" src="GoToLineDialog.js"></script> <script type="text/javascript" src="ShortcutsHelp.js"></script> <script type="text/javascript" src="HAREntry.js"></script> </head> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index f6fa06b..3edae8f 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -219,11 +219,24 @@ var WebInspector = { return pane; }, + createXHRBreakpointsSidebarPane: function() + { + var pane = new WebInspector.XHRBreakpointsSidebarPane(); + function breakpointAdded(event) + { + pane.addBreakpoint(new WebInspector.XHRBreakpointItem(event.data)); + } + WebInspector.breakpointManager.addEventListener("xhr-breakpoint-added", breakpointAdded); + return pane; + }, + _createPanels: function() { var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(','); if (hiddenPanels.indexOf("elements") === -1) this.panels.elements = new WebInspector.ElementsPanel(); + if (Preferences.networkPanelEnabled && hiddenPanels.indexOf("network") === -1) + this.panels.network = new WebInspector.NetworkPanel(); if (hiddenPanels.indexOf("resources") === -1) this.panels.resources = new WebInspector.ResourcesPanel(); if (hiddenPanels.indexOf("scripts") === -1) @@ -238,7 +251,7 @@ var WebInspector = { } if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1) this.panels.storage = new WebInspector.StoragePanel(); - if (Preferences.auditsPanelEnabled && hiddenPanels.indexOf("audits") === -1) + if (hiddenPanels.indexOf("audits") === -1) this.panels.audits = new WebInspector.AuditsPanel(); if (hiddenPanels.indexOf("console") === -1) this.panels.console = new WebInspector.ConsolePanel(); @@ -435,12 +448,8 @@ var WebInspector = { _updateFocusedNode: function(nodeId) { - var node = WebInspector.domAgent.nodeForId(nodeId); - if (!node) - return; - this.currentPanel = this.panels.elements; - this.panels.elements.focusedDOMNode = node; + this.panels.elements.updateFocusedNode(nodeId); } } @@ -585,6 +594,8 @@ WebInspector.doLoadedDone = function() function populateInspectorState(inspectorState) { WebInspector.monitoringXHREnabled = inspectorState.monitoringXHREnabled; + if ("pauseOnExceptionsState" in inspectorState) + WebInspector.panels.scripts.updatePauseOnExceptionsState(inspectorState.pauseOnExceptionsState); if (inspectorState.resourceTrackingEnabled) WebInspector.panels.resources.resourceTrackingWasEnabled(); else @@ -677,8 +688,8 @@ WebInspector.dispatchMessageFromBackend = function(messageObject) WebInspector.reportProtocolError = function(messageObject) { console.error("Protocol Error: InspectorBackend request with seq = %d failed.", messageObject.seq); - for (var error in messageObject.errors) - console.error(" " + error); + for (var i = 0; i < messageObject.errors.length; ++i) + console.error(" " + messageObject.errors[i]); WebInspector.removeResponseCallbackEntry(messageObject.seq); } @@ -1216,10 +1227,10 @@ WebInspector.updateResource = function(payload) resource = new WebInspector.Resource(identifier, payload.url); this.resources[identifier] = resource; this.resourceURLMap[resource.url] = resource; - if (this.panels.resources) - this.panels.resources.addResource(resource); - if (this.panels.audits) - this.panels.audits.resourceStarted(resource); + this.panels.resources.addResource(resource); + this.panels.audits.resourceStarted(resource); + if (this.panels.network) + this.panels.network.addResource(resource); } if (payload.didRequestChange) { @@ -1261,13 +1272,11 @@ WebInspector.updateResource = function(payload) resource.webSocketChallengeResponse = payload.webSocketChallengeResponse; } - if (payload.didTypeChange) { + if (payload.didTypeChange) resource.type = payload.type; - } - if (payload.didLengthChange) { + if (payload.didLengthChange) resource.resourceSize = payload.resourceSize; - } if (payload.didCompletionChange) { resource.failed = payload.failed; @@ -1289,21 +1298,24 @@ WebInspector.updateResource = function(payload) // This loadEventTime is for the main resource, and we want to show it // for all resources on this page. This means we want to set it as a member // of the resources panel instead of the individual resource. - if (this.panels.resources) - this.panels.resources.mainResourceLoadTime = payload.loadEventTime; - if (this.panels.audits) - this.panels.audits.mainResourceLoadTime = payload.loadEventTime; + this.panels.resources.mainResourceLoadTime = payload.loadEventTime; + this.panels.audits.mainResourceLoadTime = payload.loadEventTime; + if (this.panels.network) + this.panels.network.mainResourceLoadTime = payload.loadEventTime; } if (payload.domContentEventTime) { // This domContentEventTime is for the main resource, so it should go in // the resources panel for the same reasons as above. - if (this.panels.resources) - this.panels.resources.mainResourceDOMContentTime = payload.domContentEventTime; - if (this.panels.audits) - this.panels.audits.mainResourceDOMContentTime = payload.domContentEventTime; + this.panels.resources.mainResourceDOMContentTime = payload.domContentEventTime; + this.panels.audits.mainResourceDOMContentTime = payload.domContentEventTime; + if (this.panels.network) + this.panels.network.mainResourceDOMContentTime = payload.domContentEventTime; } } + + if (this.panels.network) + this.panels.network.refreshResource(resource); } WebInspector.removeResource = function(identifier) @@ -1402,11 +1414,6 @@ WebInspector.debuggerWasEnabled = function() this.panels.scripts.debuggerWasEnabled(); } -WebInspector.updatePauseOnExceptionsState = function(pauseOnExceptionsState) -{ - this.panels.scripts.updatePauseOnExceptionsState(pauseOnExceptionsState); -} - WebInspector.debuggerWasDisabled = function() { this.panels.scripts.debuggerWasDisabled(); diff --git a/WebCore/inspector/front-end/networkPanel.css b/WebCore/inspector/front-end/networkPanel.css new file mode 100644 index 0000000..cdea7fe --- /dev/null +++ b/WebCore/inspector/front-end/networkPanel.css @@ -0,0 +1,383 @@ +.network-larger-resources-status-bar-item .glyph {
+ -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png);
+}
+
+.network.panel .data-grid {
+ border: none;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ font-size: 11px;
+}
+
+.network.panel .data-grid table.data {
+ -webkit-background-size: 1px 82px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, 0.05)), to(rgba(0, 0, 0, 0.05)));
+ font-size: 11px;
+}
+
+.network.panel .data-grid.small table.data {
+ -webkit-background-size: 1px 42px;
+}
+
+.network.panel .data-grid td {
+ line-height: 17px;
+ border-right: 1px solid rgb(210, 210, 210);
+ -webkit-user-select: none;
+}
+
+.network.panel .data-grid th {
+ border-bottom: 1px solid rgb(64%, 64%, 64%);
+ height: 22px;
+}
+
+.network.panel .data-grid th, .network.panel .data-grid th.sort-descending, .network.panel .data-grid th.sort-ascending {
+ background: -webkit-gradient(linear, left top, left bottom, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
+}
+
+.network.panel .data-grid .data-container {
+ top: 23px;
+}
+
+.network.panel .data-grid td.url-column {
+ font-weight: bold;
+}
+
+.network.panel .data-grid td.optional-column {
+ background-color: rgba(0, 0, 0, 0.07);
+}
+
+.network.panel .small .network-graph-side {
+ height: 14px;
+}
+
+.network.panel .data-grid th.sortable:active {
+ background-image: none;
+}
+
+.network-grid-subtitle {
+ font-weight: normal;
+ color: grey;
+}
+
+.network.panel .data-grid.small .network-grid-subtitle {
+ display: none;
+}
+
+/* Resource preview icons */
+
+.network.panel .data-grid .icon {
+ content: url(Images/resourcePlainIcon.png);
+}
+
+.network.panel .data-grid.small .icon {
+ content: url(Images/resourcePlainIconSmall.png);
+}
+
+.network.panel .network-category-scripts .icon {
+ content: url(Images/resourceJSIcon.png);
+}
+
+.network.panel .data-grid.small .network-category-scripts .icon {
+ content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.network.panel .network-category-documents .icon {
+ content: url(Images/resourceDocumentIcon.png);
+}
+
+.network.panel .data-grid.small .network-category-documents .icon {
+ content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.network.panel .network-category-stylesheets .icon {
+ content: url(Images/resourceCSSIcon.png);
+}
+
+.network.panel .data-grid.small .network-category-stylesheets .icon {
+ content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.network.panel .network-category-images .icon {
+ position: relative;
+ background-image: url(Images/resourcePlainIcon.png);
+ background-repeat: no-repeat;
+ content: "";
+}
+
+.network.panel .network-category-images .icon {
+ position: relative;
+ background-image: url(Images/resourcePlainIcon.png);
+ background-repeat: no-repeat;
+ content: "";
+}
+
+.network.panel .data-grid.small .network-category-images .icon {
+ background-image: url(Images/resourcePlainIconSmall.png);
+ content: "";
+}
+
+.network.panel .data-grid .icon {
+ float: left;
+ width: 32px;
+ height: 32px;
+ margin-top: 1px;
+ margin-right: 3px;
+}
+
+.network.panel .data-grid.small .icon {
+ width: 16px;
+ height: 16px;
+}
+
+.network.panel .image-network-icon-preview {
+ position: absolute;
+ margin: auto;
+ top: 3px;
+ bottom: 4px;
+ left: 5px;
+ right: 5px;
+ max-width: 18px;
+ max-height: 21px;
+ min-width: 1px;
+ min-height: 1px;
+}
+
+.network.panel .data-grid.small .image-network-icon-preview {
+ top: 2px;
+ bottom: 1px;
+ left: 3px;
+ right: 3px;
+ max-width: 8px;
+ max-height: 11px;
+}
+
+/* Graph styles */
+
+.network-graph-side {
+ position: relative;
+ height: 36px;
+ padding: 0 5px;
+ white-space: nowrap;
+ margin-top: 1px;
+ border-top: 1px solid transparent;
+ overflow: hidden;
+}
+
+.network-graph-bar-area {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ right: 8px;
+ left: 9px;
+}
+
+.network-graph-label {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ margin: auto -7px;
+ height: 13px;
+ line-height: 13px;
+ font-size: 9px;
+ color: rgba(0, 0, 0, 0.75);
+ text-shadow: rgba(255, 255, 255, 0.25) 1px 0 0, rgba(255, 255, 255, 0.25) -1px 0 0, rgba(255, 255, 255, 0.333) 0 1px 0, rgba(255, 255, 255, 0.25) 0 -1px 0;
+ z-index: 150;
+ overflow: hidden;
+ text-align: center;
+ font-weight: bold;
+ opacity: 0;
+ -webkit-transition: opacity 250ms ease-in-out;
+}
+
+.network-graph-side:hover .network-graph-label {
+ opacity: 1;
+}
+
+.network-graph-label:empty {
+ display: none;
+}
+
+.network-graph-label.waiting {
+ margin-right: 5px;
+}
+
+.network-graph-label.waiting-right {
+ margin-left: 5px;
+}
+
+.network-graph-label.before {
+ color: rgba(0, 0, 0, 0.7);
+ text-shadow: none;
+ text-align: right;
+ margin-right: 2px;
+}
+
+.network-graph-label.before::after {
+ padding-left: 2px;
+ height: 6px;
+ content: url(Images/graphLabelCalloutLeft.png);
+}
+
+.network-graph-label.after {
+ color: rgba(0, 0, 0, 0.7);
+ text-shadow: none;
+ text-align: left;
+ margin-left: 2px;
+}
+
+.network-graph-label.after::before {
+ padding-right: 2px;
+ height: 6px;
+ content: url(Images/graphLabelCalloutRight.png);
+}
+
+.network-graph-bar {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ margin: auto -7px;
+ border-width: 6px 7px;
+ height: 13px;
+ min-width: 14px;
+ opacity: 0.65;
+ -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
+}
+
+.network-graph-bar.waiting, .network-graph-bar.waiting-right {
+ opacity: 0.35;
+}
+
+/* Resource categories */
+
+
+.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
+}
+
+.network-category-documents .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillBlue.png) 6 7 6 7;
+}
+
+.network-category-documents.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillBlue.png) 6 7 6 7;
+}
+
+.network-category-stylesheets .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillGreen.png) 6 7 6 7;
+}
+
+.network-category-stylesheets.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillGreen.png) 6 7 6 7;
+}
+
+.network-category-images .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillPurple.png) 6 7 6 7;
+}
+
+.network-category-images.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillPurple.png) 6 7 6 7;
+}
+
+.network-category-fonts .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillRed.png) 6 7 6 7;
+}
+
+.network-category-fonts.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillRed.png) 6 7 6 7;
+}
+
+.network-category-scripts .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillOrange.png) 6 7 6 7;
+}
+
+.network-category-scripts.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillOrange.png) 6 7 6 7;
+}
+
+.network-category-xhr .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillYellow.png) 6 7 6 7;
+}
+
+.network-category-xhr.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillYellow.png) 6 7 6 7;
+}
+
+.network-category-websockets .network-graph-bar {
+ -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
+}
+
+.network-category-websockets.resource-cached .network-graph-bar {
+ -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
+}
+
+
+/* Popover */
+
+.network-timing-row {
+ position: relative;
+ height: 12px;
+}
+
+.network-timing-bar {
+ position: absolute;
+ background-color: red;
+ border-left: 1px solid red;
+ opacity: 0.4;
+}
+
+.network-timing-bar-title {
+ position: absolute;
+}
+
+.network-dim-cell {
+ color: grey;
+}
+
+/* Dividers */
+
+.network-timeline-grid {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
+
+.network-event-divider-padding {
+ position: absolute;
+ width: 8px;
+ top: 0;
+ bottom: 0;
+ pointer-events: auto;
+}
+
+.network-event-divider {
+ position: absolute;
+ width: 2px;
+ top: 0;
+ bottom: 0;
+ z-index: 300;
+}
+
+.network-red-divider {
+ background-color: rgba(255, 0, 0, 0.5);
+}
+
+.network-blue-divider {
+ background-color: rgba(0, 0, 255, 0.5);
+}
+
+.network.panel .resources-dividers-label-bar {
+ background-color: transparent;
+ border: none;
+ height: 23px;
+ pointer-events: none;
+}
+
+.network.panel .resources-divider-label {
+ top: 6px;
+ color: black;
+}
diff --git a/WebCore/inspector/front-end/treeoutline.js b/WebCore/inspector/front-end/treeoutline.js index c2a3fe7..e2f879c 100644 --- a/WebCore/inspector/front-end/treeoutline.js +++ b/WebCore/inspector/front-end/treeoutline.js @@ -399,7 +399,7 @@ TreeOutline.prototype._treeKeyDown = function(event) if (nextSelectedElement) { nextSelectedElement.reveal(); - nextSelectedElement.select(); + nextSelectedElement.select(false, true); } if (handled) { @@ -794,10 +794,10 @@ TreeElement.prototype.revealed = function() TreeElement.prototype.selectOnMouseDown = function(event) { - this.select(); + this.select(false, true); } -TreeElement.prototype.select = function(supressOnSelect) +TreeElement.prototype.select = function(supressOnSelect, selectedByUser) { if (!this.treeOutline || !this.selectable || this.selected) return; @@ -812,7 +812,7 @@ TreeElement.prototype.select = function(supressOnSelect) this._listItemNode.addStyleClass("selected"); if (this.onselect && !supressOnSelect) - this.onselect(this); + this.onselect(this, selectedByUser); } TreeElement.prototype.deselect = function(supressOnDeselect) diff --git a/WebCore/loader/Cache.cpp b/WebCore/loader/Cache.cpp index dbcec00..28c9f93 100644 --- a/WebCore/loader/Cache.cpp +++ b/WebCore/loader/Cache.cpp @@ -238,11 +238,15 @@ void Cache::revalidationFailed(CachedResource* revalidatingResource) CachedResource* Cache::resourceForURL(const String& url) { CachedResource* resource = m_resources.get(url); + bool wasPurgeable = Cache::shouldMakeResourcePurgeableOnEviction() && resource && resource->isPurgeable(); if (resource && !resource->makePurgeable(false)) { ASSERT(!resource->hasClients()); evict(resource); return 0; } + // Add the size back since we had subtracted it when we marked the memory as purgeable. + if (wasPurgeable) + adjustSize(resource->hasClients(), resource->size()); return resource; } @@ -363,7 +367,9 @@ void Cache::pruneDeadResources() while (current) { CachedResource* prev = current->m_prevInAllResourcesList; if (!current->hasClients() && !current->isPreloaded() && !current->isCacheValidator()) { - evict(current); + if (!makeResourcePurgeable(current)) + evict(current); + // If evict() caused pruneDeadResources() to be re-entered, bail out. This can happen when removing an // SVG CachedImage that has subresources. if (!m_inPruneDeadResources) @@ -397,6 +403,25 @@ void Cache::setCapacities(unsigned minDeadBytes, unsigned maxDeadBytes, unsigned prune(); } +bool Cache::makeResourcePurgeable(CachedResource* resource) +{ + if (!Cache::shouldMakeResourcePurgeableOnEviction()) + return false; + + if (!resource->inCache()) + return false; + + if (!resource->isSafeToMakePurgeable()) + return false; + + if (!resource->makePurgeable(true)) + return false; + + adjustSize(resource->hasClients(), -static_cast<int>(resource->size())); + + return true; +} + void Cache::evict(CachedResource* resource) { // The resource may have already been removed by someone other than our caller, @@ -410,10 +435,10 @@ void Cache::evict(CachedResource* resource) removeFromLRUList(resource); removeFromLiveDecodedResourcesList(resource); - // Subtract from our size totals. - int delta = -static_cast<int>(resource->size()); - if (delta) - adjustSize(resource->hasClients(), delta); + // If the resource was purged, it means we had already decremented the size when we made the + // resource purgeable in makeResourcePurgeable(). + if (!Cache::shouldMakeResourcePurgeableOnEviction() || !resource->wasPurged()) + adjustSize(resource->hasClients(), -static_cast<int>(resource->size())); } else ASSERT(m_resources.get(resource->url()) != resource); @@ -725,7 +750,7 @@ void Cache::dumpStats() void Cache::dumpLRULists(bool includeLive) const { - printf("LRU-SP lists in eviction order (Kilobytes decoded, Kilobytes encoded, Access count, Referenced):\n"); + printf("LRU-SP lists in eviction order (Kilobytes decoded, Kilobytes encoded, Access count, Referenced, isPurgeable, wasPurged):\n"); int size = m_allResources.size(); for (int i = size - 1; i >= 0; i--) { @@ -734,7 +759,8 @@ void Cache::dumpLRULists(bool includeLive) const while (current) { CachedResource* prev = current->m_prevInAllResourcesList; if (includeLive || !current->hasClients()) - printf("(%.1fK, %.1fK, %uA, %dR); ", current->decodedSize() / 1024.0f, (current->encodedSize() + current->overheadSize()) / 1024.0f, current->accessCount(), current->hasClients()); + printf("(%.1fK, %.1fK, %uA, %dR, %d, %d); ", current->decodedSize() / 1024.0f, (current->encodedSize() + current->overheadSize()) / 1024.0f, current->accessCount(), current->hasClients(), current->isPurgeable(), current->wasPurged()); + current = prev; } } diff --git a/WebCore/loader/Cache.h b/WebCore/loader/Cache.h index 9d7e8be..eb5b398 100644 --- a/WebCore/loader/Cache.h +++ b/WebCore/loader/Cache.h @@ -55,6 +55,22 @@ class KURL; // -------|-----+++++++++++++++| // -------|-----+++++++++++++++|+++++ +// The behavior of the cache changes in the following way if shouldMakeResourcePurgeableOnEviction +// returns true. +// +// 1. Dead resources in the cache are kept in non-purgeable memory. +// 2. When we prune dead resources, instead of freeing them, we mark their memory as purgeable and +// keep the resources until the kernel reclaims the purgeable memory. +// +// By leaving the in-cache dead resources in dirty resident memory, we decrease the likelihood of +// the kernel claiming that memory and forcing us to refetch the resource (for example when a user +// presses back). +// +// And by having an unbounded number of resource objects using purgeable memory, we can use as much +// memory as is available on the machine. The trade-off here is that the CachedResource object (and +// its member variables) are allocated in non-purgeable TC-malloc'd memory so we would see slightly +// more memory use due to this. + class Cache : public Noncopyable { public: friend Cache* cache(); @@ -148,6 +164,8 @@ public: void addToLiveResourcesSize(CachedResource*); void removeFromLiveResourcesSize(CachedResource*); + static bool shouldMakeResourcePurgeableOnEviction(); + // Function to collect cache statistics for the caches window in the Safari Debug menu. Statistics getStatistics(); @@ -173,6 +191,7 @@ private: void pruneDeadResources(); // Flush decoded and encoded data from resources not referenced by Web pages. void pruneLiveResources(); // Flush decoded data from resources still referenced by Web pages. + bool makeResourcePurgeable(CachedResource*); void evict(CachedResource*); // Member variables. @@ -204,6 +223,15 @@ private: HashMap<String, CachedResource*> m_resources; }; +inline bool Cache::shouldMakeResourcePurgeableOnEviction() +{ +#if PLATFORM(IOS) + return true; +#else + return false; +#endif +} + // Function to obtain the global cache. Cache* cache(); diff --git a/WebCore/loader/CachedCSSStyleSheet.cpp b/WebCore/loader/CachedCSSStyleSheet.cpp index 7866efd..877cd1d 100644 --- a/WebCore/loader/CachedCSSStyleSheet.cpp +++ b/WebCore/loader/CachedCSSStyleSheet.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "CachedCSSStyleSheet.h" +#include "Cache.h" #include "CachedResourceClient.h" #include "CachedResourceClientWalker.h" #include "HTTPParsers.h" @@ -58,7 +59,7 @@ void CachedCSSStyleSheet::didAddClient(CachedResourceClient *c) void CachedCSSStyleSheet::allClientsRemoved() { - if (isSafeToMakePurgeable()) + if (!Cache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePurgeable()) makePurgeable(true); } diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp index 166fa85..ef88af8 100644 --- a/WebCore/loader/CachedFont.cpp +++ b/WebCore/loader/CachedFont.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "CachedFont.h" -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX))) || PLATFORM(HAIKU) || OS(WINCE) || PLATFORM(ANDROID) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX) || OS(FREEBSD))) || PLATFORM(HAIKU) || OS(WINCE) || PLATFORM(ANDROID) #define STORE_FONT_CUSTOM_PLATFORM_DATA #endif diff --git a/WebCore/loader/CachedImage.cpp b/WebCore/loader/CachedImage.cpp index 908c425..641ce94 100644 --- a/WebCore/loader/CachedImage.cpp +++ b/WebCore/loader/CachedImage.cpp @@ -338,7 +338,8 @@ void CachedImage::destroyDecodedData() // Invoking addClient() will reconstruct the image object. m_image = 0; setDecodedSize(0); - makePurgeable(true); + if (!Cache::shouldMakeResourcePurgeableOnEviction()) + makePurgeable(true); } else if (m_image && !errorOccurred()) m_image->destroyDecodedData(); } diff --git a/WebCore/loader/CachedScript.cpp b/WebCore/loader/CachedScript.cpp index 58895d6..1898438 100644 --- a/WebCore/loader/CachedScript.cpp +++ b/WebCore/loader/CachedScript.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "CachedScript.h" +#include "Cache.h" #include "CachedResourceClient.h" #include "CachedResourceClientWalker.h" #include "SharedBuffer.h" @@ -110,7 +111,7 @@ void CachedScript::destroyDecodedData() { m_script = String(); setDecodedSize(0); - if (isSafeToMakePurgeable()) + if (!Cache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePurgeable()) makePurgeable(true); } diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index f295663..6fb003e 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -340,7 +340,7 @@ public: virtual void didDisplayInsecureContent() { } virtual void didRunInsecureContent(SecurityOrigin*) { } virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) { return 0; } - virtual void didTransferChildFrameToNewDocument() { } + virtual void didTransferChildFrameToNewDocument(Page*) { } virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; } virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) @@ -361,6 +361,7 @@ public: virtual void didCreateScriptContextForFrame() { } virtual void didDestroyScriptContextForFrame() { } virtual void didCreateIsolatedScriptContext() { } + virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; } #endif virtual void registerForIconNotification(bool) { } @@ -550,6 +551,7 @@ public: virtual void startUpdating() { } virtual void stopUpdating() { } virtual DeviceMotionData* currentDeviceMotion() const { return 0; } + virtual void deviceMotionControllerDestroyed() { } }; class EmptyDeviceOrientationClient : public DeviceOrientationClient { @@ -558,6 +560,7 @@ public: virtual void startUpdating() { } virtual void stopUpdating() { } virtual DeviceOrientation* lastOrientation() const { return 0; } + virtual void deviceOrientationControllerDestroyed() { } }; } diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h index 427b81e..803eb11 100644 --- a/WebCore/loader/FrameLoaderClient.h +++ b/WebCore/loader/FrameLoaderClient.h @@ -64,6 +64,7 @@ namespace WebCore { class IntSize; class KURL; class NavigationAction; + class Page; class ProtectionSpace; class PluginView; class PolicyChecker; @@ -229,7 +230,7 @@ namespace WebCore { virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0; - virtual void didTransferChildFrameToNewDocument() = 0; + virtual void didTransferChildFrameToNewDocument(Page* oldPage) = 0; virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0; virtual void redirectDataToPlugin(Widget* pluginWidget) = 0; @@ -253,6 +254,7 @@ namespace WebCore { virtual void didCreateScriptContextForFrame() = 0; virtual void didDestroyScriptContextForFrame() = 0; virtual void didCreateIsolatedScriptContext() = 0; + virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) = 0; #endif virtual void registerForIconNotification(bool listen = true) = 0; diff --git a/WebCore/loader/PingLoader.cpp b/WebCore/loader/PingLoader.cpp index 2a628ce..dd00128 100644 --- a/WebCore/loader/PingLoader.cpp +++ b/WebCore/loader/PingLoader.cpp @@ -32,6 +32,7 @@ #include "config.h" #include "PingLoader.h" +#include "FormData.h" #include "Frame.h" #include "ResourceHandle.h" #include "SecurityOrigin.h" @@ -60,9 +61,40 @@ void PingLoader::loadImage(Frame* frame, const KURL& url) UNUSED_PARAM(leakedPingLoader); } +// http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing +void PingLoader::sendPing(Frame* frame, const KURL& pingURL, const KURL& destinationURL) +{ + ResourceRequest request(pingURL); + request.setTargetType(ResourceRequest::TargetIsSubresource); + request.setHTTPMethod("POST"); + request.setHTTPContentType("text/ping"); + request.setHTTPBody(FormData::create("PING")); + request.setHTTPHeaderField("Cache-Control", "max-age=0"); + frame->loader()->addExtraFieldsToSubresourceRequest(request); + + SecurityOrigin* sourceOrigin = frame->document()->securityOrigin(); + RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); + FrameLoader::addHTTPOriginIfNeeded(request, sourceOrigin->toString()); + request.setHTTPHeaderField("Ping-To", destinationURL); + if (sourceOrigin->isSameSchemeHostPort(pingOrigin.get())) + request.setHTTPHeaderField("Ping-From", frame->document()->url()); + else if (!SecurityOrigin::shouldHideReferrer(pingURL, frame->loader()->outgoingReferrer())) + request.setHTTPReferrer(frame->loader()->outgoingReferrer()); + OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request)); + + // Leak the ping loader, since it will kill itself as soon as it receives a response. + PingLoader* leakedPingLoader = pingLoader.leakPtr(); + UNUSED_PARAM(leakedPingLoader); +} + PingLoader::PingLoader(Frame* frame, const ResourceRequest& request) + : m_timeout(this, &PingLoader::timeout) { m_handle = ResourceHandle::create(frame->loader()->networkingContext(), request, this, false, false); + + // If the server never responds, FrameLoader won't be able to cancel this load and + // we'll sit here waiting forever. Set a very generous timeout, just in case. + m_timeout.startOneShot(60000); } PingLoader::~PingLoader() diff --git a/WebCore/loader/PingLoader.h b/WebCore/loader/PingLoader.h index e26a9c9..eb43166 100644 --- a/WebCore/loader/PingLoader.h +++ b/WebCore/loader/PingLoader.h @@ -33,6 +33,7 @@ #define PingLoader_h #include "ResourceHandleClient.h" +#include "Timer.h" #include <wtf/Noncopyable.h> #include <wtf/RefPtr.h> @@ -52,6 +53,7 @@ class ResourceResponse; class PingLoader : private ResourceHandleClient, public Noncopyable { public: static void loadImage(Frame*, const KURL& url); + static void sendPing(Frame*, const KURL& pingURL, const KURL& destinationURL); ~PingLoader(); @@ -62,8 +64,10 @@ private: void didReceiveData(ResourceHandle*, const char*, int) { delete this; } void didFinishLoading(ResourceHandle*, double) { delete this; } void didFail(ResourceHandle*, const ResourceError&) { delete this; } + void timeout(Timer<PingLoader>*) { delete this; } RefPtr<ResourceHandle> m_handle; + Timer<PingLoader> m_timeout; }; } diff --git a/WebCore/loader/RedirectScheduler.cpp b/WebCore/loader/RedirectScheduler.cpp index ce0e3f8..ce41cde 100644 --- a/WebCore/loader/RedirectScheduler.cpp +++ b/WebCore/loader/RedirectScheduler.cpp @@ -318,7 +318,7 @@ void RedirectScheduler::scheduleFormSubmission(PassRefPtr<FormSubmission> submis // to match IE and Opera. // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this. bool isUserGesture = m_frame->loader()->isProcessingUserGesture(); - bool lockBackForwardList = mustLockBackForwardList(m_frame, isUserGesture) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); + bool lockBackForwardList = mustLockBackForwardList(m_frame, isUserGesture) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent() && !isUserGesture); schedule(adoptPtr(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad, isUserGesture))); } diff --git a/WebCore/make-hash-tools.pl b/WebCore/make-hash-tools.pl index 8cc9952..3ad5ee9 100644 --- a/WebCore/make-hash-tools.pl +++ b/WebCore/make-hash-tools.pl @@ -27,24 +27,123 @@ my $outdir = $ARGV[0]; shift; my $option = basename($ARGV[0],".gperf"); +my $hashToolsHeader = "$outdir/HashTools.h"; + +sub createHashToolsHeader() { + +open HEADER, ">$hashToolsHeader" || die "Could not open $hashToolsHeader for writing"; +print HEADER << "EOF"; +/* This file is automatically generated by make-hash-tools.pl, do not edit */ + +#ifndef HashTools_h +#define HashTools_h + +#include "wtf/Platform.h" + +namespace WebCore { + +struct PubIDInfo { + enum eMode { + eQuirks, + eQuirks3, + eAlmostStandards + }; + + const char* name; + eMode mode_if_no_sysid; + eMode mode_if_sysid; +}; + +struct NamedColor { + const char* name; + int RGBValue; +}; + +struct Property { + const char* name; + int id; +}; + +struct Value { + const char* name; + int id; +}; + +const PubIDInfo* findDoctypeEntry(register const char* str, register unsigned int len); +const NamedColor* findColor(register const char* str, register unsigned int len); +const Property* findProperty(register const char* str, register unsigned int len); +const Value* findValue(register const char* str, register unsigned int len); +} + +#endif // HashTools_h + +EOF +close HEADER; + +} + switch ($option) { case "DocTypeStrings" { - my $docTypeStringsGenerated = "$outdir/DocTypeStrings.cpp"; + createHashToolsHeader(); + + my $docTypeStringsImpl = "$outdir/DocTypeStrings.cpp"; + my $docTypeStringsGenerated = "$outdir/DocTypeStringsHash.h"; my $docTypeStringsGperf = $ARGV[0]; shift; + open DOCTYPESTRINGS, ">$docTypeStringsImpl" || die "Could not open $docTypeStringsImpl for writing"; + print DOCTYPESTRINGS << "EOF"; +/* This file is automatically generated by make-hash-tools.pl, do not edit */ + +#include <string.h> +#include "HashTools.h" + +namespace WebCore { +#include "DocTypeStringsHash.h" + +const PubIDInfo* findDoctypeEntry (register const char* str, register unsigned int len) +{ + return DocTypeStringsHash::findDoctypeEntryImpl(str, len); +} + +} + +EOF + close DOCTYPESTRINGS; + system("gperf --key-positions=\"*\" -s 2 $docTypeStringsGperf > $docTypeStringsGenerated") == 0 || die "calling gperf failed: $?"; } # case "DocTypeStrings" case "ColorData" { - my $colorDataGenerated = "$outdir/ColorData.cpp"; - my $colorDataGperf = $ARGV[0]; + my $colorDataImpl = "$outdir/ColorData.cpp"; + my $colorDataGenerated = "$outdir/ColorDataHash.h"; + my $colorDataGperf = $ARGV[0]; shift; + open COLORDATA, ">$colorDataImpl" || die "Could not open $colorDataImpl for writing"; + print COLORDATA << "EOF"; +/* This file is automatically generated by make-hash-tools.pl, do not edit */ + +#include <string.h> +#include "HashTools.h" + +namespace WebCore { +#include "ColorDataHash.h" + +const struct NamedColor* findColor (register const char* str, register unsigned int len) +{ + return ColorDataHash::findColorImpl(str, len); +} + +} + +EOF + close COLORDATA; + system("gperf --key-positions=\"*\" -D -s 2 $colorDataGperf > $colorDataGenerated") == 0 || die "calling gperf failed: $?"; } # case "ColorData" diff --git a/WebCore/manual-tests/large-size-image-crash.html b/WebCore/manual-tests/large-size-image-crash.html new file mode 100644 index 0000000..93cafa2 --- /dev/null +++ b/WebCore/manual-tests/large-size-image-crash.html @@ -0,0 +1,6 @@ +<html> + <body> + Displaying the animated GIF below should not result in memory corruption. + <img src="resources/large-size-image-crash.gif"> + </body> +</html> diff --git a/WebCore/manual-tests/resources/large-size-image-crash.gif b/WebCore/manual-tests/resources/large-size-image-crash.gif Binary files differnew file mode 100644 index 0000000..6da80af --- /dev/null +++ b/WebCore/manual-tests/resources/large-size-image-crash.gif diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index f0aff33..c6555b9 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -21,6 +21,7 @@ #ifndef ChromeClient_h #define ChromeClient_h +#include "AXObjectCache.h" #include "Console.h" #include "Cursor.h" #include "FocusDirection.h" @@ -46,6 +47,7 @@ class NSResponder; namespace WebCore { + class AccessibilityObject; class Element; class FileChooser; class FloatRect; @@ -268,9 +270,13 @@ namespace WebCore { virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const = 0; virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0; +<<<<<<< HEAD #if ENABLE(ANDROID_INSTALLABLE_WEB_APPS) virtual void webAppCanBeInstalled() = 0; #endif +======= + virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { } +>>>>>>> webkit.org at r68651 protected: virtual ~ChromeClient() { } diff --git a/WebCore/page/ContextMenuController.cpp b/WebCore/page/ContextMenuController.cpp index d2317d2..de64988 100644 --- a/WebCore/page/ContextMenuController.cpp +++ b/WebCore/page/ContextMenuController.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -186,6 +187,27 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item) // For now, call into the client. This is temporary! frame->editor()->copyImage(result); break; + case ContextMenuItemTagOpenMediaInNewWindow: + openNewWindow(result.absoluteMediaURL(), frame); + break; + case ContextMenuItemTagCopyMediaLinkToClipboard: + frame->editor()->copyURL(result.absoluteMediaURL(), result.textContent()); + break; + case ContextMenuItemTagToggleMediaControls: + result.toggleMediaControlsDisplay(); + break; + case ContextMenuItemTagToggleMediaLoop: + result.toggleMediaLoopPlayback(); + break; + case ContextMenuItemTagEnterVideoFullscreen: + result.enterFullscreenForVideo(); + break; + case ContextMenuItemTagMediaPlayPause: + result.toggleMediaPlayState(); + break; + case ContextMenuItemTagMediaMute: + result.toggleMediaMuteState(); + break; case ContextMenuItemTagOpenFrameInNewWindow: { DocumentLoader* loader = frame->loader()->documentLoader(); if (!loader->unreachableURL().isEmpty()) diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index afd6bc7..200b82a 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -40,6 +40,7 @@ #include "DOMSelection.h" #include "DOMStringList.h" #include "DOMTimer.h" +#include "DOMTokenList.h" #include "Database.h" #include "DatabaseCallback.h" #include "DeviceMotionController.h" @@ -93,6 +94,7 @@ #include "ErrorCallback.h" #include "FileError.h" #include "FileSystemCallback.h" +#include "FileSystemCallbacks.h" #include "LocalFileSystem.h" #endif @@ -727,25 +729,22 @@ void DOMWindow::requestFileSystem(int type, long long size, PassRefPtr<FileSyste if (!document) return; - if (!m_localFileSystem) { - // FIXME: See if access is allowed. - - Page* page = document->page(); - if (!page) { - DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(INVALID_STATE_ERR)); - return; - } + if (!AsyncFileSystem::isAvailable() || !document->securityOrigin()->canAccessFileSystem()) { + DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(SECURITY_ERR)); + return; + } - // FIXME: Get the quota settings as well. - String path = page->settings()->fileSystemRootPath(); - m_localFileSystem = LocalFileSystem::create(path); + AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); + if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) { + DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(INVALID_MODIFICATION_ERR)); + return; } - m_localFileSystem->requestFileSystem(document, static_cast<AsyncFileSystem::Type>(type), size, successCallback, errorCallback); + LocalFileSystem::localFileSystem().requestFileSystem(document, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, document)); } -COMPILE_ASSERT(int(DOMWindow::TEMPORARY) == int(AsyncFileSystem::Temporary), enum_mismatch); -COMPILE_ASSERT(int(DOMWindow::PERSISTENT) == int(AsyncFileSystem::Persistent), enum_mismatch); +COMPILE_ASSERT(static_cast<int>(DOMWindow::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch); +COMPILE_ASSERT(static_cast<int>(DOMWindow::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch); #endif @@ -1624,7 +1623,7 @@ String DOMWindow::createBlobURL(Blob* blob) void DOMWindow::revokeBlobURL(const String& blobURLString) { - scriptExecutionContext()->revokePublicBlobURL(KURL(ParsedURLString, blobURLString)); + scriptExecutionContext()->revokePublicBlobURL(KURL(KURL(), blobURLString)); } #endif diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 1470628..6fd3775 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -58,7 +58,6 @@ namespace WebCore { class History; class IDBFactory; class InspectorTimelineAgent; - class LocalFileSystem; class Location; class StyleMedia; class Navigator; @@ -444,9 +443,6 @@ namespace WebCore { #if ENABLE(INDEXED_DATABASE) mutable RefPtr<IDBFactory> m_idbFactory; #endif -#if ENABLE(FILE_SYSTEM) - RefPtr<LocalFileSystem> m_localFileSystem; -#endif EventTargetData m_eventTargetData; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index 7ae948c..f7f9a85 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -380,6 +380,7 @@ module window { // attribute DOMImplementationListConstructor DOMImplementationList; // attribute DOMImplementationSourceConstructor DOMImplementationSource; attribute DOMImplementationConstructor DOMImplementation; + attribute DOMTokenListConstructor DOMTokenList; attribute DocumentFragmentConstructor DocumentFragment; attribute DocumentConstructor Document; attribute NodeConstructor Node; diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index b660918..b0c3911 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -873,7 +873,7 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& padding) { - HitTestResult result(point, padding); + HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width()); if (!m_frame->contentRenderer()) return result; if (ignoreClipping) @@ -894,7 +894,7 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all FrameView* view = static_cast<FrameView*>(widget); IntPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop()); - HitTestResult widgetHitTestResult(widgetPoint, padding); + HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width()); frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); result = widgetHitTestResult; @@ -1915,7 +1915,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe return swallowEvent; } -#if !PLATFORM(GTK) && !(PLATFORM(CHROMIUM) && OS(LINUX)) +#if !PLATFORM(GTK) && !(PLATFORM(CHROMIUM) && (OS(LINUX) || OS(FREEBSD))) bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const { return false; diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index 558f339..9817e87 100755 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -503,8 +503,9 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumS m_doc->styleSelectorChanged(RecalcStyleImmediately); view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize); + // Subframes of the one we're printing don't lay out to the page size. for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->setPrinting(printing, pageSize, maximumShrinkRatio, shouldAdjustViewSize); + child->setPrinting(printing, IntSize(), 0, shouldAdjustViewSize); } void Frame::injectUserScripts(UserScriptInjectionTime injectionTime) @@ -720,6 +721,7 @@ void Frame::transferChildFrameToNewDocument() // Switch page. Page* newPage = newParent ? newParent->page() : 0; + Page* oldPage = m_page; if (m_page != newPage) { if (page()->focusController()->focusedFrame() == this) page()->focusController()->setFocusedFrame(0); @@ -751,7 +753,7 @@ void Frame::transferChildFrameToNewDocument() // up on the same page and under the same parent frame. if (didTransfer) { // Let external clients update themselves. - loader()->client()->didTransferChildFrameToNewDocument(); + loader()->client()->didTransferChildFrameToNewDocument(oldPage); // Do the same for all the children. for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index e881c94..9a4daa7 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -815,7 +815,7 @@ void FrameView::layout(bool allowSubtree) m_layoutCount++; -#if PLATFORM(MAC) +#if PLATFORM(MAC) || PLATFORM(CHROMIUM) if (AXObjectCache::accessibilityEnabled()) root->document()->axObjectCache()->postNotification(root, AXObjectCache::AXLayoutComplete, true); #endif diff --git a/WebCore/page/Location.cpp b/WebCore/page/Location.cpp index 5754357..c02304c 100644 --- a/WebCore/page/Location.cpp +++ b/WebCore/page/Location.cpp @@ -120,6 +120,15 @@ String Location::search() const return url.query().isEmpty() ? "" : "?" + url.query(); } +String Location::origin() const +{ + if (!m_frame) + return String(); + + RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url()); + return origin->toString(); +} + String Location::hash() const { if (!m_frame) diff --git a/WebCore/page/Location.h b/WebCore/page/Location.h index 808eff9..a4bc407 100644 --- a/WebCore/page/Location.h +++ b/WebCore/page/Location.h @@ -55,6 +55,7 @@ namespace WebCore { String pathname() const; String search() const; String hash() const; + String origin() const; String toString() const; diff --git a/WebCore/page/Location.idl b/WebCore/page/Location.idl index aad90ab..1668e05 100644 --- a/WebCore/page/Location.idl +++ b/WebCore/page/Location.idl @@ -58,6 +58,8 @@ module window { attribute [CustomSetter] DOMString pathname; attribute [CustomSetter] DOMString search; attribute [CustomSetter] DOMString hash; + + readonly attribute DOMString origin; #endif #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index 4c9403b..8b902c0 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -240,7 +240,8 @@ void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& sourc void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, UserContentInjectedFrames injectedFrames, - UserStyleSheet::Level level) + UserStyleLevel level, + UserStyleInjectionTime injectionTime) { ASSERT_ARG(world, world); @@ -252,7 +253,8 @@ void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& s styleSheetsInWorld = new UserStyleSheetVector; styleSheetsInWorld->append(userStyleSheet.release()); - resetUserStyleCacheInAllFrames(); + if (injectionTime == InjectInExistingDocuments) + resetUserStyleCacheInAllFrames(); } void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& url) @@ -358,14 +360,12 @@ void PageGroup::removeAllUserContent() void PageGroup::resetUserStyleCacheInAllFrames() { -#if !PLATFORM(CHROMIUM) // Clear our cached sheets and have them just reparse. HashSet<Page*>::const_iterator end = m_pages.end(); for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) frame->document()->updatePageGroupUserSheets(); } -#endif } } // namespace WebCore diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h index fcad773..cc47fba 100644 --- a/WebCore/page/PageGroup.h +++ b/WebCore/page/PageGroup.h @@ -83,8 +83,8 @@ namespace WebCore { void addUserStyleSheetToWorld(DOMWrapperWorld*, const String& source, const KURL&, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, UserContentInjectedFrames, - UserStyleSheet::Level level = UserStyleSheet::UserLevel); - + UserStyleLevel level = UserStyleUserLevel, + UserStyleInjectionTime injectionTime = InjectInExistingDocuments); void removeUserScriptFromWorld(DOMWrapperWorld*, const KURL&); void removeUserStyleSheetFromWorld(DOMWrapperWorld*, const KURL&); diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h index 4789d3c..2a63966 100644 --- a/WebCore/page/SecurityOrigin.h +++ b/WebCore/page/SecurityOrigin.h @@ -121,6 +121,7 @@ public: bool canAccessLocalStorage() const { return !isUnique(); } bool canAccessCookies() const { return !isUnique(); } bool canAccessPasswordManager() const { return !isUnique(); } + bool canAccessFileSystem() const { return !isUnique(); } // Technically, we should always allow access to sessionStorage, but we // currently don't handle creating a sessionStorage area for unique diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index faa7140..2e67bf1 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -159,12 +159,16 @@ Settings::Settings(Page* page) , m_memoryInfoEnabled(false) , m_interactiveFormValidation(false) , m_usePreHTML5ParserQuirks(false) +<<<<<<< HEAD #if ENABLE(WEB_AUTOFILL) , m_autoFillEnabled(false) #endif #ifdef ANDROID_PLUGINS , m_pluginsOnDemand(false) #endif +======= + , m_hyperlinkAuditingEnabled(false) +>>>>>>> webkit.org at r68651 { // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. @@ -699,11 +703,6 @@ void Settings::setLocalStorageDatabasePath(const String& path) m_localStorageDatabasePath = path; } -void Settings::setFileSystemRootPath(const String& path) -{ - m_fileSystemRootPath = path; -} - void Settings::setApplicationChromeMode(bool mode) { m_inApplicationChromeMode = mode; diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index b0a964d..7a65eaa 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -228,7 +228,7 @@ namespace WebCore { void setDOMPasteAllowed(bool); bool isDOMPasteAllowed() const { return m_isDOMPasteAllowed; } - void setMinDOMTimerInterval(double); // Interval specified in seconds. + static void setMinDOMTimerInterval(double); // Interval specified in seconds. void setUsesPageCache(bool); bool usesPageCache() const { return m_usesPageCache; } @@ -309,9 +309,6 @@ namespace WebCore { void setLocalStorageDatabasePath(const String&); const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; } - void setFileSystemRootPath(const String&); - const String& fileSystemRootPath() const { return m_fileSystemRootPath; } - void setApplicationChromeMode(bool); bool inApplicationChromeMode() const { return m_inApplicationChromeMode; } @@ -398,10 +395,15 @@ namespace WebCore { void setUsePreHTML5ParserQuirks(bool flag) { m_usePreHTML5ParserQuirks = flag; } bool usePreHTML5ParserQuirks() const { return m_usePreHTML5ParserQuirks; } +<<<<<<< HEAD #if ENABLE(WEB_AUTOFILL) void setAutoFillEnabled(bool flag) { m_autoFillEnabled = flag; } bool autoFillEnabled() { return m_autoFillEnabled; } #endif +======= + void setHyperlinkAuditingEnabled(bool flag) { m_hyperlinkAuditingEnabled = flag; } + bool hyperlinkAuditingEnabled() const { return m_hyperlinkAuditingEnabled; } +>>>>>>> webkit.org at r68651 private: Page* m_page; @@ -409,7 +411,6 @@ namespace WebCore { String m_defaultTextEncodingName; String m_ftpDirectoryTemplatePath; String m_localStorageDatabasePath; - String m_fileSystemRootPath; KURL m_userStyleSheetLocation; AtomicString m_standardFontFamily; AtomicString m_fixedFontFamily; @@ -528,12 +529,16 @@ namespace WebCore { bool m_memoryInfoEnabled: 1; bool m_interactiveFormValidation: 1; bool m_usePreHTML5ParserQuirks: 1; +<<<<<<< HEAD #ifdef ANDROID_PLUGINS bool m_pluginsOnDemand : 1; #endif #if ENABLE(WEB_AUTOFILL) bool m_autoFillEnabled: 1; #endif +======= + bool m_hyperlinkAuditingEnabled : 1; +>>>>>>> webkit.org at r68651 #if USE(SAFARI_THEME) static bool gShouldPaintNativeControls; diff --git a/WebCore/page/UserStyleSheet.h b/WebCore/page/UserStyleSheet.h index 1acd296..fa42e2c 100644 --- a/WebCore/page/UserStyleSheet.h +++ b/WebCore/page/UserStyleSheet.h @@ -37,14 +37,9 @@ namespace WebCore { class UserStyleSheet : public Noncopyable { public: - enum Level { - UserLevel, - AuthorLevel - }; - UserStyleSheet(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, - UserContentInjectedFrames injectedFrames, Level level) + UserContentInjectedFrames injectedFrames, UserStyleLevel level) : m_source(source) , m_url(url) , m_whitelist(whitelist) @@ -59,7 +54,7 @@ public: const Vector<String>* whitelist() const { return m_whitelist.get(); } const Vector<String>* blacklist() const { return m_blacklist.get(); } UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; } - Level level() const { return m_level; } + UserStyleLevel level() const { return m_level; } private: String m_source; @@ -67,7 +62,7 @@ private: OwnPtr<Vector<String> > m_whitelist; OwnPtr<Vector<String> > m_blacklist; UserContentInjectedFrames m_injectedFrames; - Level m_level; + UserStyleLevel m_level; }; } // namespace WebCore diff --git a/WebCore/page/UserStyleSheetTypes.h b/WebCore/page/UserStyleSheetTypes.h index ef662f2..eda6604 100644 --- a/WebCore/page/UserStyleSheetTypes.h +++ b/WebCore/page/UserStyleSheetTypes.h @@ -31,6 +31,9 @@ namespace WebCore { +enum UserStyleInjectionTime { InjectInExistingDocuments, InjectInSubsequentDocuments }; +enum UserStyleLevel { UserStyleUserLevel, UserStyleAuthorLevel }; + class DOMWrapperWorld; class UserStyleSheet; diff --git a/WebCore/page/animation/ImplicitAnimation.cpp b/WebCore/page/animation/ImplicitAnimation.cpp index da0a810..34607f6 100644 --- a/WebCore/page/animation/ImplicitAnimation.cpp +++ b/WebCore/page/animation/ImplicitAnimation.cpp @@ -120,6 +120,25 @@ bool ImplicitAnimation::startAnimation(double timeOffset) return false; } +void ImplicitAnimation::pauseAnimation(double timeOffset) +{ + if (!m_object) + return; + +#if USE(ACCELERATED_COMPOSITING) + if (m_object->hasLayer()) { + RenderLayer* layer = toRenderBoxModelObject(m_object)->layer(); + if (layer->isComposited()) + layer->backing()->transitionPaused(timeOffset, m_animatingProperty); + } +#else + UNUSED_PARAM(timeOffset); +#endif + // Restore the original (unanimated) style + if (!paused()) + setNeedsStyleRecalc(m_object->node()); +} + void ImplicitAnimation::endAnimation() { #if USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/page/animation/ImplicitAnimation.h b/WebCore/page/animation/ImplicitAnimation.h index be5c197..c40c00a 100644 --- a/WebCore/page/animation/ImplicitAnimation.h +++ b/WebCore/page/animation/ImplicitAnimation.h @@ -48,7 +48,7 @@ public: virtual void onAnimationEnd(double elapsedTime); virtual bool startAnimation(double timeOffset); - virtual void pauseAnimation(double /*timeOffset*/) { } + virtual void pauseAnimation(double /*timeOffset*/); virtual void endAnimation(); virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle); diff --git a/WebCore/page/chromium/ChromeClientChromium.h b/WebCore/page/chromium/ChromeClientChromium.h index 44e005f..02e2a94 100644 --- a/WebCore/page/chromium/ChromeClientChromium.h +++ b/WebCore/page/chromium/ChromeClientChromium.h @@ -31,12 +31,10 @@ #ifndef ChromeClientChromium_h #define ChromeClientChromium_h -#include "AXObjectCache.h" #include "ChromeClient.h" #include <wtf/Forward.h> namespace WebCore { -class AccessibilityObject; class IntRect; class PopupContainer; @@ -53,15 +51,6 @@ public: // Notifies the client a popup was closed. virtual void popupClosed(PopupContainer* popupContainer) = 0; - - // Notifies embedder that the state of an accessibility object has changed. - virtual void didChangeAccessibilityObjectState(AccessibilityObject*) = 0; - - // Notified embedder that the children of an accessibility object has changed. - virtual void didChangeAccessibilityObjectChildren(AccessibilityObject*) = 0; - - // Notifies embedder about an accessibility notification. - virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) = 0; }; } // namespace WebCore diff --git a/WebCore/page/chromium/EventHandlerChromium.cpp b/WebCore/page/chromium/EventHandlerChromium.cpp index dd6cf99..6bf907e 100644 --- a/WebCore/page/chromium/EventHandlerChromium.cpp +++ b/WebCore/page/chromium/EventHandlerChromium.cpp @@ -129,7 +129,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create(); - return ClipboardChromium::create(true, dataObject.get(), ClipboardWritable, m_frame); + return ClipboardChromium::create(Clipboard::DragAndDrop, dataObject.get(), ClipboardWritable, m_frame); } void EventHandler::focusDocumentView() @@ -154,7 +154,7 @@ unsigned EventHandler::accessKeyModifiers() #endif } -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) // GTK+ must scroll horizontally if the mouse pointer is on top of the // horizontal scrollbar while scrolling with the wheel. // This code comes from gtk/EventHandlerGtk.cpp. diff --git a/WebCore/page/efl/EventHandlerEfl.cpp b/WebCore/page/efl/EventHandlerEfl.cpp index acf4343..33db17e 100644 --- a/WebCore/page/efl/EventHandlerEfl.cpp +++ b/WebCore/page/efl/EventHandlerEfl.cpp @@ -110,7 +110,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardEfl::create(ClipboardWritable, true); + return ClipboardEfl::create(ClipboardWritable, Clipboard::DragAndDrop); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/page/gtk/EventHandlerGtk.cpp b/WebCore/page/gtk/EventHandlerGtk.cpp index 429aea6..6e69d9f 100644 --- a/WebCore/page/gtk/EventHandlerGtk.cpp +++ b/WebCore/page/gtk/EventHandlerGtk.cpp @@ -96,7 +96,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardGtk::create(ClipboardWritable, DataObjectGtk::create(), true, m_frame); + return ClipboardGtk::create(ClipboardWritable, DataObjectGtk::create(), Clipboard::DragAndDrop, m_frame); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/page/haiku/EventHandlerHaiku.cpp b/WebCore/page/haiku/EventHandlerHaiku.cpp index 450414d..933921a 100644 --- a/WebCore/page/haiku/EventHandlerHaiku.cpp +++ b/WebCore/page/haiku/EventHandlerHaiku.cpp @@ -122,7 +122,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardHaiku::create(ClipboardWritable, true); + return ClipboardHaiku::create(ClipboardWritable, Clipboard::DragAndDrop); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/page/mac/EventHandlerMac.mm b/WebCore/page/mac/EventHandlerMac.mm index 584f38f..2db713f 100644 --- a/WebCore/page/mac/EventHandlerMac.mm +++ b/WebCore/page/mac/EventHandlerMac.mm @@ -712,7 +712,7 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const // Must be done before ondragstart adds types and data to the pboard, // also done for security, as it erases data from the last drag [pasteboard declareTypes:[NSArray array] owner:nil]; - return ClipboardMac::create(true, pasteboard, ClipboardWritable, m_frame); + return ClipboardMac::create(Clipboard::DragAndDrop, pasteboard, ClipboardWritable, m_frame); } #endif diff --git a/WebCore/page/qt/EventHandlerQt.cpp b/WebCore/page/qt/EventHandlerQt.cpp index 18d9b73..2c658e7 100644 --- a/WebCore/page/qt/EventHandlerQt.cpp +++ b/WebCore/page/qt/EventHandlerQt.cpp @@ -113,7 +113,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardQt::create(ClipboardWritable, true); + return ClipboardQt::create(ClipboardWritable, Clipboard::DragAndDrop); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/page/win/EventHandlerWin.cpp b/WebCore/page/win/EventHandlerWin.cpp index ee4b360..a1c15c5 100644 --- a/WebCore/page/win/EventHandlerWin.cpp +++ b/WebCore/page/win/EventHandlerWin.cpp @@ -98,7 +98,7 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const #else COMPtr<WCDataObject> dataObject; WCDataObject::createInstance(&dataObject); - return ClipboardWin::create(true, dataObject.get(), ClipboardWritable, m_frame); + return ClipboardWin::create(Clipboard::DragAndDrop, dataObject.get(), ClipboardWritable, m_frame); #endif } diff --git a/WebCore/page/wince/FrameWinCE.cpp b/WebCore/page/wince/FrameWinCE.cpp index dfea864..9eb487b 100644 --- a/WebCore/page/wince/FrameWinCE.cpp +++ b/WebCore/page/wince/FrameWinCE.cpp @@ -129,11 +129,11 @@ HBITMAP imageFromSelection(Frame* frame, bool forceBlackText) } OwnPtr<HDC> bmpDC(CreateCompatibleDC(g_screenDC)); - HBITMAP hBmp = MemoryManager::createCompatibleBitmap(g_screenDC, w, h); + HBITMAP hBmp = CreateCompatibleBitmap(g_screenDC, w, h); if (!hBmp) return 0; - HBITMAP hbmpOld = (HBITMAP)SelectObject(bmpDC.get(), hBmp); + HGDIOBJ hbmpOld = SelectObject(bmpDC.get(), hBmp); { GraphicsContext gc(bmpDC.get()); diff --git a/WebCore/page/wx/EventHandlerWx.cpp b/WebCore/page/wx/EventHandlerWx.cpp index f4f6914..fbb1eaa 100644 --- a/WebCore/page/wx/EventHandlerWx.cpp +++ b/WebCore/page/wx/EventHandlerWx.cpp @@ -116,7 +116,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardWx::create(ClipboardWritable, true); + return ClipboardWx::create(ClipboardWritable, Clipboard::DragAndDrop); } unsigned EventHandler::accessKeyModifiers() diff --git a/WebCore/platform/AsyncFileSystem.cpp b/WebCore/platform/AsyncFileSystem.cpp index b4fcd0d..57305ff 100644 --- a/WebCore/platform/AsyncFileSystem.cpp +++ b/WebCore/platform/AsyncFileSystem.cpp @@ -35,12 +35,20 @@ #include "AsyncFileSystemCallbacks.h" #include "FileSystem.h" +#include "NotImplemented.h" namespace WebCore { +#if !PLATFORM(CHROMIUM) +bool AsyncFileSystem::isAvailable() +{ + notImplemented(); + return false; +} + PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(const String&) { - // FIXME: return default AsyncFileSystem implementation. + notImplemented(); return 0; } @@ -62,6 +70,7 @@ void AsyncFileSystem::openFileSystem(const String& basePath, const String& stora callbacks->didOpenFileSystem(name, AsyncFileSystem::create(rootPath)); } +#endif // Default implementation. String AsyncFileSystem::virtualToPlatformPath(const String& path) const diff --git a/WebCore/platform/AsyncFileSystem.h b/WebCore/platform/AsyncFileSystem.h index 601f0ea..1bf7580 100644 --- a/WebCore/platform/AsyncFileSystem.h +++ b/WebCore/platform/AsyncFileSystem.h @@ -41,6 +41,7 @@ namespace WebCore { class AsyncFileSystem; class AsyncFileSystemCallbacks; +class AsyncFileWriterClient; // This class provides async interface for platform-specific file system implementation. Note that all the methods take platform paths. class AsyncFileSystem : public Noncopyable { @@ -56,6 +57,8 @@ public: virtual void stop() { } virtual bool hasPendingActivity() { return false; } + static bool isAvailable(); + // Creates and returns a new platform-specific AsyncFileSystem instance if the platform has its own implementation. static PassOwnPtr<AsyncFileSystem> create(const String& rootPath); @@ -107,6 +110,11 @@ public: // AsyncFileSystemCallbacks::didFail() is when there is an error. virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0; + // Creates an AsyncFileWriter for a given file path. + // AsyncFileSystemCallbacks::didCreateFileWriter() is called when an AsyncFileWriter is created successfully. + // AsyncFileSystemCallbacks::didFail() is called otherwise. + virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0; + // Converts a given absolute virtual path to a platform path that starts with the platform root path of this file system. virtual String virtualToPlatformPath(const String& path) const; diff --git a/WebCore/platform/AsyncFileSystemCallbacks.h b/WebCore/platform/AsyncFileSystemCallbacks.h index 0547fad..451aead 100644 --- a/WebCore/platform/AsyncFileSystemCallbacks.h +++ b/WebCore/platform/AsyncFileSystemCallbacks.h @@ -38,6 +38,7 @@ namespace WebCore { class AsyncFileSystem; +class AsyncFileWriter; class AsyncFileSystemCallbacks : public Noncopyable { public: @@ -56,6 +57,9 @@ public: // Called after a chunk of directory entries have been read (i.e. indicates it's good time to call back to the application). If hasMore is true there can be more chunks. virtual void didReadDirectoryEntries(bool hasMore) = 0; + // Called when an AsyncFileWrter has been created successfully. + virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter> writer, long long length) = 0; + // Called when there was an error. virtual void didFail(int code) = 0; diff --git a/WebCore/platform/ColorData.gperf b/WebCore/platform/ColorData.gperf index 11ef798..dd726cc 100644 --- a/WebCore/platform/ColorData.gperf +++ b/WebCore/platform/ColorData.gperf @@ -1,15 +1,13 @@ %struct-type -struct NamedColor { - const char *name; - int RGBValue; -}; -%language=ANSI-C +struct NamedColor; +%omit-struct-type +%language=C++ %readonly-tables %global-table %compare-strncmp -%define lookup-function-name findColor +%define class-name ColorDataHash +%define lookup-function-name findColorImpl %define hash-function-name colordata_hash_function -%includes %enum %% aliceblue, 0xf0f8ff diff --git a/WebCore/platform/ContextMenu.cpp b/WebCore/platform/ContextMenu.cpp index 37d4c2b..ca1f719 100644 --- a/WebCore/platform/ContextMenu.cpp +++ b/WebCore/platform/ContextMenu.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * Copyright (C) 2008 Christian Dywan <christian@imendio.com> + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -282,6 +283,19 @@ void ContextMenu::populate() contextMenuItemTagDownloadImageToDisk()); ContextMenuItem CopyImageItem(ActionType, ContextMenuItemTagCopyImageToClipboard, contextMenuItemTagCopyImageToClipboard()); + ContextMenuItem OpenMediaInNewWindowItem(ActionType, ContextMenuItemTagOpenMediaInNewWindow, String()); + ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLinkToClipboard, + String()); + ContextMenuItem MediaPlayPause(ActionType, ContextMenuItemTagMediaPlayPause, + contextMenuItemTagMediaPlay()); + ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute, + contextMenuItemTagMediaMute()); + ContextMenuItem ToggleMediaControls(CheckableActionType, ContextMenuItemTagToggleMediaControls, + contextMenuItemTagToggleMediaControls()); + ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggleMediaLoop, + contextMenuItemTagToggleMediaLoop()); + ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVideoFullscreen, + contextMenuItemTagEnterVideoFullscreen()); #if PLATFORM(MAC) ContextMenuItem SearchSpotlightItem(ActionType, ContextMenuItemTagSearchInSpotlight, contextMenuItemTagSearchInSpotlight()); @@ -349,7 +363,23 @@ void ContextMenu::populate() appendItem(CopyImageItem); } - if (imageURL.isEmpty() && linkURL.isEmpty()) { + KURL mediaURL = result.absoluteMediaURL(); + if (!mediaURL.isEmpty()) { + if (!linkURL.isEmpty() || !imageURL.isEmpty()) + appendItem(*separatorItem()); + + appendItem(MediaPlayPause); + appendItem(MediaMute); + appendItem(ToggleMediaControls); + appendItem(ToggleMediaLoop); + appendItem(EnterVideoFullscreen); + + appendItem(*separatorItem()); + appendItem(CopyMediaLinkItem); + appendItem(OpenMediaInNewWindowItem); + } + + if (imageURL.isEmpty() && linkURL.isEmpty() && mediaURL.isEmpty()) { if (result.isSelected()) { if (selectionContainsPossibleWord(frame)) { #if PLATFORM(MAC) @@ -375,12 +405,6 @@ void ContextMenu::populate() #if ENABLE(INSPECTOR) if (!(frame->page() && frame->page()->inspectorController()->hasInspectorFrontendClient())) { #endif -#if PLATFORM(GTK) - appendItem(BackItem); - appendItem(ForwardItem); - appendItem(StopItem); - appendItem(ReloadItem); -#else if (frame->page() && frame->page()->canGoBackOrForward(-1)) appendItem(BackItem); @@ -393,7 +417,6 @@ void ContextMenu::populate() appendItem(StopItem); else appendItem(ReloadItem); -#endif #if ENABLE(INSPECTOR) } #endif @@ -788,6 +811,28 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const case ContextMenuItemTagOpenImageInNewWindow: case ContextMenuItemTagDownloadImageToDisk: case ContextMenuItemTagCopyImageToClipboard: + break; + case ContextMenuItemTagOpenMediaInNewWindow: + if (m_hitTestResult.mediaIsVideo()) + item.setTitle(contextMenuItemTagOpenVideoInNewWindow()); + else + item.setTitle(contextMenuItemTagOpenAudioInNewWindow()); + break; + case ContextMenuItemTagCopyMediaLinkToClipboard: + if (m_hitTestResult.mediaIsVideo()) + item.setTitle(contextMenuItemTagCopyVideoLinkToClipboard()); + else + item.setTitle(contextMenuItemTagCopyAudioLinkToClipboard()); + break; + case ContextMenuItemTagToggleMediaControls: + shouldCheck = m_hitTestResult.mediaControlsEnabled(); + break; + case ContextMenuItemTagToggleMediaLoop: + shouldCheck = m_hitTestResult.mediaLoopEnabled(); + break; + case ContextMenuItemTagEnterVideoFullscreen: + shouldEnable = m_hitTestResult.mediaSupportsFullscreen(); + break; case ContextMenuItemTagOpenFrameInNewWindow: case ContextMenuItemTagSpellingGuess: case ContextMenuItemTagOther: @@ -823,6 +868,16 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const case ContextMenuItemLastCustomTag: case ContextMenuItemBaseApplicationTag: break; + case ContextMenuItemTagMediaPlayPause: + if (m_hitTestResult.mediaPlaying()) + item.setTitle(contextMenuItemTagMediaPause()); + else + item.setTitle(contextMenuItemTagMediaPlay()); + break; + case ContextMenuItemTagMediaMute: + shouldEnable = m_hitTestResult.mediaHasAudio(); + shouldCheck = shouldEnable && m_hitTestResult.mediaMuted(); + break; } item.setChecked(shouldCheck); diff --git a/WebCore/platform/ContextMenuItem.h b/WebCore/platform/ContextMenuItem.h index 3731e24..ee9d2a3 100644 --- a/WebCore/platform/ContextMenuItem.h +++ b/WebCore/platform/ContextMenuItem.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -143,6 +144,13 @@ namespace WebCore { ContextMenuItemTagCapitalize, ContextMenuItemTagChangeBack, #endif + ContextMenuItemTagOpenMediaInNewWindow, + ContextMenuItemTagCopyMediaLinkToClipboard, + ContextMenuItemTagToggleMediaControls, + ContextMenuItemTagToggleMediaLoop, + ContextMenuItemTagEnterVideoFullscreen, + ContextMenuItemTagMediaPlayPause, + ContextMenuItemTagMediaMute, ContextMenuItemBaseCustomTag = 5000, ContextMenuItemCustomTagNoAction = 5998, ContextMenuItemLastCustomTag = 5999, diff --git a/WebCore/platform/Cursor.cpp b/WebCore/platform/Cursor.cpp index 3f17ad9..dac5c24 100644 --- a/WebCore/platform/Cursor.cpp +++ b/WebCore/platform/Cursor.cpp @@ -253,12 +253,16 @@ Cursor::Cursor(Type type) { } +#if !PLATFORM(MAC) + PlatformCursor Cursor::platformCursor() const { ensurePlatformCursor(); return m_platformCursor; } +#endif + const Cursor& pointerCursor() { DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Pointer)); diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h index 92d3596..a962bbb 100644 --- a/WebCore/platform/Cursor.h +++ b/WebCore/platform/Cursor.h @@ -35,6 +35,8 @@ typedef struct HICON__* HICON; typedef HICON HCURSOR; #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#elif PLATFORM(MAC) +#include <wtf/RetainPtr.h> #elif PLATFORM(GTK) #include "GRefPtrGtk.h" #elif PLATFORM(QT) @@ -82,7 +84,7 @@ namespace WebCore { }; typedef RefPtr<SharedCursor> PlatformCursor; #elif PLATFORM(MAC) - typedef NSCursor* PlatformCursor; + typedef NSCursor *PlatformCursor; #elif PLATFORM(GTK) typedef PlatformRefPtr<GdkCursor> PlatformCursor; #elif PLATFORM(EFL) @@ -183,7 +185,11 @@ namespace WebCore { IntPoint m_hotSpot; #endif +#if !PLATFORM(MAC) mutable PlatformCursor m_platformCursor; +#else + mutable RetainPtr<NSCursor> m_platformCursor; +#endif }; IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot); diff --git a/WebCore/platform/LocalizationStrategy.h b/WebCore/platform/LocalizationStrategy.h index 178cfa2..1fe138a 100644 --- a/WebCore/platform/LocalizationStrategy.h +++ b/WebCore/platform/LocalizationStrategy.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -112,6 +113,16 @@ public: virtual String contextMenuItemTagCapitalize() = 0; virtual String contextMenuItemTagChangeBack(const String& replacedString) = 0; #endif + virtual String contextMenuItemTagOpenVideoInNewWindow() = 0; + virtual String contextMenuItemTagOpenAudioInNewWindow() = 0; + virtual String contextMenuItemTagCopyVideoLinkToClipboard() = 0; + virtual String contextMenuItemTagCopyAudioLinkToClipboard() = 0; + virtual String contextMenuItemTagToggleMediaControls() = 0; + virtual String contextMenuItemTagToggleMediaLoop() = 0; + virtual String contextMenuItemTagEnterVideoFullscreen() = 0; + virtual String contextMenuItemTagMediaPlay() = 0; + virtual String contextMenuItemTagMediaPause() = 0; + virtual String contextMenuItemTagMediaMute() = 0; virtual String contextMenuItemTagInspectElement() = 0; #endif // ENABLE(CONTEXT_MENUS) diff --git a/WebCore/platform/LocalizedStrings.cpp b/WebCore/platform/LocalizedStrings.cpp index a69e0fb..012d90e 100644 --- a/WebCore/platform/LocalizedStrings.cpp +++ b/WebCore/platform/LocalizedStrings.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2003, 2006, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -362,6 +363,56 @@ String contextMenuItemTagChangeBack(const String& replacedString) } #endif // PLATFORM(MAC) + +String contextMenuItemTagOpenVideoInNewWindow() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenVideoInNewWindow(); +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenAudioInNewWindow(); +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyVideoLinkToClipboard(); +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyAudioLinkToClipboard(); +} + +String contextMenuItemTagToggleMediaControls() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagToggleMediaControls(); +} + +String contextMenuItemTagToggleMediaLoop() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagToggleMediaLoop(); +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagEnterVideoFullscreen(); +} + +String contextMenuItemTagMediaPlay() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaPlay(); +} + +String contextMenuItemTagMediaPause() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaPause(); +} + +String contextMenuItemTagMediaMute() +{ + return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaMute(); +} String contextMenuItemTagInspectElement() { diff --git a/WebCore/platform/LocalizedStrings.h b/WebCore/platform/LocalizedStrings.h index 04042b6..a72eb8a 100644 --- a/WebCore/platform/LocalizedStrings.h +++ b/WebCore/platform/LocalizedStrings.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2003, 2006, 2009 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -108,6 +109,16 @@ namespace WebCore { String contextMenuItemTagCapitalize(); String contextMenuItemTagChangeBack(const String& replacedString); #endif + String contextMenuItemTagOpenVideoInNewWindow(); + String contextMenuItemTagOpenAudioInNewWindow(); + String contextMenuItemTagCopyVideoLinkToClipboard(); + String contextMenuItemTagCopyAudioLinkToClipboard(); + String contextMenuItemTagToggleMediaControls(); + String contextMenuItemTagToggleMediaLoop(); + String contextMenuItemTagEnterVideoFullscreen(); + String contextMenuItemTagMediaPlay(); + String contextMenuItemTagMediaPause(); + String contextMenuItemTagMediaMute(); String contextMenuItemTagInspectElement(); #endif // ENABLE(CONTEXT_MENUS) diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h index 19cb8e9..f8d503d 100644 --- a/WebCore/platform/PlatformTouchEvent.h +++ b/WebCore/platform/PlatformTouchEvent.h @@ -35,6 +35,12 @@ QT_END_NAMESPACE #include "IntPoint.h" #endif +#if PLATFORM(BREWMP) +typedef unsigned short uint16; +typedef unsigned long int uint32; +#define AEEEvent uint16 +#endif + namespace WebCore { enum TouchEventType { @@ -61,6 +67,11 @@ public: PlatformTouchEvent(QTouchEvent*); #elif PLATFORM(ANDROID) PlatformTouchEvent(const Vector<IntPoint>&, TouchEventType, PlatformTouchPoint::State, int metaState); +<<<<<<< HEAD +======= +#elif PLATFORM(BREWMP) + PlatformTouchEvent(AEEEvent, uint16 wParam, uint32 dwParam); +>>>>>>> webkit.org at r68651 #endif TouchEventType type() const { return m_type; } diff --git a/WebCore/platform/PlatformTouchPoint.h b/WebCore/platform/PlatformTouchPoint.h index 4b8ebae..f330eb6 100644 --- a/WebCore/platform/PlatformTouchPoint.h +++ b/WebCore/platform/PlatformTouchPoint.h @@ -48,6 +48,11 @@ public: PlatformTouchPoint() {}; #elif PLATFORM(ANDROID) PlatformTouchPoint(unsigned id, const IntPoint& windowPos, State); +<<<<<<< HEAD +======= +#elif PLATFORM(BREWMP) + PlatformTouchPoint(int id, const IntPoint& windowPos, State); +>>>>>>> webkit.org at r68651 #endif unsigned id() const { return m_id; } diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp index 0273807..0e95e22 100644 --- a/WebCore/platform/ScrollView.cpp +++ b/WebCore/platform/ScrollView.cpp @@ -383,6 +383,14 @@ bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity return false; } +void ScrollView::windowResizerRectChanged() +{ + if (platformWidget()) + return; + + updateScrollbars(scrollOffset()); +} + static const unsigned cMaxUpdateScrollbarsPass = 2; void ScrollView::updateScrollbars(const IntSize& desiredOffset) diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h index 751b276..1744963 100644 --- a/WebCore/platform/ScrollView.h +++ b/WebCore/platform/ScrollView.h @@ -195,6 +195,8 @@ public: virtual IntRect windowResizerRect() const { return IntRect(); } bool containsScrollbarsAvoidingResizer() const; void adjustScrollbarsAvoidingResizerCount(int overlapDelta); + void windowResizerRectChanged(); + virtual void setParent(ScrollView*); // Overridden to update the overlapping scrollbar count. // Called when our frame rect changes (or the rect/scroll position of an ancestor changes). diff --git a/WebCore/platform/Scrollbar.cpp b/WebCore/platform/Scrollbar.cpp index 398584a..72f0639 100644 --- a/WebCore/platform/Scrollbar.cpp +++ b/WebCore/platform/Scrollbar.cpp @@ -40,7 +40,7 @@ using namespace std; -#if PLATFORM(CHROMIUM) && OS(LINUX) || PLATFORM(GTK) +#if (PLATFORM(CHROMIUM) && (OS(LINUX) || OS(FREEBSD))) || PLATFORM(GTK) // The position of the scrollbar thumb affects the appearance of the steppers, so // when the thumb moves, we have to invalidate them for painting. #define THUMB_POSITION_AFFECTS_BUTTONS diff --git a/WebCore/platform/Widget.cpp b/WebCore/platform/Widget.cpp index 1370863..05a5237 100644 --- a/WebCore/platform/Widget.cpp +++ b/WebCore/platform/Widget.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -127,6 +127,7 @@ IntPoint Widget::convertFromContainingWindowToRoot(const Widget*, const IntPoint } #endif +<<<<<<< HEAD #if !PLATFORM(MAC) && !PLATFORM(GTK) && !OS(ANDROID) void Widget::releasePlatformWidget() { @@ -137,6 +138,8 @@ void Widget::retainPlatformWidget() } #endif +======= +>>>>>>> webkit.org at r68651 IntRect Widget::convertToContainingView(const IntRect& localRect) const { if (const ScrollView* parentScrollView = parent()) { diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h index 58d4e57..90d38a9 100644 --- a/WebCore/platform/Widget.h +++ b/WebCore/platform/Widget.h @@ -27,6 +27,22 @@ #ifndef Widget_h #define Widget_h +#include "IntRect.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> + +#if PLATFORM(CHROMIUM) +#include "PlatformWidget.h" +#endif + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif + +#if PLATFORM(QT) +#include <qglobal.h> +#endif + #if PLATFORM(MAC) #ifdef __OBJC__ @class NSView; @@ -35,7 +51,7 @@ class NSView; class NSWindow; #endif -typedef NSView* PlatformWidget; +typedef NSView *PlatformWidget; #endif #if PLATFORM(ANDROID) @@ -56,7 +72,6 @@ typedef GtkWidget* PlatformWidget; #endif #if PLATFORM(QT) -#include <qglobal.h> QT_BEGIN_NAMESPACE class QWidget; QT_END_NAMESPACE @@ -77,10 +92,6 @@ typedef BView* PlatformWidget; typedef void* PlatformWidget; #endif -#if PLATFORM(CHROMIUM) -#include "PlatformWidget.h" -#endif - #if PLATFORM(EFL) typedef struct _Evas_Object Evas_Object; typedef struct _Evas Evas; @@ -95,13 +106,6 @@ typedef QWebPageClient* PlatformPageClient; typedef PlatformWidget PlatformPageClient; #endif -#include "IntPoint.h" -#include "IntRect.h" -#include "IntSize.h" - -#include <wtf/Forward.h> -#include <wtf/RefCounted.h> - namespace WebCore { class Cursor; @@ -132,15 +136,9 @@ public: Widget(PlatformWidget = 0); virtual ~Widget(); - PlatformWidget platformWidget() const { return m_widget; } - void setPlatformWidget(PlatformWidget widget) - { - if (widget != m_widget) { - releasePlatformWidget(); - m_widget = widget; - retainPlatformWidget(); - } - } + PlatformWidget platformWidget() const; + void setPlatformWidget(PlatformWidget); + #if PLATFORM(HAIKU) PlatformWidget topLevelPlatformWidget() const { return m_topLevelPlatformWidget; } void setTopLevelPlatformWidget(PlatformWidget widget) @@ -256,7 +254,11 @@ private: private: ScrollView* m_parent; +#if !PLATFORM(MAC) PlatformWidget m_widget; +#else + RetainPtr<NSView> m_widget; +#endif bool m_selfVisible; bool m_parentVisible; @@ -283,6 +285,36 @@ public: #endif }; +#if !PLATFORM(MAC) + +inline PlatformWidget Widget::platformWidget() const +{ + return m_widget; +} + +inline void Widget::setPlatformWidget(PlatformWidget widget) +{ + if (widget != m_widget) { + releasePlatformWidget(); + m_widget = widget; + retainPlatformWidget(); + } +} + +#endif + +#if !PLATFORM(GTK) + +inline void Widget::releasePlatformWidget() +{ +} + +inline void Widget::retainPlatformWidget() +{ +} + +#endif + } // namespace WebCore #endif // Widget_h diff --git a/WebCore/platform/android/ClipboardAndroid.cpp b/WebCore/platform/android/ClipboardAndroid.cpp index d9b2d68..a91fd21 100644 --- a/WebCore/platform/android/ClipboardAndroid.cpp +++ b/WebCore/platform/android/ClipboardAndroid.cpp @@ -40,8 +40,8 @@ PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame* return 0; } -ClipboardAndroid::ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging) - : Clipboard(policy, isForDragging) +ClipboardAndroid::ClipboardAndroid(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(policy, clipboardType) { } @@ -51,12 +51,12 @@ ClipboardAndroid::~ClipboardAndroid() void ClipboardAndroid::clearData(const String&) { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); } void ClipboardAndroid::clearAllData() { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); } String ClipboardAndroid::getData(const String&, bool& success) const @@ -67,7 +67,7 @@ String ClipboardAndroid::getData(const String&, bool& success) const bool ClipboardAndroid::setData(const String&, const String&) { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); return false; } diff --git a/WebCore/platform/android/ClipboardAndroid.h b/WebCore/platform/android/ClipboardAndroid.h index 23bfdf6..807653b 100644 --- a/WebCore/platform/android/ClipboardAndroid.h +++ b/WebCore/platform/android/ClipboardAndroid.h @@ -37,7 +37,7 @@ class CachedImage; class ClipboardAndroid : public Clipboard, public CachedResourceClient { public: - ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging); + ClipboardAndroid(ClipboardAccessPolicy policy, ClipboardType); ~ClipboardAndroid(); void clearData(const String&); diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp index 5ca7fa2..635f741 100644 --- a/WebCore/platform/android/LocalizedStringsAndroid.cpp +++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp @@ -98,6 +98,66 @@ String contextMenuItemTagCopyImageToClipboard() return String(); } +String contextMenuItemTagOpenVideoInNewWindow() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagToggleMediaControls() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagToggleMediaLoop() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagMediaPlay() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagMediaPause() +{ + notImplemented(); + return String(); +} + +String contextMenuItemTagMediaMute() +{ + notImplemented(); + return String(); +} + String contextMenuItemTagOpenFrameInNewWindow() { notImplemented(); diff --git a/WebCore/platform/android/PlatformTouchEventAndroid.cpp b/WebCore/platform/android/PlatformTouchEventAndroid.cpp index 8b3d285..eb23322 100644 --- a/WebCore/platform/android/PlatformTouchEventAndroid.cpp +++ b/WebCore/platform/android/PlatformTouchEventAndroid.cpp @@ -43,7 +43,11 @@ PlatformTouchEvent::PlatformTouchEvent(const Vector<IntPoint>& windowPoints, Tou { m_touchPoints.reserveCapacity(windowPoints.size()); for (unsigned c = 0; c < windowPoints.size(); c++) +<<<<<<< HEAD m_touchPoints.append(PlatformTouchPoint(c, windowPoints[c], state)); +======= + m_touchPoints.append(PlatformTouchPoint(windowPos, state)); +>>>>>>> webkit.org at r68651 m_altKey = metaState & META_ALT_ON; m_shiftKey = metaState & META_SHIFT_ON; diff --git a/WebCore/platform/audio/AudioDestination.h b/WebCore/platform/audio/AudioDestination.h new file mode 100644 index 0000000..9498110 --- /dev/null +++ b/WebCore/platform/audio/AudioDestination.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AudioDestination_h +#define AudioDestination_h + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +class AudioSourceProvider; + +// Abstraction for an audio output to the audio hardware +// An AudioSourceProvider is called back periodically to provide the rendered audio stream. + +class AudioDestination { +public: + static PassOwnPtr<AudioDestination> create(AudioSourceProvider&, double sampleRate); + + virtual ~AudioDestination() { } + + virtual void start() = 0; + virtual void stop() = 0; + virtual bool isPlaying() = 0; + + // Sample-rate conversion may happen in AudioDestination to the hardware sample-rate + virtual double sampleRate() const = 0; + static double hardwareSampleRate(); +}; + +} // namespace WebCore + +#endif // AudioDestination_h diff --git a/WebCore/platform/audio/HRTFDatabase.cpp b/WebCore/platform/audio/HRTFDatabase.cpp new file mode 100644 index 0000000..ef1229f --- /dev/null +++ b/WebCore/platform/audio/HRTFDatabase.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "HRTFDatabase.h" + +#include "HRTFElevation.h" + +using namespace std; + +namespace WebCore { + +const int HRTFDatabase::MinElevation = -45; +const int HRTFDatabase::MaxElevation = 90; +const unsigned HRTFDatabase::RawElevationAngleSpacing = 15; +const unsigned HRTFDatabase::NumberOfRawElevations = 10; // -45 -> +90 (each 15 degrees) +const unsigned HRTFDatabase::InterpolationFactor = 1; +const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * InterpolationFactor; + +PassOwnPtr<HRTFDatabase> HRTFDatabase::create(double sampleRate) +{ + OwnPtr<HRTFDatabase> hrtfDatabase = adoptPtr(new HRTFDatabase(sampleRate)); + return hrtfDatabase.release(); +} + +HRTFDatabase::HRTFDatabase(double sampleRate) + : m_elevations(NumberOfTotalElevations) + , m_sampleRate(sampleRate) +{ + unsigned elevationIndex = 0; + for (int elevation = MinElevation; elevation <= MaxElevation; elevation += RawElevationAngleSpacing) { + OwnPtr<HRTFElevation> hrtfElevation = HRTFElevation::createForSubject("Composite", elevation, sampleRate); + ASSERT(hrtfElevation.get()); + if (!hrtfElevation.get()) + return; + + m_elevations[elevationIndex] = hrtfElevation.release(); + elevationIndex += InterpolationFactor; + } + + // Now, go back and interpolate elevations. + if (InterpolationFactor > 1) { + for (unsigned i = 0; i < NumberOfTotalElevations; i += InterpolationFactor) { + unsigned j = (i + InterpolationFactor); + if (j >= NumberOfTotalElevations) + j = i; // for last elevation interpolate with itself + + // Create the interpolated convolution kernels and delays. + for (unsigned jj = 1; jj < InterpolationFactor; ++jj) { + double x = static_cast<double>(jj) / static_cast<double>(InterpolationFactor); + m_elevations[i + jj] = HRTFElevation::createByInterpolatingSlices(m_elevations[i].get(), m_elevations[j].get(), x, sampleRate); + ASSERT(m_elevations[i + jj].get()); + } + } + } +} + +void HRTFDatabase::getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthIndex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, + double& frameDelayL, double& frameDelayR) +{ + unsigned elevationIndex = indexFromElevationAngle(elevationAngle); + ASSERT(elevationIndex < m_elevations.size() && m_elevations.size() > 0); + + if (!m_elevations.size()) { + kernelL = 0; + kernelR = 0; + return; + } + + if (elevationIndex > m_elevations.size() - 1) + elevationIndex = m_elevations.size() - 1; + + HRTFElevation* hrtfElevation = m_elevations[elevationIndex].get(); + ASSERT(hrtfElevation); + if (!hrtfElevation) { + kernelL = 0; + kernelR = 0; + return; + } + + hrtfElevation->getKernelsFromAzimuth(azimuthBlend, azimuthIndex, kernelL, kernelR, frameDelayL, frameDelayR); +} + +unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle) +{ + // Clamp to allowed range. + elevationAngle = max(static_cast<double>(MinElevation), elevationAngle); + elevationAngle = min(static_cast<double>(MaxElevation), elevationAngle); + + unsigned elevationIndex = static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) / RawElevationAngleSpacing); + return elevationIndex; +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/platform/audio/HRTFDatabase.h b/WebCore/platform/audio/HRTFDatabase.h new file mode 100644 index 0000000..c33b38f --- /dev/null +++ b/WebCore/platform/audio/HRTFDatabase.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HRTFDatabase_h +#define HRTFDatabase_h + +#include "HRTFElevation.h" +#include <wtf/HashMap.h> +#include <wtf/Noncopyable.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class HRTFKernel; + +class HRTFDatabase : public Noncopyable { +public: + static PassOwnPtr<HRTFDatabase> create(double sampleRate); + + // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and an interpolated left and right frame delay for the given azimuth and elevation. + // azimuthBlend must be in the range 0 -> 1. + // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimuths - 1 (corresponding to angles of 0 -> 360). + // Valid values for elevationAngle are MinElevation -> MaxElevation. + void getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthIndex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR); + + // Returns the number of different azimuth angles. + static unsigned numberOfAzimuths() { return HRTFElevation::NumberOfTotalAzimuths; } + + double sampleRate() const { return m_sampleRate; } + +private: + explicit HRTFDatabase(double sampleRate); + + // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase. + static const int MinElevation; + static const int MaxElevation; + static const unsigned RawElevationAngleSpacing; + + // Number of elevations loaded from resource. + static const unsigned NumberOfRawElevations; + + // Interpolates by this factor to get the total number of elevations from every elevation loaded from resource. + static const unsigned InterpolationFactor; + + // Total number of elevations after interpolation. + static const unsigned NumberOfTotalElevations; + + // Returns the index for the correct HRTFElevation given the elevation angle. + static unsigned indexFromElevationAngle(double); + + Vector<OwnPtr<HRTFElevation> > m_elevations; + double m_sampleRate; +}; + +} // namespace WebCore + +#endif // HRTFDatabase_h diff --git a/WebCore/platform/audio/HRTFDatabaseLoader.cpp b/WebCore/platform/audio/HRTFDatabaseLoader.cpp new file mode 100644 index 0000000..4368d22 --- /dev/null +++ b/WebCore/platform/audio/HRTFDatabaseLoader.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "HRTFDatabaseLoader.h" + +#include "HRTFDatabase.h" + +namespace WebCore { + +// Singleton +HRTFDatabaseLoader* HRTFDatabaseLoader::s_loader = 0; + +PassRefPtr<HRTFDatabaseLoader> HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(double sampleRate) +{ + ASSERT(isMainThread()); + + RefPtr<HRTFDatabaseLoader> loader; + + if (!s_loader) { + // Lazily create and load. + loader = adoptRef(new HRTFDatabaseLoader(sampleRate)); + s_loader = loader.get(); + loader->loadAsynchronously(); + } else { + loader = s_loader; + ASSERT(sampleRate == loader->databaseSampleRate()); + } + + return loader; +} + +HRTFDatabaseLoader::HRTFDatabaseLoader(double sampleRate) + : m_hrtfDatabase(0) + , m_databaseLoaderThread(0) + , m_startedLoadingDatabase(false) + , m_databaseSampleRate(sampleRate) +{ + ASSERT(isMainThread()); +} + +HRTFDatabaseLoader::~HRTFDatabaseLoader() +{ + ASSERT(isMainThread()); + + if (m_startedLoadingDatabase) + waitForThreadCompletion(m_databaseLoaderThread, 0); + + m_startedLoadingDatabase = false; + m_databaseLoaderThread = 0; + + m_hrtfDatabase.clear(); + + // Clear out singleton. + ASSERT(this == s_loader); + s_loader = 0; +} + + +// Asynchronously load the database in this thread. +static void* databaseLoaderEntry(void* threadData) +{ + HRTFDatabaseLoader* loader = reinterpret_cast<HRTFDatabaseLoader*>(threadData); + ASSERT(loader); + loader->load(); + + return 0; +} + +void HRTFDatabaseLoader::load() +{ + ASSERT(!isMainThread()); + if (!m_hrtfDatabase.get()) { + // Load the default HRTF database. + m_hrtfDatabase = HRTFDatabase::create(m_databaseSampleRate); + } +} + +void HRTFDatabaseLoader::loadAsynchronously() +{ + ASSERT(isMainThread()); + + if (!m_hrtfDatabase.get() && !m_startedLoadingDatabase) { + // Start the asynchronous database loading process. + m_startedLoadingDatabase = true; + m_databaseLoaderThread = createThread(databaseLoaderEntry, this, "HRTF database loader"); + } +} + +bool HRTFDatabaseLoader::isLoaded() const +{ + return m_hrtfDatabase.get(); +} + +HRTFDatabase* HRTFDatabaseLoader::defaultHRTFDatabase() +{ + if (!s_loader) + return 0; + + return s_loader->database(); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/platform/audio/HRTFDatabaseLoader.h b/WebCore/platform/audio/HRTFDatabaseLoader.h new file mode 100644 index 0000000..72002c5 --- /dev/null +++ b/WebCore/platform/audio/HRTFDatabaseLoader.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HRTFDatabaseLoader_h +#define HRTFDatabaseLoader_h + +#include "HRTFDatabase.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/Threading.h> + +namespace WebCore { + +// HRTFDatabaseLoader will asynchronously load the default HRTFDatabase in a new thread. + +class HRTFDatabaseLoader : public RefCounted<HRTFDatabaseLoader> { +public: + // Lazily creates the singleton HRTFDatabaseLoader (if not already created) and starts loading asynchronously (when created the first time). + // Returns the singleton HRTFDatabaseLoader. + // Must be called from the main thread. + static PassRefPtr<HRTFDatabaseLoader> createAndLoadAsynchronouslyIfNecessary(double sampleRate); + + // Both constructor and destructor must be called from the main thread. + ~HRTFDatabaseLoader(); + + // Returns true once the default database has been completely loaded. + bool isLoaded() const; + + HRTFDatabase* database() { return m_hrtfDatabase.get(); } + + // Called in asynchronous loading thread. + void load(); + + // defaultHRTFDatabase() gives access to the loaded database. + // This can be called from any thread, but it is the callers responsibilty to call this while the context (and thus HRTFDatabaseLoader) + // is still alive. Otherwise this will return 0. + static HRTFDatabase* defaultHRTFDatabase(); + +private: + // Both constructor and destructor must be called from the main thread. + explicit HRTFDatabaseLoader(double sampleRate); + + // If it hasn't already been loaded, creates a new thread and initiates asynchronous loading of the default database. + // This must be called from the main thread. + void loadAsynchronously(); + + double databaseSampleRate() const { return m_databaseSampleRate; } + + static HRTFDatabaseLoader* s_loader; // singleton + OwnPtr<HRTFDatabase> m_hrtfDatabase; + ThreadIdentifier m_databaseLoaderThread; + bool m_startedLoadingDatabase; + double m_databaseSampleRate; +}; + + +} // namespace WebCore + +#endif // HRTFDatabaseLoader_h diff --git a/WebCore/platform/audio/HRTFElevation.cpp b/WebCore/platform/audio/HRTFElevation.cpp new file mode 100644 index 0000000..ac1eb4d --- /dev/null +++ b/WebCore/platform/audio/HRTFElevation.cpp @@ -0,0 +1,266 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "HRTFElevation.h" + +#include "AudioBus.h" +#include "AudioFileReader.h" +#include "AudioResources.h" +#include "Biquad.h" +#include "FFTFrame.h" +#include "HRTFPanner.h" +#include <algorithm> +#include <math.h> +#include <wtf/OwnPtr.h> + +using namespace std; + +namespace WebCore { + +const unsigned HRTFElevation::AzimuthSpacing = 15; +const unsigned HRTFElevation::NumberOfRawAzimuths = 360 / AzimuthSpacing; +const unsigned HRTFElevation::InterpolationFactor = 8; +const unsigned HRTFElevation::NumberOfTotalAzimuths = NumberOfRawAzimuths * InterpolationFactor; + +// Takes advantage of the symmetry and creates a composite version of the two measured versions. For example, we have both azimuth 30 and -30 degrees +// where the roles of left and right ears are reversed with respect to each other. +bool HRTFElevation::calculateSymmetricKernelsForAzimuthElevation(int azimuth, int elevation, double sampleRate, const String& subjectName, + RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR) +{ + RefPtr<HRTFKernel> kernelL1; + RefPtr<HRTFKernel> kernelR1; + bool success = calculateKernelsForAzimuthElevation(azimuth, elevation, sampleRate, subjectName, kernelL1, kernelR1); + if (!success) + return false; + + // And symmetric version + int symmetricAzimuth = !azimuth ? 0 : 360 - azimuth; + + RefPtr<HRTFKernel> kernelL2; + RefPtr<HRTFKernel> kernelR2; + success = calculateKernelsForAzimuthElevation(symmetricAzimuth, elevation, sampleRate, subjectName, kernelL2, kernelR2); + if (!success) + return false; + + // Notice L/R reversal in symmetric version. + kernelL = HRTFKernel::createInterpolatedKernel(kernelL1.get(), kernelR2.get(), 0.5); + kernelR = HRTFKernel::createInterpolatedKernel(kernelR1.get(), kernelL2.get(), 0.5); + + return true; +} + +bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, double sampleRate, const String& subjectName, + RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR) +{ + // Valid values for azimuth are 0 -> 345 in 15 degree increments. + // Valid values for elevation are -45 -> +90 in 15 degree increments. + + bool isAzimuthGood = azimuth >= 0 && azimuth <= 345 && (azimuth / 15) * 15 == azimuth; + ASSERT(isAzimuthGood); + if (!isAzimuthGood) + return false; + + bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation; + ASSERT(isElevationGood); + if (!isElevationGood) + return false; + + // Construct the resource name from the subject name, azimuth, and elevation, for example: + // "IRC_Composite_C_R0195_T015_P000" + // Note: the passed in subjectName is not a string passed in via JavaScript or the web. + // It's passed in as an internal ASCII identifier and is an implementation detail. + int positiveElevation = elevation < 0 ? elevation + 360 : elevation; + String resourceName = String::format("IRC_%s_C_R0195_T%03d_P%03d", subjectName.utf8().data(), azimuth, positiveElevation); + + OwnPtr<AudioBus> impulseResponse(createBusFromAudioFileResource(resourceName, sampleRate)); + + ASSERT(impulseResponse.get()); + if (!impulseResponse.get()) + return false; + + size_t responseLength = impulseResponse->length(); + + // Check number of channels and length. For now these are fixed and known. + bool isBusGood = responseLength == 512 && impulseResponse->numberOfChannels() == 2; + ASSERT(isBusGood); + if (!isBusGood) + return false; + + AudioChannel* leftEarImpulseResponse = impulseResponse->channelByType(AudioBus::ChannelLeft); + AudioChannel* rightEarImpulseResponse = impulseResponse->channelByType(AudioBus::ChannelRight); + + // Note that depending on the fftSize returned by the panner, we may be truncating the impulse response we just loaded in. + const size_t fftSize = HRTFPanner::fftSizeForSampleRate(sampleRate); + kernelL = HRTFKernel::create(leftEarImpulseResponse, fftSize, sampleRate, true); + kernelR = HRTFKernel::create(rightEarImpulseResponse, fftSize, sampleRate, true); + + return true; +} + +// The range of elevations for the IRCAM impulse responses varies depending on azimuth, but the minimum elevation appears to always be -45. +// +// Here's how it goes: +static int maxElevations[] = { + // Azimuth + // + 90, // 0 + 45, // 15 + 60, // 30 + 45, // 45 + 75, // 60 + 45, // 75 + 60, // 90 + 45, // 105 + 75, // 120 + 45, // 135 + 60, // 150 + 45, // 165 + 75, // 180 + 45, // 195 + 60, // 210 + 45, // 225 + 75, // 240 + 45, // 255 + 60, // 270 + 45, // 285 + 75, // 300 + 45, // 315 + 60, // 330 + 45 // 345 +}; + +PassOwnPtr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, double sampleRate) +{ + bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation; + ASSERT(isElevationGood); + if (!isElevationGood) + return 0; + + OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + + // Load convolution kernels from HRTF files. + int interpolatedIndex = 0; + for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) { + // Don't let elevation exceed maximum for this azimuth. + int maxElevation = maxElevations[rawIndex]; + int actualElevation = min(elevation, maxElevation); + + bool success = calculateKernelsForAzimuthElevation(rawIndex * AzimuthSpacing, actualElevation, sampleRate, subjectName, kernelListL->at(interpolatedIndex), kernelListR->at(interpolatedIndex)); + if (!success) + return 0; + + interpolatedIndex += InterpolationFactor; + } + + // Now go back and interpolate intermediate azimuth values. + for (unsigned i = 0; i < NumberOfTotalAzimuths; i += InterpolationFactor) { + int j = (i + InterpolationFactor) % NumberOfTotalAzimuths; + + // Create the interpolated convolution kernels and delays. + for (unsigned jj = 1; jj < InterpolationFactor; ++jj) { + double x = double(jj) / double(InterpolationFactor); // interpolate from 0 -> 1 + + (*kernelListL)[i + jj] = HRTFKernel::createInterpolatedKernel(kernelListL->at(i).get(), kernelListL->at(j).get(), x); + (*kernelListR)[i + jj] = HRTFKernel::createInterpolatedKernel(kernelListR->at(i).get(), kernelListR->at(j).get(), x); + } + } + + OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(kernelListL.release(), kernelListR.release(), elevation, sampleRate)); + return hrtfElevation.release(); +} + +PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, double x, double sampleRate) +{ + ASSERT(hrtfElevation1 && hrtfElevation2); + if (!hrtfElevation1 || !hrtfElevation2) + return 0; + + ASSERT(x >= 0.0 && x < 1.0); + + OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + + HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); + HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); + HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL(); + HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR(); + + // Interpolate kernels of corresponding azimuths of the two elevations. + for (unsigned i = 0; i < NumberOfTotalAzimuths; ++i) { + (*kernelListL)[i] = HRTFKernel::createInterpolatedKernel(kernelListL1->at(i).get(), kernelListL2->at(i).get(), x); + (*kernelListR)[i] = HRTFKernel::createInterpolatedKernel(kernelListR1->at(i).get(), kernelListR2->at(i).get(), x); + } + + // Interpolate elevation angle. + double angle = (1.0 - x) * hrtfElevation1->elevationAngle() + x * hrtfElevation2->elevationAngle(); + + OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(kernelListL.release(), kernelListR.release(), angle, sampleRate)); + return hrtfElevation.release(); +} + +void HRTFElevation::getKernelsFromAzimuth(double azimuthBlend, unsigned azimuthIndex, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR) +{ + bool checkAzimuthBlend = azimuthBlend >= 0.0 && azimuthBlend < 1.0; + ASSERT(checkAzimuthBlend); + if (!checkAzimuthBlend) + azimuthBlend = 0.0; + + unsigned numKernels = m_kernelListL->size(); + + bool isIndexGood = azimuthIndex < numKernels; + ASSERT(isIndexGood); + if (!isIndexGood) { + kernelL = 0; + kernelR = 0; + return; + } + + // Return the left and right kernels. + kernelL = m_kernelListL->at(azimuthIndex).get(); + kernelR = m_kernelListR->at(azimuthIndex).get(); + + frameDelayL = m_kernelListL->at(azimuthIndex)->frameDelay(); + frameDelayR = m_kernelListR->at(azimuthIndex)->frameDelay(); + + int azimuthIndex2 = (azimuthIndex + 1) % numKernels; + double frameDelay2L = m_kernelListL->at(azimuthIndex2)->frameDelay(); + double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); + + // Linearly interpolate delays. + frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; + frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/platform/audio/HRTFElevation.h b/WebCore/platform/audio/HRTFElevation.h new file mode 100644 index 0000000..b388b34 --- /dev/null +++ b/WebCore/platform/audio/HRTFElevation.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HRTFElevation_h +#define HRTFElevation_h + +#include "HRTFKernel.h" +#include <wtf/Noncopyable.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +// HRTFElevation contains all of the HRTFKernels (one left ear and one right ear per azimuth angle) for a particular elevation. + +class HRTFElevation : public Noncopyable { +public: + // Loads and returns an HRTFElevation with the given HRTF database subject name and elevation from browser (or WebKit.framework) resources. + // Normally, there will only be a single HRTF database set, but this API supports the possibility of multiple ones with different names. + // Interpolated azimuths will be generated based on InterpolationFactor. + // Valid values for elevation are -45 -> +90 in 15 degree increments. + static PassOwnPtr<HRTFElevation> createForSubject(const String& subjectName, int elevation, double sampleRate); + + // Given two HRTFElevations, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFElevation. + static PassOwnPtr<HRTFElevation> createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, double x, double sampleRate); + + // Returns the list of left or right ear HRTFKernels for all the azimuths going from 0 to 360 degrees. + HRTFKernelList* kernelListL() { return m_kernelListL.get(); } + HRTFKernelList* kernelListR() { return m_kernelListR.get(); } + + double elevationAngle() const { return m_elevationAngle; } + unsigned numberOfAzimuths() { return NumberOfTotalAzimuths; } + double sampleRate() const { return m_sampleRate; } + + // Returns the left and right kernels for the given azimuth index. + // The interpolated delays based on azimuthBlend: 0 -> 1 are returned in frameDelayL and frameDelayR. + void getKernelsFromAzimuth(double azimuthBlend, unsigned azimuthIndex, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR); + + // Spacing, in degrees, between every azimuth loaded from resource. + static const unsigned AzimuthSpacing; + + // Number of azimuths loaded from resource. + static const unsigned NumberOfRawAzimuths; + + // Interpolates by this factor to get the total number of azimuths from every azimuth loaded from resource. + static const unsigned InterpolationFactor; + + // Total number of azimuths after interpolation. + static const unsigned NumberOfTotalAzimuths; + + // Given a specific azimuth and elevation angle, returns the left and right HRTFKernel. + // Valid values for azimuth are 0 -> 345 in 15 degree increments. + // Valid values for elevation are -45 -> +90 in 15 degree increments. + // Returns true on success. + static bool calculateKernelsForAzimuthElevation(int azimuth, int elevation, double sampleRate, const String& subjectName, + RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR); + + // Given a specific azimuth and elevation angle, returns the left and right HRTFKernel in kernelL and kernelR. + // This method averages the measured response using symmetry of azimuth (for example by averaging the -30.0 and +30.0 azimuth responses). + // Returns true on success. + static bool calculateSymmetricKernelsForAzimuthElevation(int azimuth, int elevation, double sampleRate, const String& subjectName, + RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR); +private: + HRTFElevation(PassOwnPtr<HRTFKernelList> kernelListL, PassOwnPtr<HRTFKernelList> kernelListR, int elevation, double sampleRate) + : m_kernelListL(kernelListL) + , m_kernelListR(kernelListR) + , m_elevationAngle(elevation) + , m_sampleRate(sampleRate) + { + } + + OwnPtr<HRTFKernelList> m_kernelListL; + OwnPtr<HRTFKernelList> m_kernelListR; + double m_elevationAngle; + double m_sampleRate; +}; + +} // namespace WebCore + +#endif // HRTFElevation_h diff --git a/WebCore/platform/audio/HRTFKernel.cpp b/WebCore/platform/audio/HRTFKernel.cpp new file mode 100644 index 0000000..852cdbf --- /dev/null +++ b/WebCore/platform/audio/HRTFKernel.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "HRTFKernel.h" + +#include "AudioChannel.h" +#include "Biquad.h" +#include "FFTFrame.h" + +using namespace std; + +namespace WebCore { + +// Takes the input AudioChannel as an input impulse response and calculates the average group delay. +// This represents the initial delay before the most energetic part of the impulse response. +// The sample-frame delay is removed from the impulseP impulse response, and this value is returned. +// the length of the passed in AudioChannel must be a power of 2. +static double extractAverageGroupDelay(AudioChannel* channel) +{ + ASSERT(channel); + + float* impulseP = channel->data(); + size_t length = channel->length(); + + // Check that length is power-of-2; + ASSERT(1UL << static_cast<unsigned>(log2(length)) == length); + + FFTFrame estimationFrame(length); + estimationFrame.doFFT(impulseP); + + double frameDelay = estimationFrame.extractAverageGroupDelay(); + estimationFrame.doInverseFFT(impulseP); + + return frameDelay; +} + +HRTFKernel::HRTFKernel(AudioChannel* channel, size_t fftSize, double sampleRate, bool bassBoost) + : m_frameDelay(0.0) + , m_sampleRate(sampleRate) +{ + ASSERT(channel); + + // Determine the leading delay (average group delay) for the response. + m_frameDelay = extractAverageGroupDelay(channel); + + float* impulseResponse = channel->data(); + size_t responseLength = channel->length(); + + if (bassBoost) { + // Run through some post-processing to boost the bass a little -- the HRTF's seem to be a little bass-deficient. + // FIXME: this post-processing should have already been applied to the HRTF file resources. Once the files are put into this form, + // then this code path can be removed along with the bassBoost parameter. + Biquad filter; + filter.setLowShelfParams(700.0 / nyquist(), 6.0); // boost 6dB at 700Hz + filter.process(impulseResponse, impulseResponse, responseLength); + } + + // We need to truncate to fit into 1/2 the FFT size (with zero padding) in order to do proper convolution. + size_t truncatedResponseLength = min(responseLength, fftSize / 2); // truncate if necessary to max impulse response length allowed by FFT + + // Quick fade-out (apply window) at truncation point + unsigned numberOfFadeOutFrames = static_cast<unsigned>(sampleRate / 4410); // 10 sample-frames @44.1KHz sample-rate + ASSERT(numberOfFadeOutFrames < truncatedResponseLength); + if (numberOfFadeOutFrames < truncatedResponseLength) { + for (unsigned i = truncatedResponseLength - numberOfFadeOutFrames; i < truncatedResponseLength; ++i) { + float x = 1.0f - static_cast<float>(i - (truncatedResponseLength - numberOfFadeOutFrames)) / numberOfFadeOutFrames; + impulseResponse[i] *= x; + } + } + + m_fftFrame = adoptPtr(new FFTFrame(fftSize)); + m_fftFrame->doPaddedFFT(impulseResponse, truncatedResponseLength); +} + +PassOwnPtr<AudioChannel> HRTFKernel::createImpulseResponse() +{ + OwnPtr<AudioChannel> channel = adoptPtr(new AudioChannel(fftSize())); + FFTFrame fftFrame(*m_fftFrame); + + // Add leading delay back in. + fftFrame.addConstantGroupDelay(m_frameDelay); + fftFrame.doInverseFFT(channel->data()); + + return channel.release(); +} + +// Interpolates two kernels with x: 0 -> 1 and returns the result. +PassRefPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, double x) +{ + ASSERT(kernel1 && kernel2); + if (!kernel1 || !kernel2) + return 0; + + ASSERT(x >= 0.0 && x < 1.0); + x = min(1.0, max(0.0, x)); + + double sampleRate1 = kernel1->sampleRate(); + double sampleRate2 = kernel2->sampleRate(); + ASSERT(sampleRate1 == sampleRate2); + if (sampleRate1 != sampleRate2) + return 0; + + double frameDelay = (1.0 - x) * kernel1->frameDelay() + x * kernel2->frameDelay(); + + OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), *kernel2->fftFrame(), x); + return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRate1); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/platform/audio/HRTFKernel.h b/WebCore/platform/audio/HRTFKernel.h new file mode 100644 index 0000000..572a085 --- /dev/null +++ b/WebCore/platform/audio/HRTFKernel.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HRTFKernel_h +#define HRTFKernel_h + +#include "FFTFrame.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class AudioChannel; + +// HRTF stands for Head-Related Transfer Function. +// HRTFKernel is a frequency-domain representation of an impulse-response used as part of the spatialized panning system. +// For a given azimuth / elevation angle there will be one HRTFKernel for the left ear transfer function, and one for the right ear. +// The leading delay (average group delay) for each impulse response is extracted: +// m_fftFrame is the frequency-domain representation of the impulse response with the delay removed +// m_frameDelay is the leading delay of the original impulse response. +class HRTFKernel : public RefCounted<HRTFKernel> { +public: + // Note: this is destructive on the passed in AudioChannel. + // The length of channel must be a power of two. + static PassRefPtr<HRTFKernel> create(AudioChannel* channel, size_t fftSize, double sampleRate, bool bassBoost) + { + return adoptRef(new HRTFKernel(channel, fftSize, sampleRate, bassBoost)); + } + + static PassRefPtr<HRTFKernel> create(PassOwnPtr<FFTFrame> fftFrame, double frameDelay, double sampleRate) + { + return adoptRef(new HRTFKernel(fftFrame, frameDelay, sampleRate)); + } + + // Given two HRTFKernels, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFKernel. + static PassRefPtr<HRTFKernel> createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, double x); + + FFTFrame* fftFrame() { return m_fftFrame.get(); } + + size_t fftSize() const { return m_fftFrame->fftSize(); } + double frameDelay() const { return m_frameDelay; } + + double sampleRate() const { return m_sampleRate; } + double nyquist() const { return 0.5 * sampleRate(); } + + // Converts back into impulse-response form. + PassOwnPtr<AudioChannel> createImpulseResponse(); + +private: + // Note: this is destructive on the passed in AudioChannel. + HRTFKernel(AudioChannel* channel, size_t fftSize, double sampleRate, bool bassBoost); + + HRTFKernel(PassOwnPtr<FFTFrame> fftFrame, double frameDelay, double sampleRate) + : m_fftFrame(fftFrame) + , m_frameDelay(frameDelay) + , m_sampleRate(sampleRate) + { + } + + OwnPtr<FFTFrame> m_fftFrame; + double m_frameDelay; + double m_sampleRate; +}; + +typedef Vector<RefPtr<HRTFKernel> > HRTFKernelList; + +} // namespace WebCore + +#endif // HRTFKernel_h diff --git a/WebCore/platform/audio/mac/AudioDestinationMac.cpp b/WebCore/platform/audio/mac/AudioDestinationMac.cpp new file mode 100644 index 0000000..523729f --- /dev/null +++ b/WebCore/platform/audio/mac/AudioDestinationMac.cpp @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "AudioDestinationMac.h" + +#include "AudioSourceProvider.h" +#include <CoreAudio/AudioHardware.h> + +namespace WebCore { + +const int kBufferSize = 128; + +// Factory method: Mac-implementation +PassOwnPtr<AudioDestination> AudioDestination::create(AudioSourceProvider& provider, double sampleRate) +{ + return adoptPtr(new AudioDestinationMac(provider, sampleRate)); +} + +double AudioDestination::hardwareSampleRate() +{ + // Determine the default output device's sample-rate. + AudioDeviceID deviceID = kAudioDeviceUnknown; + UInt32 infoSize = sizeof(deviceID); + + AudioObjectPropertyAddress defaultInputDeviceAddress = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; + OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &defaultInputDeviceAddress, 0, 0, &infoSize, (void*)&deviceID); + if (result) + return 0.0; // error + + Float64 nominalSampleRate; + infoSize = sizeof(Float64); + + AudioObjectPropertyAddress nominalSampleRateAddress = { kAudioDevicePropertyNominalSampleRate, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; + result = AudioObjectGetPropertyData(deviceID, &nominalSampleRateAddress, 0, 0, &infoSize, (void*)&nominalSampleRate); + if (result) + return 0.0; // error + + return nominalSampleRate; +} + +AudioDestinationMac::AudioDestinationMac(AudioSourceProvider& provider, double sampleRate) + : m_outputUnit(0) + , m_provider(provider) + , m_renderBus(2, kBufferSize, false) + , m_sampleRate(sampleRate) + , m_isPlaying(false) +{ + // Open and initialize DefaultOutputUnit + Component comp; + ComponentDescription desc; + + desc.componentType = kAudioUnitType_Output; + desc.componentSubType = kAudioUnitSubType_DefaultOutput; + desc.componentManufacturer = kAudioUnitManufacturer_Apple; + desc.componentFlags = 0; + desc.componentFlagsMask = 0; + comp = FindNextComponent(0, &desc); + + ASSERT(comp); + + OSStatus result = OpenAComponent(comp, &m_outputUnit); + ASSERT(!result); + + result = AudioUnitInitialize(m_outputUnit); + ASSERT(!result); + + configure(); +} + +AudioDestinationMac::~AudioDestinationMac() +{ + if (m_outputUnit) + CloseComponent(m_outputUnit); +} + +void AudioDestinationMac::configure() +{ + // Set render callback + AURenderCallbackStruct input; + input.inputProc = inputProc; + input.inputProcRefCon = this; + OSStatus result = AudioUnitSetProperty(m_outputUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Global, 0, &input, sizeof(input)); + ASSERT(!result); + + // Set stream format + AudioStreamBasicDescription streamFormat; + streamFormat.mSampleRate = m_sampleRate; + streamFormat.mFormatID = kAudioFormatLinearPCM; + streamFormat.mFormatFlags = kAudioFormatFlagsCanonical | kAudioFormatFlagIsNonInterleaved; + streamFormat.mBitsPerChannel = 8 * sizeof(AudioSampleType); + streamFormat.mChannelsPerFrame = 2; + streamFormat.mFramesPerPacket = 1; + streamFormat.mBytesPerPacket = sizeof(AudioSampleType); + streamFormat.mBytesPerFrame = sizeof(AudioSampleType); + + result = AudioUnitSetProperty(m_outputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, (void*)&streamFormat, sizeof(AudioStreamBasicDescription)); + ASSERT(!result); + + // Set the buffer frame size. + UInt32 bufferSize = kBufferSize; + result = AudioUnitSetProperty(m_outputUnit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Output, 0, (void*)&bufferSize, sizeof(bufferSize)); + ASSERT(!result); +} + +void AudioDestinationMac::start() +{ + OSStatus result = AudioOutputUnitStart(m_outputUnit); + + if (!result) + m_isPlaying = true; +} + +void AudioDestinationMac::stop() +{ + OSStatus result = AudioOutputUnitStop(m_outputUnit); + + if (!result) + m_isPlaying = false; +} + +// Pulls on our provider to get rendered audio stream. +OSStatus AudioDestinationMac::render(UInt32 numberOfFrames, AudioBufferList* ioData) +{ + AudioBuffer* buffers = ioData->mBuffers; + m_renderBus.setChannelMemory(0, (float*)buffers[0].mData, numberOfFrames); + m_renderBus.setChannelMemory(1, (float*)buffers[1].mData, numberOfFrames); + + m_provider.provideInput(&m_renderBus, numberOfFrames); + + return noErr; +} + +// DefaultOutputUnit callback +OSStatus AudioDestinationMac::inputProc(void* userData, AudioUnitRenderActionFlags*, const AudioTimeStamp*, UInt32 /*busNumber*/, UInt32 numberOfFrames, AudioBufferList* ioData) +{ + AudioDestinationMac* audioOutput = static_cast<AudioDestinationMac*>(userData); + return audioOutput->render(numberOfFrames, ioData); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/platform/audio/mac/AudioDestinationMac.h b/WebCore/platform/audio/mac/AudioDestinationMac.h new file mode 100644 index 0000000..197440c --- /dev/null +++ b/WebCore/platform/audio/mac/AudioDestinationMac.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AudioDestinationMac_h +#define AudioDestinationMac_h + +#include "AudioBus.h" +#include "AudioDestination.h" +#include <AudioUnit/AudioUnit.h> + +namespace WebCore { + +// An AudioDestination using CoreAudio's default output AudioUnit + +class AudioDestinationMac : public AudioDestination { +public: + AudioDestinationMac(AudioSourceProvider&, double sampleRate); + virtual ~AudioDestinationMac(); + + virtual void start(); + virtual void stop(); + bool isPlaying() { return m_isPlaying; } + + double sampleRate() const { return m_sampleRate; } + +private: + void configure(); + + // DefaultOutputUnit callback + static OSStatus inputProc(void* userData, AudioUnitRenderActionFlags*, const AudioTimeStamp*, UInt32 busNumber, UInt32 numberOfFrames, AudioBufferList* ioData); + + OSStatus render(UInt32 numberOfFrames, AudioBufferList* ioData); + + AudioUnit m_outputUnit; + AudioSourceProvider& m_provider; + AudioBus m_renderBus; + + double m_sampleRate; + bool m_isPlaying; +}; + +} // namespace WebCore + +#endif // AudioDestinationMac_h diff --git a/WebCore/platform/brew/ClipboardBrew.cpp b/WebCore/platform/brew/ClipboardBrew.cpp index 720d6a6..10025d6 100644 --- a/WebCore/platform/brew/ClipboardBrew.cpp +++ b/WebCore/platform/brew/ClipboardBrew.cpp @@ -41,8 +41,8 @@ PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame* return 0; } -ClipboardBrew::ClipboardBrew(ClipboardAccessPolicy policy, bool isForDragging) - : Clipboard(policy, isForDragging) +ClipboardBrew::ClipboardBrew(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(clipboardType, isForDragging) { } @@ -52,12 +52,12 @@ ClipboardBrew::~ClipboardBrew() void ClipboardBrew::clearData(const String&) { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); } void ClipboardBrew::clearAllData() { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); } String ClipboardBrew::getData(const String&, bool& success) const @@ -68,7 +68,7 @@ String ClipboardBrew::getData(const String&, bool& success) const bool ClipboardBrew::setData(const String&, const String&) { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); return false; } diff --git a/WebCore/platform/brew/ClipboardBrew.h b/WebCore/platform/brew/ClipboardBrew.h index a966db1..1faf031 100644 --- a/WebCore/platform/brew/ClipboardBrew.h +++ b/WebCore/platform/brew/ClipboardBrew.h @@ -36,7 +36,7 @@ class CachedImage; class ClipboardBrew : public Clipboard, public CachedResourceClient { public: - ClipboardBrew(ClipboardAccessPolicy policy, bool isForDragging); + ClipboardBrew(ClipboardAccessPolicy policy, ClipboardType); ~ClipboardBrew(); void clearData(const String&); diff --git a/WebCore/platform/brew/FileSystemBrew.cpp b/WebCore/platform/brew/FileSystemBrew.cpp index 88aa05b..a723e63 100644 --- a/WebCore/platform/brew/FileSystemBrew.cpp +++ b/WebCore/platform/brew/FileSystemBrew.cpp @@ -131,7 +131,7 @@ static String canonicalPath(const String& path) return canonPath; } -static bool makeAllDirectories(PassOwnPtr<IFileMgr> fileMgr, const String& path) +static bool makeAllDirectories(IFileMgr* fileManager, const String& path) { if (path == canonicalPath(AEEFS_HOME_DIR)) return true; @@ -144,7 +144,7 @@ static bool makeAllDirectories(PassOwnPtr<IFileMgr> fileMgr, const String& path) } if (lastDivPos > 0) { - if (!makeAllDirectories(fileMgr.release(), path.substring(0, lastDivPos))) + if (!makeAllDirectories(fileManager, path.substring(0, lastDivPos))) return false; } @@ -152,10 +152,10 @@ static bool makeAllDirectories(PassOwnPtr<IFileMgr> fileMgr, const String& path) // IFILEMGR_MkDir return SUCCESS when the file is successfully created or if file already exists. // So we need to check fileinfo.attrib. - IFILEMGR_MkDir(fileMgr.get(), folder.utf8().data()); + IFILEMGR_MkDir(fileManager, folder.utf8().data()); FileInfo fileInfo; - if (IFILEMGR_GetInfo(fileMgr.get(), folder.utf8().data(), &fileInfo) != SUCCESS) + if (IFILEMGR_GetInfo(fileManager, folder.utf8().data(), &fileInfo) != SUCCESS) return false; return fileInfo.attrib & _FA_DIR; @@ -165,12 +165,13 @@ bool makeAllDirectories(const String& path) { OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); - return makeAllDirectories(fileMgr.release(), canonicalPath(path)); + return makeAllDirectories(fileMgr.get(), canonicalPath(path)); } String homeDirectoryPath() { - return String(AEEFS_HOME_DIR); + const int webViewClassId = 0x010aa04c; + return String::format("fs:/~0X%08X/", webViewClassId); } String pathGetFileName(const String& path) diff --git a/WebCore/platform/brew/LocalizedStringsBrew.cpp b/WebCore/platform/brew/LocalizedStringsBrew.cpp index 1bc5985..2dfd12b 100644 --- a/WebCore/platform/brew/LocalizedStringsBrew.cpp +++ b/WebCore/platform/brew/LocalizedStringsBrew.cpp @@ -96,6 +96,56 @@ String contextMenuItemTagCopyImageToClipboard() return "Copy image to clipboard"; } +String contextMenuItemTagOpenVideoInNewWindow() +{ + return "Open video in new window"; +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return "Open audio in new window"; +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return "Copy Video link location"; +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return "Copy audio link location"; +} + +String contextMenuItemTagToggleMediaControls() +{ + return "Toggle media controls"; +} + +String contextMenuItemTagToggleMediaLoop() +{ + return "Toggle media loop playback"; +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return "Switch video to fullscreen"; +} + +String contextMenuItemTagMediaPlay() +{ + return "Play"; +} + +String contextMenuItemTagMediaPause() +{ + return "Pause"; +} + +String contextMenuItemTagMediaMute() +{ + return "Mute"; +} + String contextMenuItemTagOpenFrameInNewWindow() { return "Open frame in new window"; diff --git a/WebCore/platform/brew/PasteboardBrew.cpp b/WebCore/platform/brew/PasteboardBrew.cpp new file mode 100644 index 0000000..e5049b4 --- /dev/null +++ b/WebCore/platform/brew/PasteboardBrew.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2009 Company 100, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "Pasteboard.h" + +#include "DocumentFragment.h" +#include "NotImplemented.h" +#include "Range.h" + +#include <wtf/text/CString.h> + +namespace WebCore { + +Pasteboard* Pasteboard::generalPasteboard() +{ + static Pasteboard* pasteboard = new Pasteboard; + return pasteboard; +} + +Pasteboard::Pasteboard() +{ + notImplemented(); +} + +void Pasteboard::clear() +{ + notImplemented(); +} + +void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) +{ + notImplemented(); +} + +void Pasteboard::writePlainText(const String& text) +{ + notImplemented(); +} + +void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) +{ + notImplemented(); +} + +void Pasteboard::writeImage(Node* node, const KURL&, const String&) +{ + notImplemented(); +} + +bool Pasteboard::canSmartReplace() +{ + notImplemented(); + return false; +} + +String Pasteboard::plainText(Frame* frame) +{ + notImplemented(); + return String(); +} + +PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) +{ + notImplemented(); + return 0; +} + +} // namespace WebCore diff --git a/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp b/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp index d7a1279..3384a4f 100644 --- a/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp +++ b/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp @@ -98,6 +98,8 @@ static String keyIdentifierForBrewKeyCode(uint16 keyCode) return "PageUp"; case AVK_TXPGDOWN: return "PageDown"; + case AVK_FUNCTION: + return "U+0009"; default: return String::format("U+%04X", toASCIIUpper(keyCode)); } @@ -132,6 +134,8 @@ static int windowsKeyCodeForKeyEvent(uint16 code) return VK_INSERT; // (2D) INS key case AVK_TXDELETE: return VK_DELETE; // (2E) DEL key + case AVK_FUNCTION: + return VK_TAB; // (09) TAB key default: return 0; } diff --git a/WebCore/platform/brew/PlatformTouchEventBrew.cpp b/WebCore/platform/brew/PlatformTouchEventBrew.cpp new file mode 100644 index 0000000..9f31dae --- /dev/null +++ b/WebCore/platform/brew/PlatformTouchEventBrew.cpp @@ -0,0 +1,76 @@ +/* + * Copyright 2010, Company 100, Inc. 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. + * + * 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 "PlatformTouchEvent.h" + +#include <AEEEvent.h> +#include <AEEPointerHelpers.h> +#include <AEEVCodes.h> + +#if ENABLE(TOUCH_EVENTS) + +namespace WebCore { + +PlatformTouchEvent::PlatformTouchEvent(AEEEvent event, uint16 wParam, uint32 dwParam) + : m_metaKey(false) +{ + PlatformTouchPoint::State state; + + switch (event) { + case EVT_POINTER_DOWN: + m_type = TouchStart; + state = PlatformTouchPoint::TouchPressed; + break; + case EVT_POINTER_UP: + m_type = TouchEnd; + state = PlatformTouchPoint::TouchReleased; + break; + case EVT_POINTER_MOVE: + case EVT_POINTER_STALE_MOVE: + m_type = TouchMove; + state = PlatformTouchPoint::TouchMoved; + break; + default: + ASSERT_NOT_REACHED(); + } + + char* dwParamStr = reinterpret_cast<char*>(dwParam); + int x, y; + AEE_POINTER_GET_XY(dwParamStr, &x, &y); + IntPoint windowPos = IntPoint(x, y); + + int id = AEE_POINTER_GET_PTRID(dwParamStr); + m_touchPoints.append(PlatformTouchPoint(id, windowPos, state)); + + uint32 keyModifiers = AEE_POINTER_GET_KEY_MODIFIERS(dwParamStr); + m_altKey = keyModifiers & (KB_LALT | KB_RALT); + m_shiftKey = keyModifiers & (KB_LSHIFT | KB_RSHIFT); + m_ctrlKey = keyModifiers & (KB_LCTRL | KB_RCTRL); +} + +} + +#endif diff --git a/WebCore/platform/brew/PlatformTouchPointBrew.cpp b/WebCore/platform/brew/PlatformTouchPointBrew.cpp new file mode 100644 index 0000000..6943182 --- /dev/null +++ b/WebCore/platform/brew/PlatformTouchPointBrew.cpp @@ -0,0 +1,41 @@ +/* + * Copyright 2010, Company 100, Inc. 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. + * + * 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 "PlatformTouchPoint.h" + +#if ENABLE(TOUCH_EVENTS) + +namespace WebCore { + +PlatformTouchPoint::PlatformTouchPoint(int id, const IntPoint& windowPos, State state) + : m_id(id) + , m_state(state) + , m_screenPos(windowPos) + , m_pos(windowPos) { } + +} + +#endif diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h index 894799c..121ec4b 100644 --- a/WebCore/platform/chromium/ChromiumBridge.h +++ b/WebCore/platform/chromium/ChromiumBridge.h @@ -143,7 +143,7 @@ namespace WebCore { #if OS(WINDOWS) static bool ensureFontLoaded(HFONT font); #endif -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result); static String getFontFamilyForCharacters(const UChar*, size_t numCharacters); #endif diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp index 3d82aea..c2ec80c 100644 --- a/WebCore/platform/chromium/ClipboardChromium.cpp +++ b/WebCore/platform/chromium/ClipboardChromium.cpp @@ -93,23 +93,23 @@ static ClipboardDataType clipboardTypeFromMIMEType(const String& type) PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame) { - return ClipboardChromium::create(true, dragData->platformData(), policy, frame); + return ClipboardChromium::create(DragAndDrop, dragData->platformData(), policy, frame); } -ClipboardChromium::ClipboardChromium(bool isForDragging, +ClipboardChromium::ClipboardChromium(ClipboardType clipboardType, PassRefPtr<ChromiumDataObject> dataObject, ClipboardAccessPolicy policy, Frame* frame) - : Clipboard(policy, isForDragging) + : Clipboard(policy, clipboardType) , m_dataObject(dataObject) , m_frame(frame) { } -PassRefPtr<ClipboardChromium> ClipboardChromium::create(bool isForDragging, +PassRefPtr<ClipboardChromium> ClipboardChromium::create(ClipboardType clipboardType, PassRefPtr<ChromiumDataObject> dataObject, ClipboardAccessPolicy policy, Frame* frame) { - return adoptRef(new ClipboardChromium(isForDragging, dataObject, policy, frame)); + return adoptRef(new ClipboardChromium(clipboardType, dataObject, policy, frame)); } void ClipboardChromium::clearData(const String& type) @@ -203,9 +203,7 @@ String ClipboardChromium::getData(const String& type, bool& success) const return m_dataObject->downloadMetadata; case ClipboardDataTypePlainText: - if (!isForDragging()) { - // If this isn't for a drag, it's for a cut/paste event handler. - // In this case, we need to check the clipboard. + if (isForCopyAndPaste()) { PasteboardPrivate::ClipboardBuffer buffer = Pasteboard::generalPasteboard()->isSelectionMode() ? PasteboardPrivate::SelectionBuffer : @@ -219,9 +217,7 @@ String ClipboardChromium::getData(const String& type, bool& success) const return m_dataObject->plainText; case ClipboardDataTypeHTML: - if (!isForDragging()) { - // If this isn't for a drag, it's for a cut/paste event handler. - // In this case, we need to check the clipboard. + if (isForCopyAndPaste()) { PasteboardPrivate::ClipboardBuffer buffer = Pasteboard::generalPasteboard()->isSelectionMode() ? PasteboardPrivate::SelectionBuffer : diff --git a/WebCore/platform/chromium/ClipboardChromium.h b/WebCore/platform/chromium/ClipboardChromium.h index a4150d0..14f59e9 100644 --- a/WebCore/platform/chromium/ClipboardChromium.h +++ b/WebCore/platform/chromium/ClipboardChromium.h @@ -46,7 +46,7 @@ namespace WebCore { ~ClipboardChromium() {} static PassRefPtr<ClipboardChromium> create( - bool isForDragging, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*); + ClipboardType, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*); // Returns the file name (not including the extension). This removes any // invalid file system characters as well as making sure the @@ -80,7 +80,7 @@ namespace WebCore { virtual bool hasData(); private: - ClipboardChromium(bool, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*); + ClipboardChromium(ClipboardType, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*); void resetFromClipboard(); void setDragImage(CachedImage*, Node*, const IntPoint&); diff --git a/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp b/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp index 19b4a54..d8f2c79 100644 --- a/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp +++ b/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp @@ -115,7 +115,7 @@ void ScrollbarThemeChromiumLinux::paintButton(GraphicsContext* gc, Scrollbar* sc ControlStates states = 0; // Determine if the button can be pressed. if (((direction == PlatformThemeChromiumGtk::West || direction == PlatformThemeChromiumGtk::North) && scrollbar->currentPos()) - || (direction == PlatformThemeChromiumGtk::East || direction == PlatformThemeChromiumGtk::South) && scrollbar->currentPos() != scrollbar->maximum()) + || ((direction == PlatformThemeChromiumGtk::East || direction == PlatformThemeChromiumGtk::South) && scrollbar->currentPos() != scrollbar->maximum())) states |= EnabledState; if (states & EnabledState) { diff --git a/WebCore/platform/efl/ClipboardEfl.cpp b/WebCore/platform/efl/ClipboardEfl.cpp index 6fc80dc..a7c2a54 100644 --- a/WebCore/platform/efl/ClipboardEfl.cpp +++ b/WebCore/platform/efl/ClipboardEfl.cpp @@ -29,7 +29,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) { - return ClipboardEfl::create(policy, false); + return ClipboardEfl::create(policy, Clipboard::CopyAndPaste); } PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame*) @@ -37,8 +37,8 @@ PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame* return 0; } -ClipboardEfl::ClipboardEfl(ClipboardAccessPolicy policy, bool forDragging) - : Clipboard(policy, forDragging) +ClipboardEfl::ClipboardEfl(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(policy, clipboardType) { notImplemented(); } diff --git a/WebCore/platform/efl/ClipboardEfl.h b/WebCore/platform/efl/ClipboardEfl.h index 5db2fed..06f4e58 100644 --- a/WebCore/platform/efl/ClipboardEfl.h +++ b/WebCore/platform/efl/ClipboardEfl.h @@ -28,9 +28,9 @@ class CachedImage; class ClipboardEfl : public Clipboard { public: - static PassRefPtr<ClipboardEfl> create(ClipboardAccessPolicy policy, bool forDragging = false) + static PassRefPtr<ClipboardEfl> create(ClipboardAccessPolicy policy, ClipboardType clipboardType = CopyAndPaste) { - return adoptRef(new ClipboardEfl(policy, forDragging)); + return adoptRef(new ClipboardEfl(policy, clipboardType)); } ~ClipboardEfl(); @@ -58,7 +58,7 @@ public: virtual void writePlainText(const WTF::String&); private: - ClipboardEfl(ClipboardAccessPolicy, bool); + ClipboardEfl(ClipboardAccessPolicy, ClipboardType); }; } diff --git a/WebCore/platform/efl/LocalizedStringsEfl.cpp b/WebCore/platform/efl/LocalizedStringsEfl.cpp index 6023205..a81434f 100644 --- a/WebCore/platform/efl/LocalizedStringsEfl.cpp +++ b/WebCore/platform/efl/LocalizedStringsEfl.cpp @@ -98,6 +98,56 @@ String contextMenuItemTagCopyImageToClipboard() return String::fromUTF8("Copy Image"); } +String contextMenuItemTagOpenVideoInNewWindow() +{ + return String::fromUTF8("Open Video in New Window"); +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return String::fromUTF8("Open Audio in New Window"); +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return String::fromUTF8("Copy Video Link Location"); +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return String::fromUTF8("Copy Audio Link Location"); +} + +String contextMenuItemTagToggleMediaControls() +{ + return String::fromUTF8("Toggle Media Controls"); +} + +String contextMenuItemTagToggleMediaLoop() +{ + return String::fromUTF8("Toggle Media Loop Playback"); +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return String::fromUTF8("Switch Video to Fullscreen"); +} + +String contextMenuItemTagMediaPlay() +{ + return String::fromUTF8("Play"); +} + +String contextMenuItemTagMediaPause() +{ + return String::fromUTF8("Pause"); +} + +String contextMenuItemTagMediaMute() +{ + return String::fromUTF8("Mute"); +} + String contextMenuItemTagOpenFrameInNewWindow() { return String::fromUTF8("Open Frame in New Window"); diff --git a/WebCore/platform/efl/RenderThemeEfl.cpp b/WebCore/platform/efl/RenderThemeEfl.cpp index 102f754..53997be 100644 --- a/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/WebCore/platform/efl/RenderThemeEfl.cpp @@ -78,7 +78,7 @@ bool RenderThemeEfl::themePartCacheEntryReset(struct ThemePartCacheEntry* ce, Fo ASSERT(group); if (!edje_object_file_set(ce->o, file, group)) { - int err = edje_object_load_error_get(ce->o); + Edje_Load_Error err = edje_object_load_error_get(ce->o); const char *errmsg = edje_load_error_str(err); EINA_LOG_ERR("Could not load '%s' from theme %s: %s", group, file, errmsg); @@ -421,7 +421,7 @@ void RenderThemeEfl::createEdje() if (!m_edje) EINA_LOG_ERR("Could not create base edje object."); else if (!edje_object_file_set(m_edje, theme.utf8().data(), "webkit/base")) { - int err = edje_object_load_error_get(m_edje); + Edje_Load_Error err = edje_object_load_error_get(m_edje); const char* errmsg = edje_load_error_str(err); EINA_LOG_ERR("Could not load 'webkit/base' from theme %s: %s", theme.utf8().data(), errmsg); @@ -600,7 +600,7 @@ void RenderThemeEfl::applyPartDescriptions() const char* group = edjeGroupFromFormType(type); m_partDescs[i].type = type; if (!edje_object_file_set(o, file, group)) { - int err = edje_object_load_error_get(o); + Edje_Load_Error err = edje_object_load_error_get(o); const char* errmsg = edje_load_error_str(err); EINA_LOG_ERR("Could not set theme group '%s' of file '%s': %s", group, file, errmsg); diff --git a/WebCore/platform/efl/ScrollbarEfl.cpp b/WebCore/platform/efl/ScrollbarEfl.cpp index 6b00a37..282ca7c 100644 --- a/WebCore/platform/efl/ScrollbarEfl.cpp +++ b/WebCore/platform/efl/ScrollbarEfl.cpp @@ -122,7 +122,7 @@ void ScrollbarEfl::setParent(ScrollView* view) } if (!edje_object_file_set(o, theme.utf8().data(), group)) { - int err = edje_object_load_error_get(o); + Edje_Load_Error err = edje_object_load_error_get(o); const char* errmsg = edje_load_error_str(err); EINA_LOG_ERR("Could not load theme '%s' from file '%s': #%d '%s'", group, theme.utf8().data(), err, errmsg); diff --git a/WebCore/platform/graphics/Color.cpp b/WebCore/platform/graphics/Color.cpp index 80c8286..f28d51c 100644 --- a/WebCore/platform/graphics/Color.cpp +++ b/WebCore/platform/graphics/Color.cpp @@ -26,13 +26,12 @@ #include "config.h" #include "Color.h" +#include "HashTools.h" #include "PlatformString.h" #include <math.h> #include <wtf/Assertions.h> #include <wtf/MathExtras.h> -#include "ColorData.cpp" - using namespace std; using namespace WTF; diff --git a/WebCore/platform/graphics/qt/ContextShadow.cpp b/WebCore/platform/graphics/ContextShadow.cpp index 4609923..1007962 100644 --- a/WebCore/platform/graphics/qt/ContextShadow.cpp +++ b/WebCore/platform/graphics/ContextShadow.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Sencha, Inc. + * Copyright (C) 2010 Igalia S.L. * * All rights reserved. * @@ -28,115 +29,50 @@ #include "config.h" #include "ContextShadow.h" -#include <QTimerEvent> +#include <wtf/MathExtras.h> #include <wtf/Noncopyable.h> -namespace WebCore { - -// ContextShadow needs a scratch image as the buffer for the blur filter. -// Instead of creating and destroying the buffer for every operation, -// we create a buffer which will be automatically purged via a timer. - -class ShadowBuffer: public QObject { -public: - ShadowBuffer(QObject* parent = 0); - - QImage* scratchImage(const QSize& size); - - void schedulePurge(); - -protected: - void timerEvent(QTimerEvent* event); - -private: - QImage image; - int timerId; -}; - -ShadowBuffer::ShadowBuffer(QObject* parent) - : QObject(parent) - , timerId(0) -{ -} - -QImage* ShadowBuffer::scratchImage(const QSize& size) -{ - int width = size.width(); - int height = size.height(); - - // We do not need to recreate the buffer if the buffer is reasonably - // larger than the requested size. However, if the requested size is - // much smaller than our buffer, reduce our buffer so that we will not - // keep too many allocated pixels for too long. - if (!image.isNull() && (image.width() > width) && (image.height() > height)) - if (((2 * width) > image.width()) && ((2 * height) > image.height())) { - image.fill(Qt::transparent); - return ℑ - } - - // Round to the nearest 32 pixels so we do not grow the buffer everytime - // there is larger request by 1 pixel. - width = (1 + (width >> 5)) << 5; - height = (1 + (height >> 5)) << 5; - - image = QImage(width, height, QImage::Format_ARGB32_Premultiplied); - image.fill(Qt::transparent); - return ℑ -} - -void ShadowBuffer::schedulePurge() -{ - static const double BufferPurgeDelay = 2; // seconds - killTimer(timerId); - timerId = startTimer(BufferPurgeDelay * 1000); -} - -void ShadowBuffer::timerEvent(QTimerEvent* event) -{ - if (event->timerId() == timerId) { - killTimer(timerId); - image = QImage(); - } - QObject::timerEvent(event); -} +using WTF::min; +using WTF::max; -Q_GLOBAL_STATIC(ShadowBuffer, scratchShadowBuffer) +namespace WebCore { ContextShadow::ContextShadow() - : type(NoShadow) - , blurRadius(0) + : m_type(NoShadow) + , m_blurRadius(0) { } -ContextShadow::ContextShadow(const QColor& c, float r, qreal dx, qreal dy) - : color(c) - , blurRadius(qRound(r)) - , offset(dx, dy) +ContextShadow::ContextShadow(const Color& color, float radius, const FloatSize& offset) + : m_color(color) + , m_blurRadius(round(radius)) + , m_offset(offset) { + // See comments in http://webkit.org/b/40793, it seems sensible + // to follow Skia's limit of 128 pixels of blur radius + m_blurRadius = min(m_blurRadius, 128); + // The type of shadow is decided by the blur radius, shadow offset, and shadow color. - if (!color.isValid() || !color.alpha()) { + if (!m_color.isValid() || !color.alpha()) { // Can't paint the shadow with invalid or invisible color. - type = NoShadow; - } else if (r > 0) { + m_type = NoShadow; + } else if (radius > 0) { // Shadow is always blurred, even the offset is zero. - type = BlurShadow; - } else if (offset.isNull()) { + m_type = BlurShadow; + } else if (!m_offset.width() && !m_offset.height()) { // Without blur and zero offset means the shadow is fully hidden. - type = NoShadow; + m_type = NoShadow; } else { - if (color.alpha() > 0) - type = AlphaSolidShadow; - else - type = OpaqueSolidShadow; + m_type = SolidShadow; } } void ContextShadow::clear() { - type = NoShadow; - color = QColor(); - blurRadius = 0; - offset = QPointF(0, 0); + m_type = NoShadow; + m_color = Color(); + m_blurRadius = 0; + m_offset = FloatSize(); } // Instead of integer division, we use 17.15 for fixed-point division. @@ -146,27 +82,22 @@ static const int BlurSumShift = 15; // As noted in the SVG filter specification, running box blur 3x // approximates a real gaussian blur nicely. -void shadowBlur(QImage& image, int radius, const QColor& shadowColor) +void ContextShadow::blurLayerImage(unsigned char* imageData, const IntSize& size, int rowStride) { - // See comments in http://webkit.org/b/40793, it seems sensible - // to follow Skia's limit of 128 pixels for the blur radius. - if (radius > 128) - radius = 128; - int channels[4] = { 3, 0, 1, 3 }; - int dmax = radius >> 1; - int dmin = dmax - 1 + (radius & 1); + int dmax = m_blurRadius >> 1; + int dmin = dmax - 1 + (m_blurRadius & 1); if (dmin < 0) dmin = 0; // Two stages: horizontal and vertical for (int k = 0; k < 2; ++k) { - unsigned char* pixels = image.bits(); - int stride = (!k) ? 4 : image.bytesPerLine(); - int delta = (!k) ? image.bytesPerLine() : 4; - int jfinal = (!k) ? image.height() : image.width(); - int dim = (!k) ? image.width() : image.height(); + unsigned char* pixels = imageData; + int stride = (!k) ? 4 : rowStride; + int delta = (!k) ? rowStride : 4; + int jfinal = (!k) ? size.height() : size.width(); + int dim = (!k) ? size.width() : size.height(); for (int j = 0; j < jfinal; ++j, pixels += delta) { @@ -213,74 +144,31 @@ void shadowBlur(QImage& image, int radius, const QColor& shadowColor) } } } - - // "Colorize" with the right shadow color. - QPainter p(&image); - p.setCompositionMode(QPainter::CompositionMode_SourceIn); - p.fillRect(image.rect(), shadowColor.rgb()); - p.end(); } -QPainter* ContextShadow::beginShadowLayer(QPainter* p, const QRectF &rect) +void ContextShadow::calculateLayerBoundingRect(const FloatRect& layerArea, const IntRect& clipRect) { - // We expand the area by the blur radius * 2 to give extra space - // for the blur transition. - int extra = (type == BlurShadow) ? blurRadius * 2 : 0; - - QRectF shadowRect = rect.translated(offset); - QRectF bufferRect = shadowRect.adjusted(-extra, -extra, extra, extra); - m_layerRect = bufferRect.toAlignedRect(); + // Calculate the destination of the blurred layer. + FloatRect destinationRect(layerArea); + destinationRect.move(m_offset); + m_layerRect = enclosingIntRect(destinationRect); - QRect clipRect; - if (p->hasClipping()) -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) - clipRect = p->clipBoundingRect(); -#else - clipRect = p->clipRegion().boundingRect(); -#endif - else - clipRect = p->transform().inverted().mapRect(p->window()); + // We expand the area by the blur radius * 2 to give extra space for the blur transition. + m_layerRect.inflate((m_type == BlurShadow) ? ceil(m_blurRadius * 2) : 0); if (!clipRect.contains(m_layerRect)) { - // No need to have the buffer larger than the clip. - m_layerRect = m_layerRect.intersected(clipRect); + m_layerRect.intersect(clipRect); + + // If we are totally outside the clip region, we aren't painting at all. if (m_layerRect.isEmpty()) - return 0; + return; // We adjust again because the pixels at the borders are still // potentially affected by the pixels outside the buffer. - if (type == BlurShadow) - m_layerRect.adjust(-extra, -extra, extra, extra); + if (m_type == BlurShadow) + m_layerRect.inflate((m_type == BlurShadow) ? ceil(m_blurRadius * 2) : 0); } - - ShadowBuffer* shadowBuffer = scratchShadowBuffer(); - QImage* shadowImage = shadowBuffer->scratchImage(m_layerRect.size()); - m_layerImage = QImage(*shadowImage); - - m_layerPainter = new QPainter; - m_layerPainter->begin(&m_layerImage); - m_layerPainter->setFont(p->font()); - m_layerPainter->translate(offset); - - // The origin is now the top left corner of the scratch image. - m_layerPainter->translate(-m_layerRect.topLeft()); - - return m_layerPainter; } -void ContextShadow::endShadowLayer(QPainter* p) -{ - m_layerPainter->end(); - delete m_layerPainter; - m_layerPainter = 0; - - if (type == BlurShadow) - shadowBlur(m_layerImage, blurRadius, color); - - p->drawImage(m_layerRect.topLeft(), m_layerImage); - - scratchShadowBuffer()->schedulePurge(); -} - -} +} // namespace WebCore diff --git a/WebCore/platform/graphics/qt/ContextShadow.h b/WebCore/platform/graphics/ContextShadow.h index 7140340..ede9336 100644 --- a/WebCore/platform/graphics/qt/ContextShadow.h +++ b/WebCore/platform/graphics/ContextShadow.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Sencha, Inc. + * Copyright (C) 2010 Igalia S.L. * * All rights reserved. * @@ -28,7 +29,22 @@ #ifndef ContextShadow_h #define ContextShadow_h -#include <QPainter> +#include "Color.h" +#include "FloatRect.h" +#include "IntRect.h" +#include "RefCounted.h" + +#if PLATFORM(CAIRO) +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +typedef cairo_surface_t* PlatformImage; +typedef cairo_t* PlatformContext; +#elif PLATFORM(QT) +#include <QImage> +class QPainter; +typedef QImage PlatformImage; +typedef QPainter* PlatformContext; +#endif namespace WebCore { @@ -44,49 +60,57 @@ class ContextShadow { public: enum { NoShadow, - OpaqueSolidShadow, - AlphaSolidShadow, + SolidShadow, BlurShadow - } type; + } m_type; - QColor color; - int blurRadius; - QPointF offset; + Color m_color; + int m_blurRadius; + FloatSize m_offset; ContextShadow(); - ContextShadow(const QColor& c, float r, qreal dx, qreal dy); + ContextShadow(const Color&, float radius, const FloatSize& offset); void clear(); // The pair beginShadowLayer and endShadowLayer creates a temporary image - // where the caller can draw onto, using the returned QPainter. This - // QPainter instance must be used only to draw between the call to - // beginShadowLayer and endShadowLayer. + // where the caller can draw onto, using the returned context. This context + // must be used only to draw between the call to beginShadowLayer and + // endShadowLayer. // - // Note: multiple/nested shadow layer is NOT allowed. + // Note: multiple/nested shadow layers are NOT allowed. // // The current clip region will be used to optimize the size of the - // temporary image. Thus, the original painter should not change any - // clipping until endShadowLayer. - // If the shadow will be completely outside the clipping region, - // beginShadowLayer will return 0. + // temporary image. Thus, the original context should not change any + // clipping until endShadowLayer. If the shadow will be completely outside + // the clipping region, beginShadowLayer will return 0. // - // The returned QPainter will have the transformation matrix and clipping - // properly initialized to start doing the painting (no need to account - // for the shadow offset), however it will not have the same render hints, - // pen, brush, etc as the passed QPainter. This is intentional, usually - // shadow has different properties than the shape which casts the shadow. + // The returned context will have the transformation matrix and clipping + // properly initialized to start doing the painting (no need to account for + // the shadow offset), however it will not have the same render hints, pen, + // brush, etc as the passed context. This is intentional, usually shadows + // have different properties than the shapes which cast them. // - // Once endShadowLayer is called, the temporary image will be drawn - // with the original painter. If blur radius is specified, the shadow - // will be filtered first. - QPainter* beginShadowLayer(QPainter* p, const QRectF& rect); - void endShadowLayer(QPainter* p); + // Once endShadowLayer is called, the temporary image will be drawn with the + // original context. If blur radius is specified, the shadow will be + // filtered first. + + PlatformContext beginShadowLayer(PlatformContext, const FloatRect& layerArea); + void endShadowLayer(PlatformContext); + static void purgeScratchBuffer(); + +#if PLATFORM(QT) + QPointF offset() { return QPointF(m_offset.width(), m_offset.height()); } +#endif + private: - QRect m_layerRect; - QImage m_layerImage; - QPainter* m_layerPainter; + IntRect m_layerRect; + PlatformImage m_layerImage; + PlatformContext m_layerContext; + + void blurLayerImage(unsigned char*, const IntSize& imageSize, int stride); + void calculateLayerBoundingRect(const FloatRect& layerArea, const IntRect& clipRect); }; } // namespace WebCore diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h index d6cf140..1a321bd 100644 --- a/WebCore/platform/graphics/Font.h +++ b/WebCore/platform/graphics/Font.h @@ -191,8 +191,8 @@ public: } FontSelector* fontSelector() const; - static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; } - static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || (c >= 0x200c && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == 0xFFFC; } + static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; } + static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || (c >= 0x200c && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == objectReplacementCharacter; } static inline UChar normalizeSpaces(UChar character) { diff --git a/WebCore/platform/graphics/GlyphPageTreeNode.cpp b/WebCore/platform/graphics/GlyphPageTreeNode.cpp index dac26b3..3df14b9 100644 --- a/WebCore/platform/graphics/GlyphPageTreeNode.cpp +++ b/WebCore/platform/graphics/GlyphPageTreeNode.cpp @@ -171,6 +171,7 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu buffer[i] = zeroWidthSpace; for (i = 0x7F; i < 0xA0; i++) buffer[i] = zeroWidthSpace; + buffer[softHyphen] = zeroWidthSpace; // \n, \t, and nonbreaking space must render as a space. buffer[(int)'\n'] = ' '; diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index 7863b95..fd3bf2c 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -108,12 +108,6 @@ typedef unsigned char UInt8; #endif #endif -#if PLATFORM(CHROMIUM) -#define CanvasInterpolationQuality InterpolationMedium -#else -#define CanvasInterpolationQuality InterpolationDefault -#endif - #if PLATFORM(QT) && defined(Q_WS_WIN) #include <windows.h> #endif diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp index 2da5862..86e9569 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.cpp +++ b/WebCore/platform/graphics/GraphicsContext3D.cpp @@ -255,6 +255,14 @@ void unpackRGB8ToRGBA8(const uint8_t* source, uint8_t* destination) destination[3] = 0xFF; } +void unpackARGB8ToRGBA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[1]; + destination[1] = source[2]; + destination[2] = source[3]; + destination[3] = source[0]; +} + void unpackBGRA8ToRGBA8(const uint8_t* source, uint8_t* destination) { destination[0] = source[2]; @@ -316,6 +324,14 @@ void unpackRA8ToRGBA8(const uint8_t* source, uint8_t* destination) destination[3] = source[1]; } +void unpackAR8ToRGBA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[1]; + destination[1] = source[1]; + destination[2] = source[1]; + destination[3] = source[0]; +} + void unpackA8ToRGBA8(const uint8_t* source, uint8_t* destination) { destination[0] = 0x0; @@ -634,6 +650,12 @@ static void doPacking(const void* sourceData, doUnpackingAndPacking<uint8_t, DestType, unpackRGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); break; } + case GraphicsContext3D::kSourceFormatARGB8: { + unsigned int sourceElementsPerPixel, sourceElementsPerRow; + computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); + doUnpackingAndPacking<uint8_t, DestType, unpackARGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); + break; + } case GraphicsContext3D::kSourceFormatBGRA8: { unsigned int sourceElementsPerPixel, sourceElementsPerRow; computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); @@ -670,6 +692,12 @@ static void doPacking(const void* sourceData, doUnpackingAndPacking<uint8_t, DestType, unpackRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); break; } + case GraphicsContext3D::kSourceFormatAR8: { + unsigned int sourceElementsPerPixel, sourceElementsPerRow; + computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); + doUnpackingAndPacking<uint8_t, DestType, unpackAR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); + break; + } case GraphicsContext3D::kSourceFormatA8: { unsigned int sourceElementsPerPixel, sourceElementsPerRow; computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h index bcb7997..a12b1c4 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.h +++ b/WebCore/platform/graphics/GraphicsContext3D.h @@ -537,11 +537,13 @@ public: kSourceFormatRGBA8, kSourceFormatRGB8, kSourceFormatBGRA8, + kSourceFormatARGB8, kSourceFormatRGBA5551, kSourceFormatRGBA4444, kSourceFormatRGB565, kSourceFormatR8, kSourceFormatRA8, + kSourceFormatAR8, kSourceFormatA8 }; @@ -834,14 +836,14 @@ public: int m_currentWidth, m_currentHeight; - typedef struct { - String source; - String log; +#if PLATFORM(MAC) + typedef struct { + String source; + String log; bool isValid; } ShaderSourceEntry; HashMap<Platform3DObject, ShaderSourceEntry> m_shaderSourceMap; -#if PLATFORM(MAC) ANGLEWebKitBridge m_compiler; Attributes m_attrs; diff --git a/WebCore/platform/graphics/GraphicsLayer.cpp b/WebCore/platform/graphics/GraphicsLayer.cpp index b0f529b..412f06d 100644 --- a/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/WebCore/platform/graphics/GraphicsLayer.cpp @@ -246,6 +246,12 @@ void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I m_client->paintContents(this, context, m_paintingPhase, clip); } +String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property) +{ + // | is not a valid identifier character in CSS, so this can never conflict with a keyframe identifier. + return String::format("-|transition%c-", property); +} + void GraphicsLayer::suspendAnimations(double) { } diff --git a/WebCore/platform/graphics/GraphicsLayer.h b/WebCore/platform/graphics/GraphicsLayer.h index 04899f2..ad4d056 100644 --- a/WebCore/platform/graphics/GraphicsLayer.h +++ b/WebCore/platform/graphics/GraphicsLayer.h @@ -284,13 +284,16 @@ public: IntRect contentsRect() const { return m_contentsRect; } virtual void setContentsRect(const IntRect& r) { m_contentsRect = r; } + // Transitions are identified by a special animation name that cannot clash with a keyframe identifier. + static String animationNameForTransition(AnimatedPropertyID); + // Return true if the animation is handled by the compositing system. If this returns // false, the animation will be run by AnimationController. - virtual bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const Animation*, const String& /*keyframesName*/, double /*timeOffset*/) { return false; } - virtual void removeAnimationsForProperty(AnimatedPropertyID) { } - virtual void removeAnimationsForKeyframes(const String& /* keyframesName */) { } - virtual void pauseAnimation(const String& /* keyframesName */, double /*timeOffset*/) { } - + // These methods handle both transitions and keyframe animations. + virtual bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const Animation*, const String& /*animationName*/, double /*timeOffset*/) { return false; } + virtual void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/) { } + virtual void removeAnimation(const String& /*animationName*/) { } + virtual void suspendAnimations(double time); virtual void resumeAnimations(); diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp index b4a669c..79c33e0 100644 --- a/WebCore/platform/graphics/MediaPlayer.cpp +++ b/WebCore/platform/graphics/MediaPlayer.cpp @@ -173,6 +173,12 @@ static Vector<MediaPlayerFactory*>& installedMediaEngines() #if PLATFORM(WIN) MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine(addMediaEngine); +#elif PLATFORM(QT) +#if USE(QT_MULTIMEDIA) + MediaPlayerPrivateQt::registerMediaEngine(addMediaEngine); +#else + MediaPlayerPrivatePhonon::registerMediaEngine(addMediaEngine); +#endif #elif !PLATFORM(GTK) && !PLATFORM(EFL) // FIXME: currently all the MediaEngines are named // MediaPlayerPrivate. This code will need an update when bug diff --git a/WebCore/platform/graphics/WidthIterator.cpp b/WebCore/platform/graphics/WidthIterator.cpp index ef047e8..ae58918 100644 --- a/WebCore/platform/graphics/WidthIterator.cpp +++ b/WebCore/platform/graphics/WidthIterator.cpp @@ -212,20 +212,29 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) // Force characters that are used to determine word boundaries for the rounding hack // to be integer width, so following words will start on an integer boundary. - if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c)) + if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c)) { width = ceilf(width); - // Check to see if the next character is a "rounding hack character", if so, adjust - // width so that the total run width will be on an integer boundary. - if ((m_run.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp)) - || (m_run.applyRunRounding() && currentCharacter >= m_end)) { - float totalWidth = widthSinceLastRounding + width; - widthSinceLastRounding = ceilf(totalWidth); - width += widthSinceLastRounding - totalWidth; - m_runWidthSoFar += widthSinceLastRounding; - widthSinceLastRounding = 0; - } else - widthSinceLastRounding += width; + // Since widthSinceLastRounding can lose precision if we include measurements for + // preceding whitespace, we bypass it here. + m_runWidthSoFar += width; + + // Since this is a rounding hack character, we should have reset this sum on the previous + // iteration. + ASSERT(!widthSinceLastRounding); + } else { + // Check to see if the next character is a "rounding hack character", if so, adjust + // width so that the total run width will be on an integer boundary. + if ((m_run.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp)) + || (m_run.applyRunRounding() && currentCharacter >= m_end)) { + float totalWidth = widthSinceLastRounding + width; + widthSinceLastRounding = ceilf(totalWidth); + width += widthSinceLastRounding - totalWidth; + m_runWidthSoFar += widthSinceLastRounding; + widthSinceLastRounding = 0; + } else + widthSinceLastRounding += width; + } if (glyphBuffer) glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width)); diff --git a/WebCore/platform/graphics/brew/ImageBrew.cpp b/WebCore/platform/graphics/brew/ImageBrew.cpp new file mode 100644 index 0000000..f5c855d --- /dev/null +++ b/WebCore/platform/graphics/brew/ImageBrew.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2010, Company 100, Inc. 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 "Image.h" + +#include "BitmapImage.h" +#include "FileSystem.h" +#include "SharedBuffer.h" + +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +PassRefPtr<Image> Image::loadPlatformResource(const char *name) +{ + String resourcePath = homeDirectoryPath() + String::format("res/%s.png", name); + + RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(resourcePath.utf8().data()); + if (!buffer) + return Image::nullImage(); + + RefPtr<Image> image = BitmapImage::create(); + image->setData(buffer, true); + return image.release(); +} + +} // namespace WebCore diff --git a/WebCore/platform/graphics/cairo/CairoUtilities.cpp b/WebCore/platform/graphics/cairo/CairoUtilities.cpp new file mode 100644 index 0000000..8c2049f --- /dev/null +++ b/WebCore/platform/graphics/cairo/CairoUtilities.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CairoUtilities.h" + +#include "Color.h" +#include <cairo.h> +#include <wtf/Vector.h> + +namespace WebCore { + +void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) +{ + cairo_set_antialias(dstCr, cairo_get_antialias(srcCr)); + + size_t dashCount = cairo_get_dash_count(srcCr); + Vector<double> dashes(dashCount); + + double offset; + cairo_get_dash(srcCr, dashes.data(), &offset); + cairo_set_dash(dstCr, dashes.data(), dashCount, offset); + cairo_set_line_cap(dstCr, cairo_get_line_cap(srcCr)); + cairo_set_line_join(dstCr, cairo_get_line_join(srcCr)); + cairo_set_line_width(dstCr, cairo_get_line_width(srcCr)); + cairo_set_miter_limit(dstCr, cairo_get_miter_limit(srcCr)); + cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr)); +} + +void setSourceRGBAFromColor(cairo_t* context, const Color& color) +{ + float red, green, blue, alpha; + color.getRGBA(red, green, blue, alpha); + cairo_set_source_rgba(context, red, green, blue, alpha); +} + +} // namespace WebCore diff --git a/WebCore/platform/network/win/ResourceHandleWin.h b/WebCore/platform/graphics/cairo/CairoUtilities.h index 2964bcb..0675b90 100644 --- a/WebCore/platform/network/win/ResourceHandleWin.h +++ b/WebCore/platform/graphics/cairo/CairoUtilities.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,27 +20,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 ResourceHandleWin_h -#define ResourceHandleWin_h +#ifndef CairoUtilities_h +#define CairoUtilities_h -#include <windows.h> +typedef struct _cairo cairo_t; namespace WebCore { +class Color; -struct PlatformDataStruct -{ - DWORD error; - BOOL loaded; - LPTSTR errorString; -}; +void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr); +void setSourceRGBAFromColor(cairo_t*, const Color&); -struct PlatformResponseStruct -{ -}; +} // namespace WebCore -} - -#endif +#endif // CairoUtilities_h diff --git a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp new file mode 100644 index 0000000..4b94cb3 --- /dev/null +++ b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2010 Sencha, Inc. + * Copyright (C) 2010 Igalia S.L. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "ContextShadow.h" + +#include "CairoUtilities.h" +#include "Timer.h" +#include <cairo.h> + +namespace WebCore { + +static cairo_surface_t* scratchBuffer = 0; +static void purgeScratchBuffer() +{ + cairo_surface_destroy(scratchBuffer); + scratchBuffer = 0; +} + +// ContextShadow needs a scratch image as the buffer for the blur filter. +// Instead of creating and destroying the buffer for every operation, +// we create a buffer which will be automatically purged via a timer. +class PurgeScratchBufferTimer : public TimerBase { +private: + virtual void fired() { purgeScratchBuffer(); } +}; +static PurgeScratchBufferTimer purgeScratchBufferTimer; +static void scheduleScratchBufferPurge() +{ + if (purgeScratchBufferTimer.isActive()) + purgeScratchBufferTimer.stop(); + purgeScratchBufferTimer.startOneShot(2); +} + +static cairo_surface_t* getScratchBuffer(const IntSize& size) +{ + int width = size.width(); + int height = size.height(); + int scratchWidth = scratchBuffer ? cairo_image_surface_get_width(scratchBuffer) : 0; + int scratchHeight = scratchBuffer ? cairo_image_surface_get_height(scratchBuffer) : 0; + + // We do not need to recreate the buffer if the current buffer is large enough. + if (scratchBuffer && scratchWidth >= width && scratchHeight >= height) + return scratchBuffer; + + purgeScratchBuffer(); + + // Round to the nearest 32 pixels so we do not grow the buffer for similar sized requests. + width = (1 + (width >> 5)) << 5; + height = (1 + (height >> 5)) << 5; + scratchBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); + return scratchBuffer; +} + +PlatformContext ContextShadow::beginShadowLayer(PlatformContext context, const FloatRect& layerArea) +{ + double x1, x2, y1, y2; + cairo_clip_extents(context, &x1, &y1, &x2, &y2); + calculateLayerBoundingRect(layerArea, IntRect(x1, y1, x2 - x1, y2 - y1)); + + // Don't paint if we are totally outside the clip region. + if (m_layerRect.isEmpty()) + return 0; + + m_layerImage = getScratchBuffer(m_layerRect.size()); + m_layerContext = cairo_create(m_layerImage); + + // Always clear the surface first. + cairo_set_operator(m_layerContext, CAIRO_OPERATOR_CLEAR); + cairo_paint(m_layerContext); + cairo_set_operator(m_layerContext, CAIRO_OPERATOR_OVER); + + cairo_translate(m_layerContext, m_offset.width(), m_offset.height()); + cairo_translate(m_layerContext, -m_layerRect.x(), -m_layerRect.y()); + return m_layerContext; +} + +void ContextShadow::endShadowLayer(cairo_t* cr) +{ + cairo_destroy(m_layerContext); + m_layerContext = 0; + + if (m_type == BlurShadow) + blurLayerImage(cairo_image_surface_get_data(m_layerImage), + IntSize(cairo_image_surface_get_width(m_layerImage), cairo_image_surface_get_height(m_layerImage)), + cairo_image_surface_get_stride(m_layerImage)); + + cairo_save(cr); + setSourceRGBAFromColor(cr, m_color); + cairo_mask_surface(cr, m_layerImage, m_layerRect.x(), m_layerRect.y()); + cairo_restore(cr); + + // Schedule a purge of the scratch buffer. We do not need to destroy the surface. + scheduleScratchBufferPurge(); +} + +} diff --git a/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp b/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp index c09dd49..febad12 100644 --- a/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp +++ b/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) 2010 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,13 +27,17 @@ #include "OwnPtrCairo.h" #include "PlatformRefPtrCairo.h" #include "SimpleFontData.h" +#include <cairo-ft.h> +#include <cairo.h> +#include <fontconfig/fcfreetype.h> #include <wtf/Assertions.h> namespace WebCore { void FontCache::platformInit() { - if (!FontPlatformData::init()) + // It's fine to call FcInit multiple times per the documentation. + if (!FcInit()) ASSERT_NOT_REACHED(); } @@ -72,9 +77,9 @@ SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font) SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription) { - // FIXME: Would be even better to somehow get the user's default font here. - // For now we'll pick the default that the user would get without changing any prefs. - static AtomicString timesStr("Times New Roman"); + // We want to return a fallback font here, otherwise the logic preventing FontConfig + // matches for non-fallback fonts might return 0. See isFallbackFontAllowed. + static AtomicString timesStr("serif"); return getCachedFontData(fontDescription, timesStr); } @@ -82,54 +87,106 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigne { } -static bool isWellKnownFontName(const AtomicString family) +static CString getFamilyNameStringFromFontDescriptionAndFamily(const FontDescription& fontDescription, const AtomicString& family) { - // Fonts that are used by layout tests included. The fact that - // they are used in Layout Tests indicate web compatibility issues - // if we do not handle them correctly. - if (equalIgnoringCase(family, "sans-serif") || equalIgnoringCase(family, "sans") - || equalIgnoringCase(family, "serif") || equalIgnoringCase(family, "mono") - || equalIgnoringCase(family, "monospace") || equalIgnoringCase(family, "cursive") - || equalIgnoringCase(family, "fantasy") || equalIgnoringCase(family, "Times") - || equalIgnoringCase(family, "Courier") || equalIgnoringCase(family, "Helvetica") - || equalIgnoringCase(family, "Arial") || equalIgnoringCase(family, "Lucida Grande") - || equalIgnoringCase(family, "Ahem") || equalIgnoringCase(family, "Georgia") - || equalIgnoringCase(family, "Times New Roman")) - return true; - - return false; + // If we're creating a fallback font (e.g. "-webkit-monospace"), convert the name into + // the fallback name (like "monospace") that fontconfig understands. + if (family.length() && !family.startsWith("-webkit-")) + return family.string().utf8(); + + switch (fontDescription.genericFamily()) { + case FontDescription::StandardFamily: + case FontDescription::SerifFamily: + return "serif"; + case FontDescription::SansSerifFamily: + return "sans-serif"; + case FontDescription::MonospaceFamily: + return "monospace"; + case FontDescription::CursiveFamily: + return "cursive"; + case FontDescription::FantasyFamily: + return "fantasy"; + case FontDescription::NoFamily: + default: + return ""; + } } -FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family) -{ - // Handle generic family types specially, because fontconfig does not know them, but we have - // code to fallback correctly in our platform data implementation. - if (!family.length() || family.startsWith("-webkit-") - || (fontDescription.genericFamily() != FontDescription::NoFamily) - || isWellKnownFontName(family)) - return new FontPlatformData(fontDescription, family); - // First check the font exists. - CString familyNameString = family.string().utf8(); - const char* fcfamily = familyNameString.data(); +static bool isFallbackFontAllowed(const CString& familyName) +{ + return !strcasecmp(familyName.data(), "sans") + || !strcasecmp(familyName.data(), "sans-serif") + || !strcasecmp(familyName.data(), "serif") + || !strcasecmp(familyName.data(), "monospace"); +} +FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family) +{ + // The CSS font matching algorithm (http://www.w3.org/TR/css3-fonts/#font-matching-algorithm) + // says that we must find an exact match for font family, slant (italic or oblique can be used) + // and font weight (we only match bold/non-bold here). PlatformRefPtr<FcPattern> pattern = adoptPlatformRef(FcPatternCreate()); - if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily))) + CString familyNameString = getFamilyNameStringFromFontDescriptionAndFamily(fontDescription, family); + if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(familyNameString.data()))) return 0; - OwnPtr<FcObjectSet> objectSet(FcObjectSetCreate()); - if (!FcObjectSetAdd(objectSet.get(), FC_FAMILY)) + bool italic = fontDescription.italic(); + if (!FcPatternAddInteger(pattern.get(), FC_SLANT, italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN)) + return 0; + bool bold = fontDescription.weight() >= FontWeightBold; + if (!FcPatternAddInteger(pattern.get(), FC_WEIGHT, bold ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL)) + return 0; + if (!FcPatternAddDouble(pattern.get(), FC_PIXEL_SIZE, fontDescription.computedPixelSize())) return 0; - OwnPtr<FcFontSet> fontSet(FcFontList(0, pattern.get(), objectSet.get())); - - if (!fontSet) + // The following comment and strategy are originally from Skia (src/ports/SkFontHost_fontconfig.cpp): + // Font matching: + // CSS often specifies a fallback list of families: + // font-family: a, b, c, serif; + // However, fontconfig will always do its best to find *a* font when asked + // for something so we need a way to tell if the match which it has found is + // "good enough" for us. Otherwise, we can return null which gets piped up + // and lets WebKit know to try the next CSS family name. However, fontconfig + // configs allow substitutions (mapping "Arial -> Helvetica" etc) and we + // wish to support that. + // + // Thus, if a specific family is requested we set @family_requested. Then we + // record two strings: the family name after config processing and the + // family name after resolving. If the two are equal, it's a good match. + // + // So consider the case where a user has mapped Arial to Helvetica in their + // config. + // requested family: "Arial" + // post_config_family: "Helvetica" + // post_match_family: "Helvetica" + // -> good match + // + // and for a missing font: + // requested family: "Monaco" + // post_config_family: "Monaco" + // post_match_family: "Times New Roman" + // -> BAD match + // + FcConfigSubstitute(0, pattern.get(), FcMatchPattern); + FcDefaultSubstitute(pattern.get()); + + FcChar8* familyNameAfterConfiguration; + FcPatternGetString(pattern.get(), FC_FAMILY, 0, &familyNameAfterConfiguration); + + FcResult fontConfigResult; + PlatformRefPtr<FcPattern> resultPattern = adoptPlatformRef(FcFontMatch(0, pattern.get(), &fontConfigResult)); + if (!resultPattern) // No match. return 0; - if (!fontSet->fonts) + // Properly handle the situation where Fontconfig gives us a font that has a different family than we requested. + FcChar8* familyNameAfterMatching; + FcPatternGetString(resultPattern.get(), FC_FAMILY, 0, &familyNameAfterMatching); + if (strcasecmp(reinterpret_cast<char*>(familyNameAfterConfiguration), + reinterpret_cast<char*>(familyNameAfterMatching)) && !isFallbackFontAllowed(familyNameString)) return 0; - return new FontPlatformData(fontDescription, family); + return new FontPlatformData(resultPattern.get(), fontDescription); } } diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp index 6b76c2a..0d195cb 100644 --- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) 2010 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,11 +24,37 @@ #include "FontPlatformData.h" #include "SharedBuffer.h" +#include <cairo-ft.h> +#include <cairo.h> namespace WebCore { +static void releaseCustomFontData(void* data) +{ + static_cast<SharedBuffer*>(data)->deref(); +} + +FontCustomPlatformData::FontCustomPlatformData(FT_Face freeTypeFace, SharedBuffer* buffer) + : m_freeTypeFace(freeTypeFace) + , m_fontFace(cairo_ft_font_face_create_for_ft_face(freeTypeFace, 0)) +{ + // FIXME Should we be setting some hinting options here? + + buffer->ref(); // This is balanced by the buffer->deref() in releaseCustomFontData. + static cairo_user_data_key_t bufferKey; + cairo_font_face_set_user_data(m_fontFace, &bufferKey, buffer, + static_cast<cairo_destroy_func_t>(releaseCustomFontData)); + + // Cairo doesn't do FreeType reference counting, so we need to ensure that when + // this cairo_font_face_t is destroyed, it cleans up the FreeType face as well. + static cairo_user_data_key_t freeTypeFaceKey; + cairo_font_face_set_user_data(m_fontFace, &freeTypeFaceKey, freeTypeFace, + reinterpret_cast<cairo_destroy_func_t>(FT_Done_Face)); +} + FontCustomPlatformData::~FontCustomPlatformData() { + // m_freeTypeFace will be destroyed along with m_fontFace. See the constructor. cairo_font_face_destroy(m_fontFace); } @@ -36,38 +63,20 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b return FontPlatformData(m_fontFace, size, bold, italic); } -static void releaseData(void* data) -{ - static_cast<SharedBuffer*>(data)->deref(); -} - FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) { ASSERT_ARG(buffer, buffer); - int error; - static FT_Library library = 0; - if (!library) { - error = FT_Init_FreeType(&library); - if (error) { - library = 0; - return 0; - } + if (!library && FT_Init_FreeType(&library)) { + library = 0; + return 0; } - FT_Face face; - error = FT_New_Memory_Face(library, reinterpret_cast<const FT_Byte*>(buffer->data()), buffer->size(), 0, &face); - if (error) + FT_Face freeTypeFace; + if (FT_New_Memory_Face(library, reinterpret_cast<const FT_Byte*>(buffer->data()), buffer->size(), 0, &freeTypeFace)) return 0; - - buffer->ref(); - cairo_font_face_t* fontFace = cairo_ft_font_face_create_for_ft_face(face, 0); - - static cairo_user_data_key_t bufferKey; - cairo_font_face_set_user_data(fontFace, &bufferKey, buffer, releaseData); - - return new FontCustomPlatformData(fontFace); + return new FontCustomPlatformData(freeTypeFace, buffer); } bool FontCustomPlatformData::supportsFormat(const String& format) diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h index a72a6a4..c48d110 100644 --- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) 2010 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -25,6 +26,7 @@ #include <wtf/Forward.h> #include <wtf/Noncopyable.h> +typedef struct FT_FaceRec_* FT_Face; typedef struct _cairo_font_face cairo_font_face_t; namespace WebCore { @@ -33,16 +35,14 @@ class FontPlatformData; class SharedBuffer; struct FontCustomPlatformData : Noncopyable { - FontCustomPlatformData(cairo_font_face_t* fontFace) - : m_fontFace(fontFace) - {} - +public: + FontCustomPlatformData(FT_Face, SharedBuffer*); ~FontCustomPlatformData(); - FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); - static bool supportsFormat(const String&); +private: + FT_Face m_freeTypeFace; cairo_font_face_t* m_fontFace; }; diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp index 7968966..0617e6c 100644 --- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp +++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2009 Igalia S.L. + * Copyright (C) 2009, 2010 Igalia S.L. * All rights reserved. * * This library is free software; you can redistribute it and/or @@ -27,100 +27,88 @@ #include "PlatformString.h" #include "FontDescription.h" -#include <wtf/text/CString.h> - #include <cairo-ft.h> #include <cairo.h> #include <fontconfig/fcfreetype.h> + #if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT) #include <gdk/gdk.h> #endif namespace WebCore { -FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const AtomicString& familyName) - : m_fallbacks(0) +cairo_subpixel_order_t convertFontConfigSubpixelOrder(int fontConfigOrder) +{ + switch (fontConfigOrder) { + case FC_RGBA_RGB: + return CAIRO_SUBPIXEL_ORDER_RGB; + case FC_RGBA_BGR: + return CAIRO_SUBPIXEL_ORDER_BGR; + case FC_RGBA_VRGB: + return CAIRO_SUBPIXEL_ORDER_VRGB; + case FC_RGBA_VBGR: + return CAIRO_SUBPIXEL_ORDER_VBGR; + case FC_RGBA_NONE: + case FC_RGBA_UNKNOWN: + return CAIRO_SUBPIXEL_ORDER_DEFAULT; + } + return CAIRO_SUBPIXEL_ORDER_DEFAULT; +} + +cairo_hint_style_t convertFontConfigHintStyle(int fontConfigStyle) +{ + switch (fontConfigStyle) { + case FC_HINT_NONE: + return CAIRO_HINT_STYLE_NONE; + case FC_HINT_SLIGHT: + return CAIRO_HINT_STYLE_SLIGHT; + case FC_HINT_MEDIUM: + return CAIRO_HINT_STYLE_MEDIUM; + case FC_HINT_FULL: + return CAIRO_HINT_STYLE_FULL; + } + return CAIRO_HINT_STYLE_NONE; +} + +void setCairoFontOptionsFromFontConfigPattern(cairo_font_options_t* options, FcPattern* pattern) +{ + FcBool booleanResult; + int integerResult; + + // We will determine if subpixel anti-aliasing is enabled via the FC_RGBA setting. + if (FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &booleanResult) == FcResultMatch && booleanResult) + cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY); + + if (FcPatternGetInteger(pattern, FC_RGBA, 0, &integerResult) == FcResultMatch) { + if (integerResult != FC_RGBA_NONE) + cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_SUBPIXEL); + cairo_font_options_set_subpixel_order(options, convertFontConfigSubpixelOrder(integerResult)); + } + + if (FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &integerResult) == FcResultMatch) + cairo_font_options_set_hint_style(options, convertFontConfigHintStyle(integerResult)); + + if (FcPatternGetBool(pattern, FC_HINTING, 0, &booleanResult) == FcResultMatch && !booleanResult) + cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE); +} + +FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fontDescription) + : m_pattern(pattern) + , m_fallbacks(0) , m_size(fontDescription.computedPixelSize()) , m_syntheticBold(false) , m_syntheticOblique(false) { - FontPlatformData::init(); - - CString familyNameString = familyName.string().utf8(); - const char* fcfamily = familyNameString.data(); - int fcslant = FC_SLANT_ROMAN; - // FIXME: Map all FontWeight values to fontconfig weights. - int fcweight = FC_WEIGHT_NORMAL; - double fcsize = fontDescription.computedPixelSize(); - if (fontDescription.italic()) - fcslant = FC_SLANT_ITALIC; - if (fontDescription.weight() >= FontWeight600) - fcweight = FC_WEIGHT_BOLD; - - int type = fontDescription.genericFamily(); - - PlatformRefPtr<FcPattern> pattern = adoptPlatformRef(FcPatternCreate()); - cairo_font_face_t* fontFace; - static const cairo_font_options_t* defaultOptions = cairo_font_options_create(); - const cairo_font_options_t* options = NULL; - cairo_matrix_t fontMatrix; - - if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily))) - return; - - switch (type) { - case FontDescription::SerifFamily: - fcfamily = "serif"; - break; - case FontDescription::SansSerifFamily: - fcfamily = "sans-serif"; - break; - case FontDescription::MonospaceFamily: - fcfamily = "monospace"; - break; - case FontDescription::StandardFamily: - fcfamily = "sans-serif"; - break; - case FontDescription::NoFamily: - default: - fcfamily = NULL; - break; - } + cairo_font_options_t* options = cairo_font_options_create(); + setCairoFontOptionsFromFontConfigPattern(options, pattern); - if (fcfamily && !FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily))) - return; - if (!FcPatternAddInteger(pattern.get(), FC_WEIGHT, fcweight)) - return; - if (!FcPatternAddInteger(pattern.get(), FC_SLANT, fcslant)) - return; - if (!FcPatternAddDouble(pattern.get(), FC_PIXEL_SIZE, fcsize)) - return; - - FcConfigSubstitute(0, pattern.get(), FcMatchPattern); - FcDefaultSubstitute(pattern.get()); - - FcResult fcresult; - m_pattern = adoptPlatformRef(FcFontMatch(0, pattern.get(), &fcresult)); - // FIXME: should we set some default font? - if (!m_pattern) - return; - fontFace = cairo_ft_font_face_create_for_pattern(m_pattern.get()); + cairo_matrix_t fontMatrix; + cairo_matrix_init_scale(&fontMatrix, m_size, m_size); cairo_matrix_t ctm; - cairo_matrix_init_scale(&fontMatrix, fontDescription.computedPixelSize(), fontDescription.computedPixelSize()); cairo_matrix_init_identity(&ctm); -#if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT) - if (GdkScreen* screen = gdk_screen_get_default()) -gdk_screen_get_font_options(screen); -#endif - - // gdk_screen_get_font_options() returns NULL if no default options are - // set, so we always have to check. - if (!options) - options = defaultOptions; - - m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options)); - cairo_font_face_destroy(fontFace); + PlatformRefPtr<cairo_font_face_t> fontFace = adoptPlatformRef(cairo_ft_font_face_create_for_pattern(m_pattern.get())); + m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace.get(), &fontMatrix, &ctm, options)); } FontPlatformData::FontPlatformData(float size, bool bold, bool italic) @@ -184,19 +172,6 @@ FontPlatformData::FontPlatformData(const FontPlatformData& other) *this = other; } -bool FontPlatformData::init() -{ - static bool initialized = false; - if (initialized) - return true; - if (!FcInit()) { - fprintf(stderr, "Can't init font config library\n"); - return false; - } - initialized = true; - return true; -} - FontPlatformData::~FontPlatformData() { if (m_fallbacks) { diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h index 987a684..f3488ef 100644 --- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h +++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h @@ -3,6 +3,7 @@ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2007 Pioneer Research Center USA, Inc. + * Copyright (C) 2010 Igalia S.L. * All rights reserved. * * This library is free software; you can redistribute it and/or @@ -29,11 +30,10 @@ #include "GlyphBuffer.h" #include "HashFunctions.h" #include "PlatformRefPtrCairo.h" -#include <cairo-ft.h> -#include <cairo.h> -#include <fontconfig/fcfreetype.h> #include <wtf/Forward.h> +typedef struct _FcFontSet FcFontSet; + namespace WebCore { class FontPlatformData { @@ -53,14 +53,13 @@ public: , m_syntheticOblique(false) { } - FontPlatformData(const FontDescription&, const AtomicString& family); + FontPlatformData(FcPattern*, const FontDescription&); FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic); FontPlatformData(float size, bool bold, bool italic); FontPlatformData(const FontPlatformData&); ~FontPlatformData(); - static bool init(); bool isFixedPitch(); float size() const { return m_size; } void setSize(float size) { m_size = size; } diff --git a/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp b/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp index 26da68d..66e9c16 100644 --- a/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp +++ b/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp @@ -32,6 +32,9 @@ #include "GlyphPageTreeNode.h" #include "SimpleFontData.h" +#include <cairo-ft.h> +#include <cairo.h> +#include <fontconfig/fcfreetype.h> namespace WebCore { diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 5de7e1f..05096a9 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -35,6 +35,7 @@ #include "AffineTransform.h" #include "CairoPath.h" +#include "CairoUtilities.h" #include "FEGaussianBlur.h" #include "FloatRect.h" #include "Font.h" @@ -131,28 +132,10 @@ static inline void fillRectSourceOver(cairo_t* cr, const FloatRect& rect, const cairo_fill(cr); } -static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) -{ - cairo_set_antialias(dstCr, cairo_get_antialias(srcCr)); - - size_t dashCount = cairo_get_dash_count(srcCr); - Vector<double> dashes(dashCount); - - double offset; - cairo_get_dash(srcCr, dashes.data(), &offset); - cairo_set_dash(dstCr, dashes.data(), dashCount, offset); - cairo_set_line_cap(dstCr, cairo_get_line_cap(srcCr)); - cairo_set_line_join(dstCr, cairo_get_line_join(srcCr)); - cairo_set_line_width(dstCr, cairo_get_line_width(srcCr)); - cairo_set_miter_limit(dstCr, cairo_get_miter_limit(srcCr)); - cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr)); -} - static void appendPathToCairoContext(cairo_t* to, cairo_t* from) { - cairo_path_t* cairoPath = cairo_copy_path(from); - cairo_append_path(to, cairoPath); - cairo_path_destroy(cairoPath); + OwnPtr<cairo_path_t> cairoPath(cairo_copy_path(from)); + cairo_append_path(to, cairoPath.get()); } // We apply the pending path built via addPath to the Cairo context @@ -1182,9 +1165,8 @@ void GraphicsContext::clip(const Path& path) return; cairo_t* cr = m_data->cr; - cairo_path_t* p = cairo_copy_path(path.platformPath()->context()); - cairo_append_path(cr, p); - cairo_path_destroy(p); + OwnPtr<cairo_path_t> p(cairo_copy_path(path.platformPath()->context())); + cairo_append_path(cr, p.get()); cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING); cairo_clip(cr); @@ -1341,9 +1323,8 @@ void GraphicsContext::drawTiledShadow(const IntRect& rect, const FloatSize& topL copyContextProperties(cr, shadowContext); cairo_translate(shadowContext, -rect.x() + blurRadius, -rect.y() + blurRadius); cairo_new_path(shadowContext); - cairo_path_t* path = cairo_copy_path(cr); - cairo_append_path(shadowContext, path); - cairo_path_destroy(path); + OwnPtr<cairo_path_t> path(cairo_copy_path(cr)); + cairo_append_path(shadowContext, path.get()); setPlatformFill(this, shadowContext, m_common); diff --git a/WebCore/platform/graphics/cairo/PathCairo.cpp b/WebCore/platform/graphics/cairo/PathCairo.cpp index 05c6952..776bceb 100644 --- a/WebCore/platform/graphics/cairo/PathCairo.cpp +++ b/WebCore/platform/graphics/cairo/PathCairo.cpp @@ -29,9 +29,9 @@ #include "CairoPath.h" #include "FloatRect.h" #include "GraphicsContext.h" +#include "OwnPtrCairo.h" #include "PlatformString.h" #include "StrokeStyleApplier.h" - #include <cairo.h> #include <math.h> #include <wtf/MathExtras.h> @@ -52,9 +52,8 @@ Path::Path(const Path& other) : m_path(new CairoPath()) { cairo_t* cr = platformPath()->context(); - cairo_path_t* p = cairo_copy_path(other.platformPath()->context()); - cairo_append_path(cr, p); - cairo_path_destroy(p); + OwnPtr<cairo_path_t> p(cairo_copy_path(other.platformPath()->context())); + cairo_append_path(cr, p.get()); } Path& Path::operator=(const Path& other) @@ -64,9 +63,8 @@ Path& Path::operator=(const Path& other) clear(); cairo_t* cr = platformPath()->context(); - cairo_path_t* p = cairo_copy_path(other.platformPath()->context()); - cairo_append_path(cr, p); - cairo_path_destroy(p); + OwnPtr<cairo_path_t> p(cairo_copy_path(other.platformPath()->context())); + cairo_append_path(cr, p.get()); return *this; } @@ -297,7 +295,7 @@ bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) void Path::apply(void* info, PathApplierFunction function) const { cairo_t* cr = platformPath()->context(); - cairo_path_t* path = cairo_copy_path(cr); + OwnPtr<cairo_path_t> path(cairo_copy_path(cr)); cairo_path_data_t* data; PathElement pelement; FloatPoint points[3]; @@ -329,7 +327,6 @@ void Path::apply(void* info, PathApplierFunction function) const break; } } - cairo_path_destroy(path); } void Path::transform(const AffineTransform& trans) @@ -346,7 +343,7 @@ String Path::debugString() const return String(); String pathString; - cairo_path_t* path = cairo_copy_path(platformPath()->context()); + OwnPtr<cairo_path_t> path(cairo_copy_path(platformPath()->context())); cairo_path_data_t* data; for (int i = 0; i < path->num_data; i += path->data[i].header.length) { @@ -373,7 +370,6 @@ String Path::debugString() const } } - cairo_path_destroy(path); return pathString.simplifyWhiteSpace(); } diff --git a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp index aa466f9..d289585 100644 --- a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp +++ b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp @@ -54,6 +54,19 @@ template <> void derefPlatformPtr(cairo_surface_t* ptr) cairo_surface_destroy(ptr); } +template <> cairo_font_face_t* refPlatformPtr(cairo_font_face_t* ptr) +{ + if (ptr) + cairo_font_face_reference(ptr); + return ptr; +} + +template <> void derefPlatformPtr(cairo_font_face_t* ptr) +{ + if (ptr) + cairo_font_face_destroy(ptr); +} + template <> cairo_scaled_font_t* refPlatformPtr(cairo_scaled_font_t* ptr) { if (ptr) diff --git a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h index 4b45c1b..3b720c6 100644 --- a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h +++ b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h @@ -24,6 +24,7 @@ typedef struct _cairo cairo_t; typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo_font_face cairo_font_face_t; typedef struct _cairo_scaled_font cairo_scaled_font_t; #if defined(USE_FREETYPE) @@ -38,6 +39,9 @@ template <> void derefPlatformPtr(cairo_t* ptr); template <> cairo_surface_t* refPlatformPtr(cairo_surface_t* ptr); template <> void derefPlatformPtr(cairo_surface_t* ptr); +template <> cairo_font_face_t* refPlatformPtr(cairo_font_face_t*); +template <> void derefPlatformPtr(cairo_font_face_t*); + template <> cairo_scaled_font_t* refPlatformPtr(cairo_scaled_font_t*); template <> void derefPlatformPtr(cairo_scaled_font_t*); diff --git a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp index fd85d6f..3d7c34b 100644 --- a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp +++ b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp @@ -38,7 +38,9 @@ #include "FontCache.h" #include "FontDescription.h" #include "GlyphBuffer.h" +#include <cairo-ft.h> #include <cairo.h> +#include <fontconfig/fcfreetype.h> #include <wtf/MathExtras.h> namespace WebCore { @@ -81,12 +83,12 @@ void SimpleFontData::platformDestroy() SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const { - if (!m_smallCapsFontData) { - FontDescription desc = FontDescription(fontDescription); - desc.setComputedSize(0.70f * fontDescription.computedSize()); - FontPlatformData platformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(platformData); - } + // FIXME: I think we want to ask FontConfig for the right font again. + if (!m_smallCapsFontData) + m_smallCapsFontData = new SimpleFontData( + FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()), + 0.70f * fontDescription.computedSize(), m_platformData.syntheticBold(), m_platformData.syntheticOblique())); + return m_smallCapsFontData; } diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp index fadc385..2a81fd2 100644 --- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp @@ -71,9 +71,54 @@ bool GraphicsContext3D::getImageData(Image* image, AlphaOp neededAlphaOp = kAlphaDoNothing; switch (CGImageGetAlphaInfo(cgImage)) { case kCGImageAlphaPremultipliedFirst: + // This path is only accessible for MacOS earlier than 10.6.4. + // This is a special case for texImage2D with HTMLCanvasElement input, + // in which case image->data() should be null. + ASSERT(!image->data()); + if (!premultiplyAlpha) + neededAlphaOp = kAlphaDoUnmultiply; + switch (componentsPerPixel) { + case 2: + srcDataFormat = kSourceFormatAR8; + break; + case 4: + srcDataFormat = kSourceFormatARGB8; + break; + default: + return false; + } + break; case kCGImageAlphaFirst: + // This path is only accessible for MacOS earlier than 10.6.4. + if (premultiplyAlpha) + neededAlphaOp = kAlphaDoPremultiply; + switch (componentsPerPixel) { + case 1: + srcDataFormat = kSourceFormatA8; + break; + case 2: + srcDataFormat = kSourceFormatAR8; + break; + case 4: + srcDataFormat = kSourceFormatARGB8; + break; + default: + return false; + } + break; case kCGImageAlphaNoneSkipFirst: - return false; + // This path is only accessible for MacOS earlier than 10.6.4. + switch (componentsPerPixel) { + case 2: + srcDataFormat = kSourceFormatAR8; + break; + case 4: + srcDataFormat = kSourceFormatARGB8; + break; + default: + return false; + } + break; case kCGImageAlphaPremultipliedLast: // This is a special case for texImage2D with HTMLCanvasElement input, // in which case image->data() should be null. diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 86be8da..8dda4d6 100644 --- a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -126,10 +126,28 @@ ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner) ContentLayerChromium::~ContentLayerChromium() { - if (m_contentsTexture) - GLC(layerRendererContext(), layerRendererContext()->deleteTexture(m_contentsTexture)); + cleanupResources(); } +void ContentLayerChromium::setLayerRenderer(LayerRendererChromium* renderer) +{ + // If we're changing layer renderers then we need to free up any resources + // allocated by the old renderer. + if (layerRenderer() && layerRenderer() != renderer) + cleanupResources(); + + LayerChromium::setLayerRenderer(renderer); +} + +void ContentLayerChromium::cleanupResources() +{ + if (layerRenderer()) { + if (m_contentsTexture) { + layerRenderer()->deleteLayerTexture(m_contentsTexture); + m_contentsTexture = 0; + } + } +} void ContentLayerChromium::updateContents() { diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.h b/WebCore/platform/graphics/chromium/ContentLayerChromium.h index 42a77c7..412ba06 100644 --- a/WebCore/platform/graphics/chromium/ContentLayerChromium.h +++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.h @@ -49,6 +49,7 @@ public: virtual void updateContents(); virtual void draw(); virtual bool drawsContent() { return m_owner && m_owner->drawsContent(); } + virtual void setLayerRenderer(LayerRendererChromium*); // Stores values that are shared between instances of this class that are // associated with the same LayerRendererChromium (and hence the same GL @@ -79,6 +80,8 @@ protected: void updateTextureRect(void* pixels, const IntSize& bitmapSize, const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId); + void cleanupResources(); + unsigned m_contentsTexture; IntSize m_allocatedTextureSize; bool m_skipsDraw; diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp index 696cd9c..a242523 100644 --- a/WebCore/platform/graphics/chromium/FontLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontLinux.cpp @@ -130,7 +130,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, if (textMode & cTextFill) { // If we also filled, we don't want to draw shadows twice. // See comment in FontChromiumWin.cpp::paintSkiaText() for more details. - paint.setLooper(0)->safeUnref(); + SkSafeUnref(paint.setLooper(0)); } canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint); @@ -313,7 +313,7 @@ public: // So we allow that to run first, then do a second pass over the range it // found and take the largest subregion that stays within a single font. const FontData* glyphData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos], false, false).fontData; - int endOfRun; + unsigned endOfRun; for (endOfRun = 1; endOfRun < m_item.item.length; ++endOfRun) { const FontData* nextGlyphData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos + endOfRun], false, false).fontData; if (nextGlyphData != glyphData) @@ -406,7 +406,7 @@ private: // Harfbuzz will do the same thing for us using the GSUB table. // 2) Convert spacing characters into plain spaces, as some fonts will provide glyphs // for characters like '\n' otherwise. - for (unsigned i = 0; i < originalRun.length(); ++i) { + for (int i = 0; i < originalRun.length(); ++i) { UChar ch = originalRun[i]; UBlockCode block = ::ublock_getCode(ch); if (block == UBLOCK_COMBINING_DIACRITICAL_MARKS || (Font::treatAsSpace(ch) && ch != ' ')) { @@ -428,7 +428,7 @@ private: normalizedString.extract(m_normalizedBuffer.get(), normalizedString.length() + 1, error); ASSERT(U_SUCCESS(error)); - for (unsigned i = 0; i < normalizedString.length(); ++i) { + for (int i = 0; i < normalizedString.length(); ++i) { if (Font::treatAsSpace(m_normalizedBuffer[i])) m_normalizedBuffer[i] = ' '; } @@ -517,7 +517,7 @@ private: // glyph. unsigned logClustersIndex = isRTL ? m_item.num_glyphs - 1 : 0; - for (int iter = 0; iter < m_item.num_glyphs; ++iter) { + for (unsigned iter = 0; iter < m_item.num_glyphs; ++iter) { // Glyphs are stored in logical order, but for layout purposes we // always go left to right. int i = isRTL ? m_item.num_glyphs - iter - 1 : iter; @@ -683,7 +683,7 @@ static int glyphIndexForXPositionInScriptRun(const TextRunWalker& walker, int x) x -= truncateFixedPointToInteger(advances[glyphIndex]); } } else { - for (glyphIndex = 0; glyphIndex < walker.length(); ++glyphIndex) { + for (glyphIndex = 0; static_cast<unsigned>(glyphIndex) < walker.length(); ++glyphIndex) { if (x < truncateFixedPointToInteger(advances[glyphIndex])) break; x -= truncateFixedPointToInteger(advances[glyphIndex]); @@ -741,7 +741,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, if (walker.rtl()) basePosition -= walker.numCodePoints(); - if (x >= 0 && x < walker.width()) { + if (x >= 0 && static_cast<unsigned>(x) < walker.width()) { // The x value in question is within this script run. We consider // each glyph in presentation order and stop when we find the one // covering this position. @@ -803,7 +803,7 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, if (walker.rtl()) base -= walker.width(); - if (fromX == -1 && from < walker.numCodePoints()) { + if (fromX == -1 && from >= 0 && static_cast<unsigned>(from) < walker.numCodePoints()) { // |from| is within this script run. So we index the clusters log to // find which glyph this code-point contributed to and find its x // position. @@ -813,7 +813,7 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, } else from -= walker.numCodePoints(); - if (toX == -1 && to < walker.numCodePoints()) { + if (toX == -1 && to >= 0 && static_cast<unsigned>(to) < walker.numCodePoints()) { int glyph = walker.logClusters()[to]; toX = base + walker.xPositions()[glyph]; toAdvance = walker.advances()[glyph]; diff --git a/WebCore/platform/graphics/chromium/FontPlatformData.h b/WebCore/platform/graphics/chromium/FontPlatformData.h index 871fec8..d8ce3e2 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformData.h +++ b/WebCore/platform/graphics/chromium/FontPlatformData.h @@ -33,7 +33,7 @@ #if OS(WINDOWS) #include "FontPlatformDataChromiumWin.h" -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) #include "FontPlatformDataLinux.h" #endif diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp index b51eb8c..0da873b 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp @@ -76,7 +76,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src) , m_style(src.m_style) , m_harfbuzzFace(src.m_harfbuzzFace) { - m_typeface->safeRef(); + SkSafeRef(m_typeface); } FontPlatformData::FontPlatformData(SkTypeface* tf, const char* family, float textSize, bool fakeBold, bool fakeItalic) @@ -86,7 +86,7 @@ FontPlatformData::FontPlatformData(SkTypeface* tf, const char* family, float tex , m_fakeBold(fakeBold) , m_fakeItalic(fakeItalic) { - m_typeface->safeRef(); + SkSafeRef(m_typeface); querySystemForRenderStyle(); } @@ -98,13 +98,13 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) , m_fakeItalic(src.m_fakeItalic) , m_harfbuzzFace(src.m_harfbuzzFace) { - m_typeface->safeRef(); + SkSafeRef(m_typeface); querySystemForRenderStyle(); } FontPlatformData::~FontPlatformData() { - m_typeface->safeUnref(); + SkSafeUnref(m_typeface); } FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) diff --git a/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp b/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp index 59e8122..056d8eb 100644 --- a/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp +++ b/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp @@ -150,7 +150,7 @@ static HB_Error getOutlinePoint(HB_Font hbFont, HB_Glyph glyph, int flags, hb_ui SkPath path; paint.getTextPath(&glyph16, sizeof(glyph16), 0, 0, &path); int numPoints = path.getPoints(0, 0); - if (point >= numPoints) + if (point >= static_cast<unsigned>(numPoints)) return HB_Err_Invalid_SubTable; SkPoint* points = reinterpret_cast<SkPoint*>(fastMalloc(sizeof(SkPoint) * (point + 1))); if (!points) diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp index e36c69d..5dba58d 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -174,9 +174,6 @@ LayerChromium::~LayerChromium() void LayerChromium::setLayerRenderer(LayerRendererChromium* renderer) { - // It's not expected that layers will ever switch renderers. - ASSERT(!renderer || !m_layerRenderer || renderer == m_layerRenderer); - m_layerRenderer = renderer; } @@ -224,9 +221,10 @@ unsigned LayerChromium::createShaderProgram(GraphicsContext3D* context, const ch void LayerChromium::setNeedsCommit() { - // Call notifySyncRequired(), which in this implementation plumbs through to + // Call notifySyncRequired(), which for non-root layers plumbs through to // call setRootLayerNeedsDisplay() on the WebView, which will cause LayerRendererChromium // to render a frame. + // This function has no effect on root layers. if (m_owner) m_owner->notifySyncRequired(); } @@ -352,8 +350,9 @@ LayerChromium* LayerChromium::superlayer() const void LayerChromium::setNeedsDisplay(const FloatRect& dirtyRect) { - // Simply mark the contents as dirty. The actual redraw will - // happen when it's time to do the compositing. + // Simply mark the contents as dirty. For non-root layers, the call to + // setNeedsCommit will schedule a fresh compositing pass. + // For the root layer, setNeedsCommit has no effect. m_contentsDirty = true; m_dirtyRect.unite(dirtyRect); diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h index 30d35d1..0a66318 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/WebCore/platform/graphics/chromium/LayerChromium.h @@ -147,7 +147,9 @@ public: bool preserves3D() { return m_owner && m_owner->preserves3D(); } - void setLayerRenderer(LayerRendererChromium*); + // Derived types must override this method if they need to react to a change + // in the LayerRendererChromium. + virtual void setLayerRenderer(LayerRendererChromium*); void setOwner(GraphicsLayerChromium* owner) { m_owner = owner; } @@ -200,7 +202,7 @@ protected: GraphicsLayerChromium* m_owner; LayerChromium(GraphicsLayerChromium* owner); - LayerRendererChromium* layerRenderer() const { return m_layerRenderer; } + LayerRendererChromium* layerRenderer() const { return m_layerRenderer.get(); } GraphicsContext3D* layerRendererContext() const; static void drawTexturedQuad(GraphicsContext3D*, const TransformationMatrix& projectionMatrix, const TransformationMatrix& layerMatrix, @@ -260,7 +262,7 @@ private: bool m_needsDisplayOnBoundsChange; // Points to the layer renderer that updates and draws this layer. - LayerRendererChromium* m_layerRenderer; + RefPtr<LayerRendererChromium> m_layerRenderer; FloatRect m_frame; TransformationMatrix m_transform; diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 116a15d..c4031e5 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -73,12 +73,12 @@ static inline bool compareLayerZ(const LayerChromium* a, const LayerChromium* b) return transformA.m43() < transformB.m43(); } -PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(PassOwnPtr<GraphicsContext3D> context) +PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(PassOwnPtr<GraphicsContext3D> context) { if (!context) return 0; - OwnPtr<LayerRendererChromium> layerRenderer(new LayerRendererChromium(context)); + RefPtr<LayerRendererChromium> layerRenderer(adoptRef(new LayerRendererChromium(context))); if (!layerRenderer->hardwareCompositing()) return 0; @@ -91,7 +91,6 @@ LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GraphicsContext3D> conte , m_rootLayerTextureHeight(0) , m_scrollShaderProgram(0) , m_rootLayer(0) - , m_needsDisplay(false) , m_scrollPosition(IntPoint(-1, -1)) , m_currentShader(0) , m_context(context) @@ -159,8 +158,10 @@ void LayerRendererChromium::useShader(unsigned programId) } } -// Updates the contents of the root layer texture that fall inside the updateRect -// and re-composits all sublayers. +// This method must be called before any other updates are made to the +// root layer texture. It resizes the root layer texture and scrolls its +// contents as needed. It also sets up common GL state used by the rest +// of the layer drawing code. void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, const IntRect& contentRect, const IntPoint& scrollPosition) { @@ -172,6 +173,8 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons makeContextCurrent(); GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_rootLayerTextureId)); + + bool skipScroll = false; // If the size of the visible area has changed then allocate a new texture // to store the contents of the root layer and adjust the projection matrix @@ -184,6 +187,10 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons m_projectionMatrix = orthoMatrix(0, visibleRectWidth, visibleRectHeight, 0, -1000, 1000); GLC(m_context, m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0)); + + // The root layer texture was just resized so its contents are not + // useful for scrolling. + skipScroll = true; } // The GL viewport covers the entire visible area, including the scrollbars. @@ -198,12 +205,20 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons GLC(m_context, m_context->depthFunc(GraphicsContext3D::LEQUAL)); GLC(m_context, m_context->clearStencil(0)); - if (m_scrollPosition == IntPoint(-1, -1)) + if (m_scrollPosition == IntPoint(-1, -1)) { m_scrollPosition = scrollPosition; + skipScroll = true; + } IntPoint scrollDelta = toPoint(scrollPosition - m_scrollPosition); + + // Scrolling larger than the contentRect size does not preserve any of the pixels, so there is + // no need to copy framebuffer pixels back into the texture. + if (abs(scrollDelta.y()) > contentRect.height() || abs(scrollDelta.x()) > contentRect.width()) + skipScroll = true; + // Scroll the backbuffer - if (scrollDelta.x() || scrollDelta.y()) { + if (!skipScroll && (scrollDelta.x() || scrollDelta.y())) { // Scrolling works as follows: We render a quad with the current root layer contents // translated by the amount the page has scrolled since the last update and then read the // pixels of the content area (visible area excluding the scroll bars) back into the @@ -221,23 +236,9 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons m_scrollShaderMatrixLocation, -1); GLC(m_context, m_context->copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height())); - m_scrollPosition = scrollPosition; - } else if (abs(scrollDelta.y()) > contentRect.height() || abs(scrollDelta.x()) > contentRect.width()) { - // Scrolling larger than the contentRect size does not preserve any of the pixels, so there is - // no need to copy framebuffer pixels back into the texture. - m_scrollPosition = scrollPosition; } - // Translate all the composited layers by the scroll position. - TransformationMatrix matrix; - matrix.translate3d(-m_scrollPosition.x(), -m_scrollPosition.y(), 0); - - // Traverse the layer tree and update the layer transforms. - float opacity = 1; - const Vector<RefPtr<LayerChromium> >& sublayers = m_rootLayer->getSublayers(); - size_t i; - for (i = 0; i < sublayers.size(); i++) - updateLayersRecursive(sublayers[i].get(), matrix, opacity); + m_scrollPosition = scrollPosition; } void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect) @@ -256,9 +257,7 @@ void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect #if PLATFORM(SKIA) // Get the contents of the updated rect. const SkBitmap bitmap = m_rootLayerCanvas->getDevice()->accessBitmap(false); - int bitmapWidth = bitmap.width(); - int bitmapHeight = bitmap.height(); - ASSERT(bitmapWidth == updateRect.width() && bitmapHeight == updateRect.height()); + ASSERT(bitmap.width() == updateRect.width() && bitmap.height() == updateRect.height()); void* pixels = bitmap.getPixels(); #elif PLATFORM(CG) // Get the contents of the updated rect. @@ -306,16 +305,13 @@ void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect // Set the rootVisibleRect --- used by subsequent drawLayers calls m_rootVisibleRect = visibleRect; - // Translate all the composited layers by the scroll position. - TransformationMatrix matrix; - matrix.translate3d(-m_scrollPosition.x(), -m_scrollPosition.y(), 0); - // Traverse the layer tree and update the layer transforms. float opacity = 1; const Vector<RefPtr<LayerChromium> >& sublayers = m_rootLayer->getSublayers(); size_t i; + TransformationMatrix identityMatrix; for (i = 0; i < sublayers.size(); i++) - updateLayersRecursive(sublayers[i].get(), matrix, opacity); + updateLayersRecursive(sublayers[i].get(), identityMatrix, opacity); // Enable scissoring to avoid rendering composited layers over the scrollbars. GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); @@ -349,7 +345,6 @@ void LayerRendererChromium::present() // Note that currently this has the same effect as swapBuffers; we should // consider exposing a different entry point on GraphicsContext3D. m_context->prepareTexture(); - m_needsDisplay = false; } void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& rect) @@ -381,6 +376,14 @@ unsigned LayerRendererChromium::createLayerTexture() return textureId; } +void LayerRendererChromium::deleteLayerTexture(unsigned textureId) +{ + if (!textureId) + return; + + GLC(m_context, m_context->deleteTexture(textureId)); +} + // Returns true if any part of the layer falls within the visibleRect bool LayerRendererChromium::isLayerVisible(LayerChromium* layer, const TransformationMatrix& matrix, const IntRect& visibleRect) { @@ -717,7 +720,8 @@ bool LayerRendererChromium::initializeSharedObjects() m_layerSharedValues = adoptPtr(new LayerChromium::SharedValues(m_context.get())); m_contentLayerSharedValues = adoptPtr(new ContentLayerChromium::SharedValues(m_context.get())); m_canvasLayerSharedValues = adoptPtr(new CanvasLayerChromium::SharedValues(m_context.get())); - if (!m_layerSharedValues->initialized() || !m_contentLayerSharedValues->initialized() || !m_canvasLayerSharedValues->initialized()) { + m_videoLayerSharedValues = adoptPtr(new VideoLayerChromium::SharedValues(m_context.get())); + if (!m_layerSharedValues->initialized() || !m_contentLayerSharedValues->initialized() || !m_canvasLayerSharedValues->initialized() || !m_videoLayerSharedValues->initialized()) { cleanupSharedObjects(); return false; } @@ -732,6 +736,7 @@ void LayerRendererChromium::cleanupSharedObjects() m_layerSharedValues.clear(); m_contentLayerSharedValues.clear(); m_canvasLayerSharedValues.clear(); + m_videoLayerSharedValues.clear(); if (m_scrollShaderProgram) { GLC(m_context, m_context->deleteProgram(m_scrollShaderProgram)); @@ -739,7 +744,7 @@ void LayerRendererChromium::cleanupSharedObjects() } if (m_rootLayerTextureId) { - GLC(m_context, m_context->deleteTexture(m_rootLayerTextureId)); + deleteLayerTexture(m_rootLayerTextureId); m_rootLayerTextureId = 0; } } diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h index c733228..b714584 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -39,9 +39,12 @@ #include "IntRect.h" #include "LayerChromium.h" #include "SkBitmap.h" +#include "VideoLayerChromium.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> #include <wtf/Vector.h> #if PLATFORM(CG) @@ -54,9 +57,9 @@ namespace WebCore { class GraphicsContext3D; // Class that handles drawing of composited render layers using GL. -class LayerRendererChromium : public Noncopyable { +class LayerRendererChromium : public RefCounted<LayerRendererChromium> { public: - static PassOwnPtr<LayerRendererChromium> create(PassOwnPtr<GraphicsContext3D> graphicsContext3D); + static PassRefPtr<LayerRendererChromium> create(PassOwnPtr<GraphicsContext3D> graphicsContext3D); LayerRendererChromium(PassOwnPtr<GraphicsContext3D> graphicsContext3D); ~LayerRendererChromium(); @@ -81,8 +84,6 @@ public: void setRootLayer(PassRefPtr<LayerChromium> layer) { m_rootLayer = layer; } LayerChromium* rootLayer() { return m_rootLayer.get(); } - void setNeedsDisplay() { m_needsDisplay = true; } - bool hardwareCompositing() const { return m_hardwareCompositing; } void setRootLayerCanvasSize(const IntSize&); @@ -90,6 +91,7 @@ public: GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); } unsigned createLayerTexture(); + void deleteLayerTexture(unsigned); static void debugGLCall(GraphicsContext3D*, const char* command, const char* file, int line); @@ -102,6 +104,7 @@ public: const LayerChromium::SharedValues* layerSharedValues() const { return m_layerSharedValues.get(); } const ContentLayerChromium::SharedValues* contentLayerSharedValues() const { return m_contentLayerSharedValues.get(); } const CanvasLayerChromium::SharedValues* canvasLayerSharedValues() const { return m_canvasLayerSharedValues.get(); } + const VideoLayerChromium::SharedValues* videoLayerSharedValues() const { return m_videoLayerSharedValues.get(); } void resizeOnscreenContent(const IntSize&); @@ -139,7 +142,6 @@ private: RefPtr<LayerChromium> m_rootLayer; - bool m_needsDisplay; IntPoint m_scrollPosition; bool m_hardwareCompositing; @@ -170,6 +172,7 @@ private: OwnPtr<LayerChromium::SharedValues> m_layerSharedValues; OwnPtr<ContentLayerChromium::SharedValues> m_contentLayerSharedValues; OwnPtr<CanvasLayerChromium::SharedValues> m_canvasLayerSharedValues; + OwnPtr<VideoLayerChromium::SharedValues> m_videoLayerSharedValues; OwnPtr<GraphicsContext3D> m_context; }; diff --git a/WebCore/platform/graphics/chromium/VDMXParser.cpp b/WebCore/platform/graphics/chromium/VDMXParser.cpp index 3347226..bd30a97 100644 --- a/WebCore/platform/graphics/chromium/VDMXParser.cpp +++ b/WebCore/platform/graphics/chromium/VDMXParser.cpp @@ -31,7 +31,6 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> // For htons/ntohs #include <arpa/inet.h> diff --git a/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp b/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp new file mode 100644 index 0000000..43b40e2 --- /dev/null +++ b/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "VideoFrameChromium.h" + +namespace WebCore { + +const unsigned VideoFrameChromium::maxPlanes = 3; +const unsigned VideoFrameChromium::numRGBPlanes = 1; +const unsigned VideoFrameChromium::rgbPlane = 0; +const unsigned VideoFrameChromium::numYUVPlanes = 3; +const unsigned VideoFrameChromium::yPlane = 0; +const unsigned VideoFrameChromium::uPlane = 1; +const unsigned VideoFrameChromium::vPlane = 2; + +} // namespace WebCore + + diff --git a/WebCore/platform/graphics/chromium/VideoFrameChromium.h b/WebCore/platform/graphics/chromium/VideoFrameChromium.h index bbd677e..34e922b 100644 --- a/WebCore/platform/graphics/chromium/VideoFrameChromium.h +++ b/WebCore/platform/graphics/chromium/VideoFrameChromium.h @@ -31,18 +31,20 @@ #ifndef VideoFrameChromium_h #define VideoFrameChromium_h +#include "IntSize.h" + namespace WebCore { // A class that represents a video frame in chromium. class VideoFrameChromium { public: - static const unsigned cMaxPlanes; - static const unsigned cNumRGBPlanes; - static const unsigned cRGBPlane; - static const unsigned cNumYUVPlanes; - static const unsigned cYPlane; - static const unsigned cUPlane; - static const unsigned cVPlane; + static const unsigned maxPlanes; + static const unsigned numRGBPlanes; + static const unsigned rgbPlane; + static const unsigned numYUVPlanes; + static const unsigned yPlane; + static const unsigned uPlane; + static const unsigned vPlane; // These enums must be kept in sync with WebKit::WebVideoFrame. enum Format { @@ -74,6 +76,7 @@ public: virtual unsigned planes() const = 0; virtual int stride(unsigned plane) const = 0; virtual const void* data(unsigned plane) const = 0; + virtual const IntSize requiredTextureSize(unsigned plane) const = 0; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp index 0fb1bb4..26641a9 100644 --- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp @@ -36,15 +36,134 @@ #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" #include "RenderLayerBacking.h" -#include "skia/ext/platform_canvas.h" - -#if PLATFORM(SKIA) -#include "NativeImageSkia.h" -#include "PlatformContextSkia.h" -#endif +#include "VideoFrameChromium.h" +#include "VideoFrameProvider.h" namespace WebCore { +// These values are magic numbers that are used in the transformation +// from YUV to RGB color values. +const float VideoLayerChromium::yuv2RGB[9] = { + 1.f, 1.f, 1.f, + 0.f, -.344f, 1.772f, + 1.403f, -.714f, 0.f, +}; + +VideoLayerChromium::SharedValues::SharedValues(GraphicsContext3D* context) + : m_context(context) + , m_yuvShaderProgram(0) + , m_rgbaShaderProgram(0) + , m_yuvShaderMatrixLocation(0) + , m_yuvWidthScaleFactorLocation(0) + , m_rgbaShaderMatrixLocation(0) + , m_rgbaWidthScaleFactorLocation(0) + , m_ccMatrixLocation(0) + , m_yTextureLocation(0) + , m_uTextureLocation(0) + , m_vTextureLocation(0) + , m_rgbaTextureLocation(0) + , m_yuvAlphaLocation(0) + , m_rgbaAlphaLocation(0) + , m_initialized(false) +{ + // Frame textures are allocated based on stride width, not visible frame + // width, such that there is a guarantee that the frame rows line up + // properly and are not shifted by (stride - width) pixels. To hide the + // "padding" pixels between the edge of the visible frame width and the end + // of the stride, we give the shader a widthScaleFactor (<=1.0) of how much + // of the width of the texture should be shown when drawing the texture onto + // the vertices. + char vertexShaderString[] = + "precision mediump float; \n" + "attribute vec4 a_position; \n" + "attribute vec2 a_texCoord; \n" + "uniform mat4 matrix; \n" + "varying vec2 v_texCoord; \n" + "uniform float widthScaleFactor; \n" + "void main() \n" + "{ \n" + " gl_Position = matrix * a_position; \n" + " v_texCoord = vec2(widthScaleFactor * a_texCoord.x, a_texCoord.y); \n" + "} \n"; + + char yuvFragmentShaderString[] = + "precision mediump float; \n" + "precision mediump int; \n" + "varying vec2 v_texCoord; \n" + "uniform sampler2D y_texture; \n" + "uniform sampler2D u_texture; \n" + "uniform sampler2D v_texture; \n" + "uniform float alpha; \n" + "uniform mat3 cc_matrix; \n" + "void main() \n" + "{ \n" + " float y = texture2D(y_texture, v_texCoord).x; \n" + " float u = texture2D(u_texture, v_texCoord).r - .5; \n" + " float v = texture2D(v_texture, v_texCoord).r - .5; \n" + " vec3 rgb = cc_matrix * vec3(y, u, v); \n" + " gl_FragColor = vec4(rgb.x, rgb.y, rgb.z, 1.0) * alpha; \n" + "} \n"; + + char rgbaFragmentShaderString[] = + "precision mediump float; \n" + "varying vec2 v_texCoord; \n" + "uniform sampler2D rgba_texture; \n" + "uniform float alpha; \n" + "void main() \n" + "{ \n" + " vec4 texColor = texture2D(rgba_texture, vec2(v_texCoord.x, 1.0 - v_texCoord.y)); \n" + " gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n" + "} \n"; + + m_rgbaShaderProgram = createShaderProgram(m_context, vertexShaderString, rgbaFragmentShaderString); + if (!m_rgbaShaderProgram) { + LOG_ERROR("VideoLayerChromium: Failed to create rgba shader program"); + return; + } + + m_yuvShaderProgram = createShaderProgram(m_context, vertexShaderString, yuvFragmentShaderString); + if (!m_yuvShaderProgram) { + LOG_ERROR("VideoLayerChromium: Failed to create yuv shader program"); + return; + } + + m_yuvShaderMatrixLocation = m_context->getUniformLocation(m_yuvShaderProgram, "matrix"); + m_yuvWidthScaleFactorLocation = m_context->getUniformLocation(m_yuvShaderProgram, "widthScaleFactor"); + m_yTextureLocation = m_context->getUniformLocation(m_yuvShaderProgram, "y_texture"); + m_uTextureLocation = m_context->getUniformLocation(m_yuvShaderProgram, "u_texture"); + m_vTextureLocation = m_context->getUniformLocation(m_yuvShaderProgram, "v_texture"); + m_ccMatrixLocation = m_context->getUniformLocation(m_yuvShaderProgram, "cc_matrix"); + m_yuvAlphaLocation = m_context->getUniformLocation(m_yuvShaderProgram, "alpha"); + + ASSERT(m_yuvShaderMatrixLocation != -1); + ASSERT(m_yuvWidthScaleFactorLocation != -1); + ASSERT(m_yTextureLocation != -1); + ASSERT(m_uTextureLocation != -1); + ASSERT(m_vTextureLocation != -1); + ASSERT(m_ccMatrixLocation != -1); + ASSERT(m_yuvAlphaLocation != -1); + + m_rgbaShaderMatrixLocation = m_context->getUniformLocation(m_rgbaShaderProgram, "matrix"); + m_rgbaTextureLocation = m_context->getUniformLocation(m_rgbaShaderProgram, "rgba_texture"); + m_rgbaWidthScaleFactorLocation = m_context->getUniformLocation(m_rgbaShaderProgram, "widthScaleFactor"); + m_rgbaAlphaLocation = m_context->getUniformLocation(m_rgbaShaderProgram, "alpha"); + + ASSERT(m_rgbaShaderMatrixLocation != -1); + ASSERT(m_rgbaTextureLocation != -1); + ASSERT(m_rgbaWidthScaleFactorLocation != -1); + ASSERT(m_rgbaAlphaLocation != -1); + + m_initialized = true; +} + +VideoLayerChromium::SharedValues::~SharedValues() +{ + if (m_yuvShaderProgram) + GLC(m_context, m_context->deleteProgram(m_yuvShaderProgram)); + if (m_rgbaShaderProgram) + GLC(m_context, m_context->deleteProgram(m_rgbaShaderProgram)); +} + PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner, VideoFrameProvider* provider) { @@ -52,14 +171,25 @@ PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* } VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider* provider) - : ContentLayerChromium(owner) -#if PLATFORM(SKIA) - , m_canvas(0) - , m_skiaContext(0) -#endif - , m_graphicsContext(0) + : LayerChromium(owner) + , m_skipsDraw(true) + , m_frameFormat(VideoFrameChromium::Invalid) , m_provider(provider) { + for (unsigned plane = 0; plane < VideoFrameChromium::maxPlanes; plane++) { + m_textures[plane] = 0; + m_textureSizes[plane] = IntSize(); + m_frameSizes[plane] = IntSize(); + } +} + +VideoLayerChromium::~VideoLayerChromium() +{ + GraphicsContext3D* context = layerRendererContext(); + for (unsigned plane = 0; plane < VideoFrameChromium::maxPlanes; plane++) { + if (m_textures[plane]) + GLC(context, context->deleteTexture(m_textures[plane])); + } } void VideoLayerChromium::updateContents() @@ -70,129 +200,176 @@ void VideoLayerChromium::updateContents() ASSERT(drawsContent()); - IntRect dirtyRect(m_dirtyRect); - IntSize requiredTextureSize; - -#if PLATFORM(SKIA) - requiredTextureSize = m_bounds; - IntRect boundsRect(IntPoint(0, 0), m_bounds); - - // If the texture needs to be reallocated, then we must redraw the entire - // contents of the layer. - if (requiredTextureSize != m_allocatedTextureSize) - dirtyRect = boundsRect; - else { - // Clip the dirtyRect to the size of the layer to avoid drawing outside - // the bounds of the backing texture. - dirtyRect.intersect(boundsRect); + m_skipsDraw = false; + VideoFrameChromium* frame = m_provider->getCurrentFrame(); + if (!frame) { + m_skipsDraw = true; + m_provider->putCurrentFrame(frame); + return; } - if (!m_canvas.get() - || dirtyRect.width() != m_canvas->getDevice()->width() - || dirtyRect.height() != m_canvas->getDevice()->height()) { - m_canvas = new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), true); - m_skiaContext = new PlatformContextSkia(m_canvas.get()); - - // This is needed to get text to show up correctly. - // FIXME: Does this take us down a very slow text rendering path? - m_skiaContext->setDrawingToImageBuffer(true); - m_graphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get())); + m_frameFormat = frame->format(); + unsigned textureFormat = determineTextureFormat(frame); + if (textureFormat == GraphicsContext3D::INVALID_VALUE) { + // FIXME: Implement other paths. + notImplemented(); + m_skipsDraw = true; + m_provider->putCurrentFrame(frame); + return; } - // Bring the canvas into the coordinate system of the paint rect. - m_canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y())); - - // FIXME: Remove this test when tiled layers are implemented. - m_skipsDraw = false; - if (!layerRenderer()->checkTextureSize(requiredTextureSize)) { + // Allocate textures for planes if they are not allocated already, or + // reallocate textures that are the wrong size for the frame. + GraphicsContext3D* context = layerRendererContext(); + bool texturesAllocated = allocateTexturesIfNeeded(context, frame, textureFormat); + if (!texturesAllocated) { m_skipsDraw = true; + m_provider->putCurrentFrame(frame); return; } - unsigned textureId = m_contentsTexture; - if (!textureId) - textureId = layerRenderer()->createLayerTexture(); - - // If the texture id or size changed since last time, then we need to tell GL - // to re-allocate a texture. - if (m_contentsTexture != textureId || requiredTextureSize != m_allocatedTextureSize) - createTextureRect(requiredTextureSize, dirtyRect, textureId); - else - updateTextureRect(dirtyRect, textureId); -#else - // FIXME: Implement non-skia path - notImplemented(); -#endif + // Update texture planes. + for (unsigned plane = 0; plane < frame->planes(); plane++) { + ASSERT(frame->requiredTextureSize(plane) == m_textureSizes[plane]); + updateTexture(context, m_textures[plane], frame->requiredTextureSize(plane), textureFormat, frame->data(plane)); + } + + m_dirtyRect.setSize(FloatSize()); + m_contentsDirty = false; + m_provider->putCurrentFrame(frame); } -void VideoLayerChromium::createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId) +unsigned VideoLayerChromium::determineTextureFormat(VideoFrameChromium* frame) { - // Paint into graphics context and get bitmap. - m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect); - void* pixels = 0; - IntSize bitmapSize = IntSize(); -#if PLATFORM(SKIA) - const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); - const SkBitmap* skiaBitmap = &bitmap; - ASSERT(skiaBitmap); - - SkAutoLockPixels lock(*skiaBitmap); - SkBitmap::Config skiaConfig = skiaBitmap->config(); - // FIXME: Do we need to support more image configurations? - if (skiaConfig == SkBitmap::kARGB_8888_Config) { - pixels = skiaBitmap->getPixels(); - bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height()); + switch (frame->format()) { + case VideoFrameChromium::YV12: + return GraphicsContext3D::LUMINANCE; + case VideoFrameChromium::RGBA: + return GraphicsContext3D::RGBA; + default: + break; } -#else - // FIXME: Implement non-skia path - notImplemented(); -#endif - if (!pixels) - return; + return GraphicsContext3D::INVALID_VALUE; +} - GraphicsContext3D* context = layerRendererContext(); - context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId); - ASSERT(bitmapSize == requiredTextureSize); - context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels); +bool VideoLayerChromium::allocateTexturesIfNeeded(GraphicsContext3D* context, VideoFrameChromium* frame, unsigned textureFormat) +{ + ASSERT(context); + ASSERT(frame); + + for (unsigned plane = 0; plane < frame->planes(); plane++) { + IntSize planeTextureSize = frame->requiredTextureSize(plane); - m_contentsTexture = textureId; - m_allocatedTextureSize = requiredTextureSize; + // If the renderer cannot handle this large of a texture, return false. + // FIXME: Remove this test when tiled layers are implemented. + if (!layerRenderer()->checkTextureSize(planeTextureSize)) + return false; - updateCompleted(); + if (!m_textures[plane]) + m_textures[plane] = layerRenderer()->createLayerTexture(); + + if (!planeTextureSize.isZero() && planeTextureSize != m_textureSizes[plane]) { + allocateTexture(context, m_textures[plane], planeTextureSize, textureFormat); + m_textureSizes[plane] = planeTextureSize; + m_frameSizes[plane] = IntSize(frame->width(), frame->height()); + } + } + return true; +} + +void VideoLayerChromium::allocateTexture(GraphicsContext3D* context, unsigned textureId, const IntSize& dimensions, unsigned textureFormat) +{ + GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); + GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, textureFormat, dimensions.width(), dimensions.height(), 0, textureFormat, GraphicsContext3D::UNSIGNED_BYTE, 0)); } -void VideoLayerChromium::updateTextureRect(const IntRect& updateRect, unsigned textureId) +void VideoLayerChromium::updateTexture(GraphicsContext3D* context, unsigned textureId, const IntSize& dimensions, unsigned format, const void* data) { -#if PLATFORM(SKIA) - const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true); - SkBitmap* skiaBitmap = const_cast<SkBitmap*>(&bitmap); - ASSERT(skiaBitmap); - - SkAutoLockPixels lock(*skiaBitmap); - SkBitmap::Config skiaConfig = skiaBitmap->config(); - - if (skiaConfig == SkBitmap::kARGB_8888_Config) { - GraphicsContext3D* context = layerRendererContext(); - context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId); - ASSERT(context->supportsMapSubCHROMIUM()); - void* mem = context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, GraphicsContext3D::WRITE_ONLY); - skiaBitmap->setPixels(mem); - m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect); - context->unmapTexSubImage2DCHROMIUM(mem); + ASSERT(context); + GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); + void* mem = context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, dimensions.width(), dimensions.height(), format, GraphicsContext3D::UNSIGNED_BYTE, GraphicsContext3D::WRITE_ONLY); + if (mem) { + memcpy(mem, data, dimensions.width() * dimensions.height()); + GLC(context, context->unmapTexSubImage2DCHROMIUM(mem)); + } else { + // FIXME: We should have some sort of code to handle the case when + // mapTexSubImage2D fails. + m_skipsDraw = true; } +} + +void VideoLayerChromium::draw() +{ + if (m_skipsDraw) + return; + + ASSERT(layerRenderer()); + const VideoLayerChromium::SharedValues* sv = layerRenderer()->videoLayerSharedValues(); + ASSERT(sv && sv->initialized()); - updateCompleted(); -#else - // FIXME: Implement non-skia path - notImplemented(); -#endif + switch (m_frameFormat) { + case VideoFrameChromium::YV12: + drawYUV(sv); + break; + case VideoFrameChromium::RGBA: + drawRGBA(sv); + break; + default: + // FIXME: Implement other paths. + notImplemented(); + break; + } } -void VideoLayerChromium::updateCompleted() +void VideoLayerChromium::drawYUV(const SharedValues* sv) { - m_dirtyRect.setSize(FloatSize()); - m_contentsDirty = false; + GraphicsContext3D* context = layerRendererContext(); + GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE1)); + GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textures[VideoFrameChromium::yPlane])); + GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE2)); + GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textures[VideoFrameChromium::uPlane])); + GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE3)); + GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textures[VideoFrameChromium::vPlane])); + + layerRenderer()->useShader(sv->yuvShaderProgram()); + unsigned frameWidth = m_frameSizes[VideoFrameChromium::yPlane].width(); + unsigned textureWidth = m_textureSizes[VideoFrameChromium::yPlane].width(); + float widthScaleFactor = static_cast<float>(frameWidth) / textureWidth; + GLC(context, context->uniform1f(sv->yuvWidthScaleFactorLocation(), widthScaleFactor)); + + GLC(context, context->uniform1i(sv->yTextureLocation(), 1)); + GLC(context, context->uniform1i(sv->uTextureLocation(), 2)); + GLC(context, context->uniform1i(sv->vTextureLocation(), 3)); + + GLC(context, context->uniformMatrix3fv(sv->ccMatrixLocation(), 0, const_cast<float*>(yuv2RGB), 1)); + + drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(), + bounds().width(), bounds().height(), drawOpacity(), + sv->yuvShaderMatrixLocation(), sv->yuvAlphaLocation()); + + // Reset active texture back to texture 0. + GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); } +void VideoLayerChromium::drawRGBA(const SharedValues* sv) +{ + GraphicsContext3D* context = layerRendererContext(); + GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textures[VideoFrameChromium::rgbPlane])); + + layerRenderer()->useShader(sv->rgbaShaderProgram()); + unsigned frameWidth = m_frameSizes[VideoFrameChromium::rgbPlane].width(); + unsigned textureWidth = m_textureSizes[VideoFrameChromium::rgbPlane].width(); + float widthScaleFactor = static_cast<float>(frameWidth) / textureWidth; + GLC(context, context->uniform1f(sv->rgbaWidthScaleFactorLocation(), widthScaleFactor)); + + GLC(context, context->uniform1i(sv->rgbaTextureLocation(), 0)); + + drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(), + bounds().width(), bounds().height(), drawOpacity(), + sv->rgbaShaderMatrixLocation(), sv->rgbaAlphaLocation()); } + +} // namespace WebCore + #endif // USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.h b/WebCore/platform/graphics/chromium/VideoLayerChromium.h index 3507cb2..620d1a7 100644 --- a/WebCore/platform/graphics/chromium/VideoLayerChromium.h +++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.h @@ -34,31 +34,76 @@ #if USE(ACCELERATED_COMPOSITING) -#include "ContentLayerChromium.h" +#include "LayerChromium.h" #include "VideoFrameProvider.h" namespace WebCore { // A Layer that contains a Video element. -class VideoLayerChromium : public ContentLayerChromium { +class VideoLayerChromium : public LayerChromium { public: static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner = 0, VideoFrameProvider* = 0); - virtual bool drawsContent() { return true; } + virtual ~VideoLayerChromium(); virtual void updateContents(); + virtual bool drawsContent() { return true; } + virtual void draw(); + + class SharedValues { + public: + explicit SharedValues(GraphicsContext3D*); + ~SharedValues(); + unsigned yuvShaderProgram() const { return m_yuvShaderProgram; } + unsigned rgbaShaderProgram() const { return m_rgbaShaderProgram; } + int yuvShaderMatrixLocation() const { return m_yuvShaderMatrixLocation; } + int rgbaShaderMatrixLocation() const { return m_rgbaShaderMatrixLocation; } + int yuvWidthScaleFactorLocation() const { return m_yuvWidthScaleFactorLocation; } + int rgbaWidthScaleFactorLocation() const { return m_rgbaWidthScaleFactorLocation; } + int yTextureLocation() const { return m_yTextureLocation; } + int uTextureLocation() const { return m_uTextureLocation; } + int vTextureLocation() const { return m_vTextureLocation; } + int yuvAlphaLocation() const { return m_yuvAlphaLocation; } + int rgbaAlphaLocation() const { return m_rgbaAlphaLocation; } + int rgbaTextureLocation() const { return m_rgbaTextureLocation; } + int ccMatrixLocation() const { return m_ccMatrixLocation; } + bool initialized() const { return m_initialized; }; + private: + GraphicsContext3D* m_context; + unsigned m_yuvShaderProgram; + unsigned m_rgbaShaderProgram; + int m_yuvShaderMatrixLocation; + int m_yuvWidthScaleFactorLocation; + int m_rgbaShaderMatrixLocation; + int m_rgbaWidthScaleFactorLocation; + int m_ccMatrixLocation; + int m_yTextureLocation; + int m_uTextureLocation; + int m_vTextureLocation; + int m_rgbaTextureLocation; + int m_yuvAlphaLocation; + int m_rgbaAlphaLocation; + bool m_initialized; + }; private: VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider*); - void createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId); - void updateTextureRect(const IntRect& updateRect, unsigned textureId); - void updateCompleted(); + static unsigned determineTextureFormat(VideoFrameChromium*); + bool allocateTexturesIfNeeded(GraphicsContext3D*, VideoFrameChromium*, unsigned textureFormat); + void updateYUVContents(GraphicsContext3D*, const VideoFrameChromium*); + void updateRGBAContents(GraphicsContext3D*, const VideoFrameChromium*); + void allocateTexture(GraphicsContext3D*, unsigned textureId, const IntSize& dimensions, unsigned textureFormat); + void updateTexture(GraphicsContext3D*, unsigned textureId, const IntSize& dimensions, unsigned textureFormat, const void* data); + void drawYUV(const SharedValues*); + void drawRGBA(const SharedValues*); -#if PLATFORM(SKIA) - OwnPtr<skia::PlatformCanvas> m_canvas; - OwnPtr<PlatformContextSkia> m_skiaContext; -#endif - OwnPtr<GraphicsContext> m_graphicsContext; + static const float yuv2RGB[9]; + + bool m_skipsDraw; + VideoFrameChromium::Format m_frameFormat; OwnPtr<VideoFrameProvider> m_provider; + unsigned m_textures[3]; + IntSize m_textureSizes[3]; + IntSize m_frameSizes[3]; }; } diff --git a/WebCore/svg/graphics/filters/SVGDistantLightSource.h b/WebCore/platform/graphics/filters/DistantLightSource.h index 93c5f2a..d5d474f 100644 --- a/WebCore/svg/graphics/filters/SVGDistantLightSource.h +++ b/WebCore/platform/graphics/filters/DistantLightSource.h @@ -20,11 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGDistantLightSource_h -#define SVGDistantLightSource_h +#ifndef DistantLightSource_h +#define DistantLightSource_h -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGLightSource.h" +#if ENABLE(FILTERS) +#include "LightSource.h" namespace WebCore { @@ -57,6 +57,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGDistantLightSource_h +#endif // DistantLightSource_h diff --git a/WebCore/platform/graphics/filters/FEBlend.cpp b/WebCore/platform/graphics/filters/FEBlend.cpp index acd6545..4185f61 100644 --- a/WebCore/platform/graphics/filters/FEBlend.cpp +++ b/WebCore/platform/graphics/filters/FEBlend.cpp @@ -1,24 +1,24 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - 2009 Dirk Schulze <krit@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #include "config.h" @@ -98,13 +98,13 @@ void FEBlend::apply(Filter* filter) if (m_mode == FEBLEND_MODE_UNKNOWN) return; - if (!getEffectContext()) + if (!effectContext()) return; - IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); - IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates()); + IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates()); RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)->data()); IntRect imageRect(IntPoint(), resultImage()->size()); diff --git a/WebCore/platform/graphics/filters/FEBlend.h b/WebCore/platform/graphics/filters/FEBlend.h index 2e67588..a6569e2 100644 --- a/WebCore/platform/graphics/filters/FEBlend.h +++ b/WebCore/platform/graphics/filters/FEBlend.h @@ -1,23 +1,23 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef FEBlend_h #define FEBlend_h @@ -29,31 +29,32 @@ namespace WebCore { - enum BlendModeType { - FEBLEND_MODE_UNKNOWN = 0, - FEBLEND_MODE_NORMAL = 1, - FEBLEND_MODE_MULTIPLY = 2, - FEBLEND_MODE_SCREEN = 3, - FEBLEND_MODE_DARKEN = 4, - FEBLEND_MODE_LIGHTEN = 5 - }; +enum BlendModeType { + FEBLEND_MODE_UNKNOWN = 0, + FEBLEND_MODE_NORMAL = 1, + FEBLEND_MODE_MULTIPLY = 2, + FEBLEND_MODE_SCREEN = 3, + FEBLEND_MODE_DARKEN = 4, + FEBLEND_MODE_LIGHTEN = 5 +}; - class FEBlend : public FilterEffect { - public: - static PassRefPtr<FEBlend> create(BlendModeType); +class FEBlend : public FilterEffect { +public: + static PassRefPtr<FEBlend> create(BlendModeType); - BlendModeType blendMode() const; - void setBlendMode(BlendModeType); + BlendModeType blendMode() const; + void setBlendMode(BlendModeType); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); - private: - FEBlend(BlendModeType); + virtual TextStream& externalRepresentation(TextStream&, int indention) const; - BlendModeType m_mode; - }; +private: + FEBlend(BlendModeType); + + BlendModeType m_mode; +}; } // namespace WebCore diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/WebCore/platform/graphics/filters/FEColorMatrix.cpp index 1d9c66b..86c37c2 100644 --- a/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -1,24 +1,24 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - 2009 Dirk Schulze <krit@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #include "config.h" @@ -160,11 +160,11 @@ void FEColorMatrix::apply(Filter* filter) if (!in->resultImage()) return; - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); IntRect imageRect(IntPoint(), resultImage()->size()); PassRefPtr<ImageData> imageData(resultImage()->getUnmultipliedImageData(imageRect)); diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.h b/WebCore/platform/graphics/filters/FEColorMatrix.h index 9b9084c..b898b17 100644 --- a/WebCore/platform/graphics/filters/FEColorMatrix.h +++ b/WebCore/platform/graphics/filters/FEColorMatrix.h @@ -1,23 +1,23 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef FEColorMatrix_h #define FEColorMatrix_h @@ -30,34 +30,35 @@ namespace WebCore { - enum ColorMatrixType { - FECOLORMATRIX_TYPE_UNKNOWN = 0, - FECOLORMATRIX_TYPE_MATRIX = 1, - FECOLORMATRIX_TYPE_SATURATE = 2, - FECOLORMATRIX_TYPE_HUEROTATE = 3, - FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4 - }; +enum ColorMatrixType { + FECOLORMATRIX_TYPE_UNKNOWN = 0, + FECOLORMATRIX_TYPE_MATRIX = 1, + FECOLORMATRIX_TYPE_SATURATE = 2, + FECOLORMATRIX_TYPE_HUEROTATE = 3, + FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4 +}; + +class FEColorMatrix : public FilterEffect { +public: + static PassRefPtr<FEColorMatrix> create(ColorMatrixType, const Vector<float>&); - class FEColorMatrix : public FilterEffect { - public: - static PassRefPtr<FEColorMatrix> create(ColorMatrixType, const Vector<float>&); + ColorMatrixType type() const; + void setType(ColorMatrixType); - ColorMatrixType type() const; - void setType(ColorMatrixType); + const Vector<float>& values() const; + void setValues(const Vector<float>&); - const Vector<float>& values() const; - void setValues(const Vector<float>&); + virtual void apply(Filter*); + virtual void dump(); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual TextStream& externalRepresentation(TextStream&, int indention) const; - private: - FEColorMatrix(ColorMatrixType, const Vector<float>&); +private: + FEColorMatrix(ColorMatrixType, const Vector<float>&); - ColorMatrixType m_type; - Vector<float> m_values; - }; + ColorMatrixType m_type; + Vector<float> m_values; +}; } // namespace WebCore diff --git a/WebCore/platform/graphics/filters/FEComponentTransfer.cpp b/WebCore/platform/graphics/filters/FEComponentTransfer.cpp index 471fec8..6fe38e4 100644 --- a/WebCore/platform/graphics/filters/FEComponentTransfer.cpp +++ b/WebCore/platform/graphics/filters/FEComponentTransfer.cpp @@ -1,25 +1,25 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - 2009 Dirk Schulze <krit@webkit.org> - Copyright (C) Research In Motion Limited 2010. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; 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" @@ -36,8 +36,8 @@ namespace WebCore { typedef void (*TransferType)(unsigned char*, const ComponentTransferFunction&); -FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc, - const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc) +FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc, + const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc) : FilterEffect() , m_redFunc(redFunc) , m_greenFunc(greenFunc) @@ -154,7 +154,7 @@ void FEComponentTransfer::apply(Filter* filter) if (!in->resultImage()) return; - if (!getEffectContext()) + if (!effectContext()) return; unsigned char rValues[256], gValues[256], bValues[256], aValues[256]; @@ -167,7 +167,7 @@ void FEComponentTransfer::apply(Filter* filter) for (unsigned channel = 0; channel < 4; channel++) (*callEffect[transferFunction[channel].type])(tables[channel], transferFunction[channel]); - IntRect drawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect drawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<ImageData> imageData(in->resultImage()->getUnmultipliedImageData(drawingRect)); CanvasPixelArray* srcPixelArray(imageData->data()); diff --git a/WebCore/platform/graphics/filters/FEComponentTransfer.h b/WebCore/platform/graphics/filters/FEComponentTransfer.h index 55724db..d3145d4 100644 --- a/WebCore/platform/graphics/filters/FEComponentTransfer.h +++ b/WebCore/platform/graphics/filters/FEComponentTransfer.h @@ -1,23 +1,23 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef FEComponentTransfer_h #define FEComponentTransfer_h @@ -30,67 +30,68 @@ namespace WebCore { - enum ComponentTransferType { - FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0, - FECOMPONENTTRANSFER_TYPE_IDENTITY = 1, - FECOMPONENTTRANSFER_TYPE_TABLE = 2, - FECOMPONENTTRANSFER_TYPE_DISCRETE = 3, - FECOMPONENTTRANSFER_TYPE_LINEAR = 4, - FECOMPONENTTRANSFER_TYPE_GAMMA = 5 - }; - - struct ComponentTransferFunction { - ComponentTransferFunction() - : type(FECOMPONENTTRANSFER_TYPE_UNKNOWN) - , slope(0.0f) - , intercept(0.0f) - , amplitude(0.0f) - , exponent(0.0f) - , offset(0.0f) - { - } - - ComponentTransferType type; - - float slope; - float intercept; - float amplitude; - float exponent; - float offset; - - Vector<float> tableValues; - }; - - class FEComponentTransfer : public FilterEffect { - public: - static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction&, - const ComponentTransferFunction&, const ComponentTransferFunction&, const ComponentTransferFunction&); - - ComponentTransferFunction redFunction() const; - void setRedFunction(const ComponentTransferFunction&); - - ComponentTransferFunction greenFunction() const; - void setGreenFunction(const ComponentTransferFunction&); - - ComponentTransferFunction blueFunction() const; - void setBlueFunction(const ComponentTransferFunction&); - - ComponentTransferFunction alphaFunction() const; - void setAlphaFunction(const ComponentTransferFunction&); - - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; - - private: - FEComponentTransfer(const ComponentTransferFunction&, const ComponentTransferFunction&, - const ComponentTransferFunction&, const ComponentTransferFunction&); - - ComponentTransferFunction m_redFunc; - ComponentTransferFunction m_greenFunc; - ComponentTransferFunction m_blueFunc; - ComponentTransferFunction m_alphaFunc; - }; +enum ComponentTransferType { + FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0, + FECOMPONENTTRANSFER_TYPE_IDENTITY = 1, + FECOMPONENTTRANSFER_TYPE_TABLE = 2, + FECOMPONENTTRANSFER_TYPE_DISCRETE = 3, + FECOMPONENTTRANSFER_TYPE_LINEAR = 4, + FECOMPONENTTRANSFER_TYPE_GAMMA = 5 +}; + +struct ComponentTransferFunction { + ComponentTransferFunction() + : type(FECOMPONENTTRANSFER_TYPE_UNKNOWN) + , slope(0) + , intercept(0) + , amplitude(0) + , exponent(0) + , offset(0) + { + } + + ComponentTransferType type; + + float slope; + float intercept; + float amplitude; + float exponent; + float offset; + + Vector<float> tableValues; +}; + +class FEComponentTransfer : public FilterEffect { +public: + static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc, + const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc); + + ComponentTransferFunction redFunction() const; + void setRedFunction(const ComponentTransferFunction&); + + ComponentTransferFunction greenFunction() const; + void setGreenFunction(const ComponentTransferFunction&); + + ComponentTransferFunction blueFunction() const; + void setBlueFunction(const ComponentTransferFunction&); + + ComponentTransferFunction alphaFunction() const; + void setAlphaFunction(const ComponentTransferFunction&); + + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + +private: + FEComponentTransfer(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc, + const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc); + + ComponentTransferFunction m_redFunc; + ComponentTransferFunction m_greenFunc; + ComponentTransferFunction m_blueFunc; + ComponentTransferFunction m_alphaFunc; +}; } // namespace WebCore diff --git a/WebCore/platform/graphics/filters/FEComposite.cpp b/WebCore/platform/graphics/filters/FEComposite.cpp index c10a0f2..94e2524 100644 --- a/WebCore/platform/graphics/filters/FEComposite.cpp +++ b/WebCore/platform/graphics/filters/FEComposite.cpp @@ -1,24 +1,24 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - 2009 Dirk Schulze <krit@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #include "config.h" @@ -122,39 +122,39 @@ void FEComposite::apply(Filter* filter) if (!in->resultImage() || !in2->resultImage()) return; - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; - FloatRect srcRect = FloatRect(0.f, 0.f, -1.f, -1.f); + FloatRect srcRect = FloatRect(0, 0, -1, -1); switch (m_type) { case FECOMPOSITE_OPERATOR_OVER: - filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates())); - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); break; case FECOMPOSITE_OPERATOR_IN: filterContext->save(); - filterContext->clipToImageBuffer(in2->resultImage(), calculateDrawingRect(in2->repaintRectInLocalCoordinates())); - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates())); + filterContext->clipToImageBuffer(in2->resultImage(), drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); filterContext->restore(); break; case FECOMPOSITE_OPERATOR_OUT: - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates())); - filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()), srcRect, CompositeDestinationOut); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates()), srcRect, CompositeDestinationOut); break; case FECOMPOSITE_OPERATOR_ATOP: - filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates())); - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()), srcRect, CompositeSourceAtop); + filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()), srcRect, CompositeSourceAtop); break; case FECOMPOSITE_OPERATOR_XOR: - filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates())); - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()), srcRect, CompositeXOR); + filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()), srcRect, CompositeXOR); break; case FECOMPOSITE_OPERATOR_ARITHMETIC: { - IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); - IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates()); + IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates()); RefPtr<ImageData> imageData(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)); CanvasPixelArray* srcPixelArrayB(imageData->data()); diff --git a/WebCore/platform/graphics/filters/FEComposite.h b/WebCore/platform/graphics/filters/FEComposite.h index 448d036..82a3b06 100644 --- a/WebCore/platform/graphics/filters/FEComposite.h +++ b/WebCore/platform/graphics/filters/FEComposite.h @@ -1,23 +1,23 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef FEComposite_h #define FEComposite_h @@ -59,9 +59,10 @@ public: float k4() const; void setK4(float); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; private: FEComposite(const CompositeOperationType&, float, float, float, float); diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp b/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp index 2dbc7ab..dd66c6a 100644 --- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp +++ b/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp @@ -23,13 +23,12 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEConvolveMatrix.h" +#if ENABLE(FILTERS) +#include "FEConvolveMatrix.h" #include "CanvasPixelArray.h" #include "Filter.h" #include "ImageData.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { @@ -378,11 +377,11 @@ void FEConvolveMatrix::apply(Filter* filter) if (!in->resultImage()) return; - if (!getEffectContext()) + if (!effectContext()) return; IntRect imageRect(IntPoint(), resultImage()->size()); - IntRect effectDrawingRect = calculateDrawingIntRect(in->filterPrimitiveSubregion()); + IntRect effectDrawingRect = requestedRegionOfInputImageData(in->filterPrimitiveSubregion()); RefPtr<CanvasPixelArray> srcPixelArray; if (m_preserveAlpha) @@ -469,4 +468,4 @@ TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts, int indent) }; // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h b/WebCore/platform/graphics/filters/FEConvolveMatrix.h index 736933c..2fe634f 100644 --- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h +++ b/WebCore/platform/graphics/filters/FEConvolveMatrix.h @@ -20,10 +20,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFEConvolveMatrix_h -#define SVGFEConvolveMatrix_h +#ifndef FEConvolveMatrix_h +#define FEConvolveMatrix_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "FilterEffect.h" #include "FloatPoint.h" #include "FloatSize.h" @@ -72,9 +72,10 @@ public: bool preserveAlpha() const; void setPreserveAlpha(bool); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; private: FEConvolveMatrix(const IntSize&, float, float, @@ -112,6 +113,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFEConvolveMatrix_h +#endif // FEConvolveMatrix_h diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp b/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp index b439c46..98b5adf 100644 --- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp +++ b/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp @@ -21,11 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEDiffuseLighting.h" +#if ENABLE(FILTERS) +#include "FEDiffuseLighting.h" -#include "SVGLightSource.h" -#include "SVGRenderTreeAsText.h" +#include "LightSource.h" namespace WebCore { @@ -124,4 +123,4 @@ TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts, int indent } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h b/WebCore/platform/graphics/filters/FEDiffuseLighting.h index 0cdeae3..5273144 100644 --- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h +++ b/WebCore/platform/graphics/filters/FEDiffuseLighting.h @@ -19,11 +19,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFEDiffuseLighting_h -#define SVGFEDiffuseLighting_h +#ifndef FEDiffuseLighting_h +#define FEDiffuseLighting_h -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFELighting.h" +#if ENABLE(FILTERS) +#include "FELighting.h" namespace WebCore { @@ -53,16 +53,16 @@ public: const LightSource* lightSource() const; void setLightSource(PassRefPtr<LightSource>); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; private: - FEDiffuseLighting(const Color&, float, float, - float, float, PassRefPtr<LightSource>); + FEDiffuseLighting(const Color&, float, float, float, float, PassRefPtr<LightSource>); }; } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFEDiffuseLighting_h +#endif // FEDiffuseLighting_h diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp b/WebCore/platform/graphics/filters/FEDisplacementMap.cpp index 9d9857e..6b5dbaa 100644 --- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp +++ b/WebCore/platform/graphics/filters/FEDisplacementMap.cpp @@ -22,14 +22,13 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEDisplacementMap.h" +#if ENABLE(FILTERS) +#include "FEDisplacementMap.h" #include "CanvasPixelArray.h" #include "Filter.h" #include "GraphicsContext.h" #include "ImageData.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { @@ -89,13 +88,13 @@ void FEDisplacementMap::apply(Filter* filter) if (m_xChannelSelector == CHANNEL_UNKNOWN || m_yChannelSelector == CHANNEL_UNKNOWN) return; - if (!getEffectContext()) + if (!effectContext()) return; - IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); - IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates()); + IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates()); RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data()); IntRect imageRect(IntPoint(), resultImage()->size()); @@ -169,4 +168,4 @@ TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts, int indent } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/platform/graphics/filters/FEDisplacementMap.h b/WebCore/platform/graphics/filters/FEDisplacementMap.h new file mode 100644 index 0000000..dc87b90 --- /dev/null +++ b/WebCore/platform/graphics/filters/FEDisplacementMap.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef FEDisplacementMap_h +#define FEDisplacementMap_h + +#if ENABLE(FILTERS) +#include "PlatformString.h" +#include "FilterEffect.h" +#include "Filter.h" + +namespace WebCore { + +enum ChannelSelectorType { + CHANNEL_UNKNOWN = 0, + CHANNEL_R = 1, + CHANNEL_G = 2, + CHANNEL_B = 3, + CHANNEL_A = 4 +}; + +class FEDisplacementMap : public FilterEffect { +public: + static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float); + + ChannelSelectorType xChannelSelector() const; + void setXChannelSelector(const ChannelSelectorType); + + ChannelSelectorType yChannelSelector() const; + void setYChannelSelector(const ChannelSelectorType); + + float scale() const; + void setScale(float scale); + + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + +private: + FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float); + + ChannelSelectorType m_xChannelSelector; + ChannelSelectorType m_yChannelSelector; + float m_scale; +}; + +} // namespace WebCore + +#endif // ENABLE(FILTERS) + +#endif // FEDisplacementMap_h diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/WebCore/platform/graphics/filters/FEFlood.cpp index a2b2cd2..7804d89 100644 --- a/WebCore/svg/graphics/filters/SVGFEFlood.cpp +++ b/WebCore/platform/graphics/filters/FEFlood.cpp @@ -22,23 +22,22 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEFlood.h" +#if ENABLE(FILTERS) +#include "FEFlood.h" #include "Filter.h" #include "GraphicsContext.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { -FEFlood::FEFlood(const Color& floodColor, const float& floodOpacity) +FEFlood::FEFlood(const Color& floodColor, float floodOpacity) : FilterEffect() , m_floodColor(floodColor) , m_floodOpacity(floodOpacity) { } -PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, const float& floodOpacity) +PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, float floodOpacity) { return adoptRef(new FEFlood(floodColor, floodOpacity)); } @@ -65,7 +64,7 @@ void FEFlood::setFloodOpacity(float floodOpacity) void FEFlood::apply(Filter*) { - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; @@ -82,11 +81,11 @@ TextStream& FEFlood::externalRepresentation(TextStream& ts, int indent) const writeIndent(ts, indent); ts << "[feFlood"; FilterEffect::externalRepresentation(ts); - ts << " flood-color=\"" << floodColor() << "\" " + ts << " flood-color=\"" << floodColor().name() << "\" " << "flood-opacity=\"" << floodOpacity() << "\"]\n"; return ts; } } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.h b/WebCore/platform/graphics/filters/FEFlood.h index 8ae251d..b615531 100644 --- a/WebCore/svg/graphics/filters/SVGFEFlood.h +++ b/WebCore/platform/graphics/filters/FEFlood.h @@ -19,39 +19,40 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFEFlood_h -#define SVGFEFlood_h +#ifndef FEFlood_h +#define FEFlood_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "Color.h" #include "Filter.h" #include "FilterEffect.h" namespace WebCore { - class FEFlood : public FilterEffect { - public: - static PassRefPtr<FEFlood> create(const Color&, const float&); +class FEFlood : public FilterEffect { +public: + static PassRefPtr<FEFlood> create(const Color&, float); - Color floodColor() const; - void setFloodColor(const Color &); + Color floodColor() const; + void setFloodColor(const Color &); - float floodOpacity() const; - void setFloodOpacity(float); + float floodOpacity() const; + void setFloodOpacity(float); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); - private: - FEFlood(const Color&, const float&); + virtual TextStream& externalRepresentation(TextStream&, int indention) const; - Color m_floodColor; - float m_floodOpacity; - }; +private: + FEFlood(const Color&, float); + + Color m_floodColor; + float m_floodOpacity; +}; } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFEFlood_h +#endif // FEFlood_h diff --git a/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/WebCore/platform/graphics/filters/FEGaussianBlur.cpp index 72a5a04..fd9a3d8 100644 --- a/WebCore/platform/graphics/filters/FEGaussianBlur.cpp +++ b/WebCore/platform/graphics/filters/FEGaussianBlur.cpp @@ -1,25 +1,25 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - 2009 Dirk Schulze <krit@webkit.org> - 2010 Igalia, S.L. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2010 Igalia, S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; 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" @@ -132,12 +132,12 @@ void FEGaussianBlur::apply(Filter* filter) if (!in->resultImage()) return; - if (!getEffectContext()) + if (!effectContext()) return; setIsAlphaImage(in->isAlphaImage()); - IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<ImageData> srcImageData(in->resultImage()->getPremultipliedImageData(effectDrawingRect)); IntRect imageRect(IntPoint(), resultImage()->size()); diff --git a/WebCore/platform/graphics/filters/FEGaussianBlur.h b/WebCore/platform/graphics/filters/FEGaussianBlur.h index 63d763e..745bcc8 100644 --- a/WebCore/platform/graphics/filters/FEGaussianBlur.h +++ b/WebCore/platform/graphics/filters/FEGaussianBlur.h @@ -1,23 +1,23 @@ /* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef FEGaussianBlur_h #define FEGaussianBlur_h @@ -38,12 +38,13 @@ public: float stdDeviationY() const; void setStdDeviationY(float); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; - static float calculateStdDeviation(float); + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + private: FEGaussianBlur(float, float); static void kernelPosition(int boxBlur, unsigned& std, int& dLeft, int& dRight); diff --git a/WebCore/svg/graphics/filters/SVGFELighting.cpp b/WebCore/platform/graphics/filters/FELighting.cpp index dc82840..f49b67d 100644 --- a/WebCore/svg/graphics/filters/SVGFELighting.cpp +++ b/WebCore/platform/graphics/filters/FELighting.cpp @@ -26,12 +26,12 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFELighting.h" +#if ENABLE(FILTERS) +#include "FELighting.h" #include "CanvasPixelArray.h" #include "ImageData.h" -#include "SVGLightSource.h" +#include "LightSource.h" namespace WebCore { @@ -247,12 +247,12 @@ void FELighting::apply(Filter* filter) if (!in->resultImage()) return; - if (!getEffectContext()) + if (!effectContext()) return; setIsAlphaImage(false); - IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<ImageData> srcImageData(in->resultImage()->getUnmultipliedImageData(effectDrawingRect)); CanvasPixelArray* srcPixelArray(srcImageData->data()); @@ -267,4 +267,4 @@ void FELighting::apply(Filter* filter) } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFELighting.h b/WebCore/platform/graphics/filters/FELighting.h index 55802ca..28c00c4 100644 --- a/WebCore/svg/graphics/filters/SVGFELighting.h +++ b/WebCore/platform/graphics/filters/FELighting.h @@ -24,14 +24,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SVGFELighting_h -#define SVGFELighting_h +#ifndef FELighting_h +#define FELighting_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "Color.h" #include "Filter.h" #include "FilterEffect.h" -#include "SVGLightSource.h" +#include "LightSource.h" #include <wtf/AlwaysInline.h> // Common base class for FEDiffuseLighting and FESpecularLighting @@ -42,7 +42,7 @@ class CanvasPixelArray; class FELighting : public FilterEffect { public: - void apply(Filter*); + virtual void apply(Filter*); protected: enum LightingType { @@ -91,6 +91,6 @@ protected: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFELighting_h +#endif // FELighting_h diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/platform/graphics/filters/FEMerge.cpp index e92ce4c..19c832a 100644 --- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp +++ b/WebCore/platform/graphics/filters/FEMerge.cpp @@ -21,12 +21,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEMerge.h" +#if ENABLE(FILTERS) +#include "FEMerge.h" #include "Filter.h" #include "GraphicsContext.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { @@ -51,13 +50,13 @@ void FEMerge::apply(Filter* filter) return; } - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; for (unsigned i = 0; i < size; ++i) { FilterEffect* in = inputEffect(i); - filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates())); + filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); } } @@ -80,4 +79,4 @@ TextStream& FEMerge::externalRepresentation(TextStream& ts, int indent) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.h b/WebCore/platform/graphics/filters/FEMerge.h index 439d789..46b882f 100644 --- a/WebCore/svg/graphics/filters/SVGFEMerge.h +++ b/WebCore/platform/graphics/filters/FEMerge.h @@ -19,30 +19,31 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFEMerge_h -#define SVGFEMerge_h +#ifndef FEMerge_h +#define EMerge_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "FilterEffect.h" #include "Filter.h" #include <wtf/Vector.h> namespace WebCore { - class FEMerge : public FilterEffect { - public: - static PassRefPtr<FEMerge> create(); +class FEMerge : public FilterEffect { +public: + static PassRefPtr<FEMerge> create(); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); - private: - FEMerge(); - }; + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + +private: + FEMerge(); +}; } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFEMerge_h +#endif // FEMerge_h diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/WebCore/platform/graphics/filters/FEMorphology.cpp index 6645259..7329e1e 100644 --- a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp +++ b/WebCore/platform/graphics/filters/FEMorphology.cpp @@ -22,13 +22,12 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEMorphology.h" +#if ENABLE(FILTERS) +#include "FEMorphology.h" #include "CanvasPixelArray.h" #include "Filter.h" #include "ImageData.h" -#include "SVGRenderTreeAsText.h" #include <wtf/Vector.h> @@ -87,7 +86,7 @@ void FEMorphology::apply(Filter* filter) if (!in->resultImage()) return; - if (!getEffectContext()) + if (!effectContext()) return; setIsAlphaImage(in->isAlphaImage()); @@ -98,7 +97,7 @@ void FEMorphology::apply(Filter* filter) return; IntRect imageRect(IntPoint(), resultImage()->size()); - IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates()); + IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); RefPtr<CanvasPixelArray> srcPixelArray(in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data()); RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height()); @@ -186,4 +185,4 @@ TextStream& FEMorphology::externalRepresentation(TextStream& ts, int indent) con } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/platform/graphics/filters/FEMorphology.h b/WebCore/platform/graphics/filters/FEMorphology.h new file mode 100644 index 0000000..c8ce058 --- /dev/null +++ b/WebCore/platform/graphics/filters/FEMorphology.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2005 Eric Seidel <eric@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef FEMorphology_h +#define FEMorphology_h + +#if ENABLE(FILTERS) +#include "FilterEffect.h" +#include "Filter.h" + +namespace WebCore { + +enum MorphologyOperatorType { + FEMORPHOLOGY_OPERATOR_UNKNOWN = 0, + FEMORPHOLOGY_OPERATOR_ERODE = 1, + FEMORPHOLOGY_OPERATOR_DILATE = 2 +}; + +class FEMorphology : public FilterEffect { +public: + static PassRefPtr<FEMorphology> create(MorphologyOperatorType, float radiusX, float radiusY); + MorphologyOperatorType morphologyOperator() const; + void setMorphologyOperator(MorphologyOperatorType); + + float radiusX() const; + void setRadiusX(float); + + float radiusY() const; + void setRadiusY(float); + + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + +private: + FEMorphology(MorphologyOperatorType, float radiusX, float radiusY); + + MorphologyOperatorType m_type; + float m_radiusX; + float m_radiusY; +}; + +} // namespace WebCore + +#endif // ENABLE(FILTERS) + +#endif // FEMorphology_h diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/platform/graphics/filters/FEOffset.cpp index 685bd7b..ea84cf0 100644 --- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp +++ b/WebCore/platform/graphics/filters/FEOffset.cpp @@ -22,12 +22,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEOffset.h" +#if ENABLE(FILTERS) +#include "FEOffset.h" #include "Filter.h" #include "GraphicsContext.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { @@ -70,7 +69,7 @@ void FEOffset::apply(Filter* filter) if (!in->resultImage()) return; - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; @@ -110,4 +109,4 @@ TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.h b/WebCore/platform/graphics/filters/FEOffset.h index 34ed97b..052ba74 100644 --- a/WebCore/svg/graphics/filters/SVGFEOffset.h +++ b/WebCore/platform/graphics/filters/FEOffset.h @@ -19,38 +19,39 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFEOffset_h -#define SVGFEOffset_h +#ifndef FEOffset_h +#define FEOffset_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "FilterEffect.h" #include "Filter.h" namespace WebCore { - class FEOffset : public FilterEffect { - public: - static PassRefPtr<FEOffset> create(float, float); +class FEOffset : public FilterEffect { +public: + static PassRefPtr<FEOffset> create(float dx, float dy); - float dx() const; - void setDx(float); + float dx() const; + void setDx(float); - float dy() const; - void setDy(float); + float dy() const; + void setDy(float); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); - private: - FEOffset(float, float); + virtual TextStream& externalRepresentation(TextStream&, int indention) const; - float m_dx; - float m_dy; - }; +private: + FEOffset(float dx, float dy); + + float m_dx; + float m_dy; +}; } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFEOffset_h +#endif // FEOffset_h diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp b/WebCore/platform/graphics/filters/FESpecularLighting.cpp index 33f7b6c..2606600 100644 --- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp +++ b/WebCore/platform/graphics/filters/FESpecularLighting.cpp @@ -21,11 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFESpecularLighting.h" +#if ENABLE(FILTERS) +#include "FESpecularLighting.h" -#include "SVGLightSource.h" -#include "SVGRenderTreeAsText.h" +#include "LightSource.h" namespace WebCore { @@ -136,4 +135,4 @@ TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int inden } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h b/WebCore/platform/graphics/filters/FESpecularLighting.h index 6067a76..f6e7b66 100644 --- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h +++ b/WebCore/platform/graphics/filters/FESpecularLighting.h @@ -19,11 +19,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFESpecularLighting_h -#define SVGFESpecularLighting_h +#ifndef FESpecularLighting_h +#define FESpecularLighting_h -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFELighting.h" +#if ENABLE(FILTERS) +#include "FELighting.h" namespace WebCore { @@ -54,8 +54,9 @@ public: const LightSource* lightSource() const; void setLightSource(PassRefPtr<LightSource>); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; private: FESpecularLighting(const Color&, float, float, float, float, float, PassRefPtr<LightSource>); @@ -63,6 +64,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFESpecularLighting_h +#endif // FESpecularLighting_h diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/platform/graphics/filters/FETile.cpp index 80eb9b3..41abd34 100644 --- a/WebCore/svg/graphics/filters/SVGFETile.cpp +++ b/WebCore/platform/graphics/filters/FETile.cpp @@ -20,14 +20,13 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFETile.h" +#if ENABLE(FILTERS) +#include "FETile.h" #include "AffineTransform.h" #include "Filter.h" #include "GraphicsContext.h" #include "Pattern.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { @@ -56,7 +55,7 @@ void FETile::apply(Filter* filter) if (!in->resultImage()) return; - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; @@ -103,5 +102,5 @@ TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFETile.h b/WebCore/platform/graphics/filters/FETile.h index 128c9cb..20efbcd 100644 --- a/WebCore/svg/graphics/filters/SVGFETile.h +++ b/WebCore/platform/graphics/filters/FETile.h @@ -19,31 +19,32 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFETile_h -#define SVGFETile_h +#ifndef FETile_h +#define FETile_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "FilterEffect.h" #include "Filter.h" namespace WebCore { - class FETile : public FilterEffect { - public: - static PassRefPtr<FETile> create(); +class FETile : public FilterEffect { +public: + static PassRefPtr<FETile> create(); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); - virtual FloatRect determineFilterPrimitiveSubregion(Filter*); - - private: - FETile(); - }; + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + + virtual FloatRect determineFilterPrimitiveSubregion(Filter*); + +private: + FETile(); +}; } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFETile_h +#endif // FETile_h diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/platform/graphics/filters/FETurbulence.cpp index 399f7fc..bb24362 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp +++ b/WebCore/platform/graphics/filters/FETurbulence.cpp @@ -23,13 +23,12 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFETurbulence.h" +#if ENABLE(FILTERS) +#include "FETurbulence.h" #include "CanvasPixelArray.h" #include "Filter.h" #include "ImageData.h" -#include "SVGRenderTreeAsText.h" #include <wtf/MathExtras.h> @@ -322,7 +321,7 @@ unsigned char FETurbulence::calculateTurbulenceValueForPoint(PaintingData& paint void FETurbulence::apply(Filter* filter) { - if (!getEffectContext()) + if (!effectContext()) return; IntRect imageRect(IntPoint(), resultImage()->size()); @@ -384,4 +383,4 @@ TextStream& FETurbulence::externalRepresentation(TextStream& ts, int indent) con } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.h b/WebCore/platform/graphics/filters/FETurbulence.h index d27b7f6..1a5a28a 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.h +++ b/WebCore/platform/graphics/filters/FETurbulence.h @@ -21,10 +21,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFETurbulence_h -#define SVGFETurbulence_h +#ifndef FETurbulence_h +#define FETurbulence_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "FilterEffect.h" #include "Filter.h" @@ -58,9 +58,10 @@ public: bool stitchTiles() const; void setStitchTiles(bool); - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; private: static const int s_blockSize = 256; @@ -97,6 +98,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGFETurbulence_h +#endif // FETurbulence_h diff --git a/WebCore/platform/graphics/filters/Filter.h b/WebCore/platform/graphics/filters/Filter.h index 7ad25aa..bce4be3 100644 --- a/WebCore/platform/graphics/filters/Filter.h +++ b/WebCore/platform/graphics/filters/Filter.h @@ -1,20 +1,20 @@ /* - * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * aint with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. */ #ifndef Filter_h diff --git a/WebCore/platform/graphics/filters/FilterEffect.cpp b/WebCore/platform/graphics/filters/FilterEffect.cpp index b6278b2..461b22a 100644 --- a/WebCore/platform/graphics/filters/FilterEffect.cpp +++ b/WebCore/platform/graphics/filters/FilterEffect.cpp @@ -56,7 +56,7 @@ FloatRect FilterEffect::determineFilterPrimitiveSubregion(Filter* filter) return m_filterPrimitiveSubregion; } -IntRect FilterEffect::calculateDrawingIntRect(const FloatRect& effectRect) const +IntRect FilterEffect::requestedRegionOfInputImageData(const FloatRect& effectRect) const { ASSERT(m_effectBuffer); FloatPoint location = m_repaintRectInLocalCoordinates.location(); @@ -64,7 +64,7 @@ IntRect FilterEffect::calculateDrawingIntRect(const FloatRect& effectRect) const return IntRect(roundedIntPoint(location), m_effectBuffer->size()); } -FloatRect FilterEffect::calculateDrawingRect(const FloatRect& srcRect) const +FloatRect FilterEffect::drawingRegionOfInputImage(const FloatRect& srcRect) const { return FloatRect(FloatPoint(srcRect.x() - m_repaintRectInLocalCoordinates.x(), srcRect.y() - m_repaintRectInLocalCoordinates.y()), srcRect.size()); @@ -76,7 +76,7 @@ FilterEffect* FilterEffect::inputEffect(unsigned number) const return m_inputEffects.at(number).get(); } -GraphicsContext* FilterEffect::getEffectContext() +GraphicsContext* FilterEffect::effectContext() { IntRect bufferRect = enclosingIntRect(m_repaintRectInLocalCoordinates); m_effectBuffer = ImageBuffer::create(bufferRect.size(), LinearRGB); diff --git a/WebCore/platform/graphics/filters/FilterEffect.h b/WebCore/platform/graphics/filters/FilterEffect.h index 91c52f3..ebe1880 100644 --- a/WebCore/platform/graphics/filters/FilterEffect.h +++ b/WebCore/platform/graphics/filters/FilterEffect.h @@ -49,14 +49,14 @@ public: // Creates the ImageBuffer for the current filter primitive result in the size of the // repaintRect. Gives back the GraphicsContext of the own ImageBuffer. - GraphicsContext* getEffectContext(); + GraphicsContext* effectContext(); FilterEffectVector& inputEffects() { return m_inputEffects; } FilterEffect* inputEffect(unsigned) const; unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } - FloatRect calculateDrawingRect(const FloatRect&) const; - IntRect calculateDrawingIntRect(const FloatRect&) const; + FloatRect drawingRegionOfInputImage(const FloatRect&) const; + IntRect requestedRegionOfInputImageData(const FloatRect&) const; // Solid black image with different alpha values. bool isAlphaImage() const { return m_alphaImage; } diff --git a/WebCore/platform/graphics/filters/ImageBufferFilter.cpp b/WebCore/platform/graphics/filters/ImageBufferFilter.cpp index 33953d6..12407f8 100644 --- a/WebCore/platform/graphics/filters/ImageBufferFilter.cpp +++ b/WebCore/platform/graphics/filters/ImageBufferFilter.cpp @@ -1,21 +1,21 @@ /* - * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> - * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * aint with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Library General Public License + * along with this library; 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" diff --git a/WebCore/platform/graphics/filters/ImageBufferFilter.h b/WebCore/platform/graphics/filters/ImageBufferFilter.h index a2775ea..cd4bc2f 100644 --- a/WebCore/platform/graphics/filters/ImageBufferFilter.h +++ b/WebCore/platform/graphics/filters/ImageBufferFilter.h @@ -1,21 +1,21 @@ /* - * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> - * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * aint with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. */ #ifndef ImageBufferFilter_h diff --git a/WebCore/svg/graphics/filters/SVGLightSource.cpp b/WebCore/platform/graphics/filters/LightSource.cpp index 2981f25..a80b14b 100644 --- a/WebCore/svg/graphics/filters/SVGLightSource.cpp +++ b/WebCore/platform/graphics/filters/LightSource.cpp @@ -22,13 +22,13 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGLightSource.h" +#if ENABLE(FILTERS) +#include "LightSource.h" -#include "SVGDistantLightSource.h" -#include "SVGPointLightSource.h" -#include "SVGRenderTreeAsText.h" -#include "SVGSpotLightSource.h" +#include "DistantLightSource.h" +#include "PointLightSource.h" +#include "RenderTreeAsText.h" +#include "SpotLightSource.h" #include <wtf/MathExtras.h> namespace WebCore { @@ -166,4 +166,4 @@ TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGLightSource.h b/WebCore/platform/graphics/filters/LightSource.h index 6795107..2e4c579 100644 --- a/WebCore/svg/graphics/filters/SVGLightSource.h +++ b/WebCore/platform/graphics/filters/LightSource.h @@ -21,10 +21,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGLightSource_h -#define SVGLightSource_h +#ifndef LightSource_h +#define LightSource_h -#if ENABLE(SVG) && ENABLE(FILTERS) +#if ENABLE(FILTERS) #include "FloatPoint3D.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -79,6 +79,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGLightSource_h +#endif // LightSource_h diff --git a/WebCore/svg/graphics/filters/SVGPointLightSource.h b/WebCore/platform/graphics/filters/PointLightSource.h index cd8f9b2..163c829 100644 --- a/WebCore/svg/graphics/filters/SVGPointLightSource.h +++ b/WebCore/platform/graphics/filters/PointLightSource.h @@ -20,11 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGPointLightSource_h -#define SVGPointLightSource_h +#ifndef PointLightSource_h +#define PointLightSource_h -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGLightSource.h" +#if ENABLE(FILTERS) +#include "LightSource.h" namespace WebCore { @@ -54,6 +54,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGPointLightSource_h +#endif // PointLightSource_h diff --git a/WebCore/platform/graphics/filters/SourceAlpha.cpp b/WebCore/platform/graphics/filters/SourceAlpha.cpp index 9c6a953..beaf2e7 100644 --- a/WebCore/platform/graphics/filters/SourceAlpha.cpp +++ b/WebCore/platform/graphics/filters/SourceAlpha.cpp @@ -1,20 +1,20 @@ /* - * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * aint with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Library General Public License + * along with this library; 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" @@ -57,7 +57,7 @@ FloatRect SourceAlpha::determineFilterPrimitiveSubregion(Filter* filter) void SourceAlpha::apply(Filter* filter) { - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; diff --git a/WebCore/platform/graphics/filters/SourceAlpha.h b/WebCore/platform/graphics/filters/SourceAlpha.h index 25a17b2..f0fa319 100644 --- a/WebCore/platform/graphics/filters/SourceAlpha.h +++ b/WebCore/platform/graphics/filters/SourceAlpha.h @@ -1,21 +1,21 @@ /* - Copyright (C) 2009 Dirk Schulze <krit@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef SourceAlpha_h #define SourceAlpha_h @@ -28,22 +28,25 @@ namespace WebCore { - class SourceAlpha : public FilterEffect { - public: - static PassRefPtr<SourceAlpha> create(); +class SourceAlpha : public FilterEffect { +public: + static PassRefPtr<SourceAlpha> create(); + + static const AtomicString& effectName(); + + virtual FloatRect determineFilterPrimitiveSubregion(Filter*); + + virtual void apply(Filter*); + virtual void dump(); + + virtual bool isSourceInput() const { return true; } - static const AtomicString& effectName(); + virtual TextStream& externalRepresentation(TextStream&, int indention) const; - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; +private: + SourceAlpha() { } +}; - virtual bool isSourceInput() const { return true; } - virtual FloatRect determineFilterPrimitiveSubregion(Filter*); - - private: - SourceAlpha() { } - }; } //namespace WebCore #endif // ENABLE(FILTERS) diff --git a/WebCore/platform/graphics/filters/SourceGraphic.cpp b/WebCore/platform/graphics/filters/SourceGraphic.cpp index 6a32e36..c014e68 100644 --- a/WebCore/platform/graphics/filters/SourceGraphic.cpp +++ b/WebCore/platform/graphics/filters/SourceGraphic.cpp @@ -1,20 +1,20 @@ /* - * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * aint with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Library General Public License + * along with this library; 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" @@ -56,7 +56,7 @@ FloatRect SourceGraphic::determineFilterPrimitiveSubregion(Filter* filter) void SourceGraphic::apply(Filter* filter) { - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; diff --git a/WebCore/platform/graphics/filters/SourceGraphic.h b/WebCore/platform/graphics/filters/SourceGraphic.h index 911648c..2378798 100644 --- a/WebCore/platform/graphics/filters/SourceGraphic.h +++ b/WebCore/platform/graphics/filters/SourceGraphic.h @@ -1,22 +1,22 @@ /* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - 2009 Dirk Schulze <krit@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ + * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef SourceGraphic_h #define SourceGrahpic_h @@ -29,22 +29,25 @@ namespace WebCore { - class SourceGraphic : public FilterEffect { - public: - static PassRefPtr<SourceGraphic> create(); +class SourceGraphic : public FilterEffect { +public: + static PassRefPtr<SourceGraphic> create(); + + static const AtomicString& effectName(); + + virtual FloatRect determineFilterPrimitiveSubregion(Filter*); + + virtual void apply(Filter*); + virtual void dump(); - static const AtomicString& effectName(); + virtual bool isSourceInput() const { return true; } - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; + virtual TextStream& externalRepresentation(TextStream&, int indention) const; - virtual bool isSourceInput() const { return true; } - virtual FloatRect determineFilterPrimitiveSubregion(Filter*); +private: + SourceGraphic() { } +}; - private: - SourceGraphic() { } - }; } //namespace WebCore #endif // ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGSpotLightSource.h b/WebCore/platform/graphics/filters/SpotLightSource.h index 31c5674..cd6a614 100644 --- a/WebCore/svg/graphics/filters/SVGSpotLightSource.h +++ b/WebCore/platform/graphics/filters/SpotLightSource.h @@ -20,11 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGSpotLightSource_h -#define SVGSpotLightSource_h +#ifndef SpotLightSource_h +#define SpotLightSource_h -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGLightSource.h" +#if ENABLE(FILTERS) +#include "LightSource.h" namespace WebCore { @@ -67,6 +67,6 @@ private: } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(FILTERS) +#endif // ENABLE(FILTERS) -#endif // SVGSpotLightSource_h +#endif // SpotLightSource_h diff --git a/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp b/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp new file mode 100644 index 0000000..3b73ff6 --- /dev/null +++ b/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp @@ -0,0 +1,275 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 "LoopBlinnLocalTriangulator.h" + +#include "LoopBlinnMathUtils.h" +#include <algorithm> + +namespace WebCore { + +using LoopBlinnMathUtils::approxEqual; +using LoopBlinnMathUtils::linesIntersect; +using LoopBlinnMathUtils::pointInTriangle; + +bool LoopBlinnLocalTriangulator::Triangle::contains(LoopBlinnLocalTriangulator::Vertex* v) +{ + return indexForVertex(v) >= 0; +} + +LoopBlinnLocalTriangulator::Vertex* LoopBlinnLocalTriangulator::Triangle::nextVertex(LoopBlinnLocalTriangulator::Vertex* current, bool traverseCounterClockwise) +{ + int index = indexForVertex(current); + ASSERT(index >= 0); + if (traverseCounterClockwise) + ++index; + else + --index; + if (index < 0) + index += 3; + else + index = index % 3; + return m_vertices[index]; +} + +int LoopBlinnLocalTriangulator::Triangle::indexForVertex(LoopBlinnLocalTriangulator::Vertex* vertex) +{ + for (int i = 0; i < 3; ++i) + if (m_vertices[i] == vertex) + return i; + return -1; +} + +void LoopBlinnLocalTriangulator::Triangle::makeCounterClockwise() +{ + // Possibly swaps two vertices so that the triangle's vertices are + // always specified in counterclockwise order. This orders the + // vertices canonically when walking the interior edges from the + // start to the end vertex. + FloatPoint3D point0(m_vertices[0]->xyCoordinates()); + FloatPoint3D point1(m_vertices[1]->xyCoordinates()); + FloatPoint3D point2(m_vertices[2]->xyCoordinates()); + FloatPoint3D crossProduct = (point1 - point0).cross(point2 - point0); + if (crossProduct.z() < 0) + std::swap(m_vertices[1], m_vertices[2]); +} + +LoopBlinnLocalTriangulator::LoopBlinnLocalTriangulator() +{ + reset(); +} + +void LoopBlinnLocalTriangulator::reset() +{ + m_numberOfTriangles = 0; + m_numberOfInteriorVertices = 0; + for (int i = 0; i < 4; ++i) { + m_interiorVertices[i] = 0; + m_vertices[i].resetFlags(); + } +} + +void LoopBlinnLocalTriangulator::triangulate(InsideEdgeComputation computeInsideEdges, LoopBlinnConstants::FillSide sideToFill) +{ + triangulateHelper(sideToFill); + + if (computeInsideEdges == ComputeInsideEdges) { + // We need to compute which vertices describe the path along the + // interior portion of the shape, to feed these vertices to the + // more general tessellation algorithm. It is possible that we + // could determine this directly while producing triangles above. + // Here we try to do it generally just by examining the triangles + // that have already been produced. We walk around them in a + // specific direction determined by which side of the curve is + // being filled. We ignore the interior vertex unless it is also + // the ending vertex, and skip the edges shared between two + // triangles. + Vertex* v = &m_vertices[0]; + addInteriorVertex(v); + int numSteps = 0; + while (!v->end() && numSteps < 4) { + // Find the next vertex according to the above rules + bool gotNext = false; + for (int i = 0; i < numberOfTriangles() && !gotNext; ++i) { + Triangle* tri = getTriangle(i); + if (tri->contains(v)) { + Vertex* next = tri->nextVertex(v, sideToFill == LoopBlinnConstants::RightSide); + if (!next->marked() && !isSharedEdge(v, next) && (!next->interior() || next->end())) { + addInteriorVertex(next); + v = next; + // Break out of for loop + gotNext = true; + } + } + } + ++numSteps; + } + if (!v->end()) { + // Something went wrong with the above algorithm; add the last + // vertex to the interior vertices anyway. (FIXME: should we + // add an assert here and do more extensive testing?) + addInteriorVertex(&m_vertices[3]); + } + } +} + +void LoopBlinnLocalTriangulator::triangulateHelper(LoopBlinnConstants::FillSide sideToFill) +{ + reset(); + + m_vertices[3].setEnd(true); + + // First test for degenerate cases. + for (int i = 0; i < 4; ++i) { + for (int j = i + 1; j < 4; ++j) { + if (approxEqual(m_vertices[i].xyCoordinates(), m_vertices[j].xyCoordinates())) { + // Two of the vertices are coincident, so we can eliminate at + // least one triangle. We might be able to eliminate the other + // as well, but this seems sufficient to avoid degenerate + // triangulations. + int indices[3] = { 0 }; + int index = 0; + for (int k = 0; k < 4; ++k) + if (k != j) + indices[index++] = k; + addTriangle(&m_vertices[indices[0]], + &m_vertices[indices[1]], + &m_vertices[indices[2]]); + return; + } + } + } + + // See whether any of the points are fully contained in the + // triangle defined by the other three. + for (int i = 0; i < 4; ++i) { + int indices[3] = { 0 }; + int index = 0; + for (int j = 0; j < 4; ++j) + if (i != j) + indices[index++] = j; + if (pointInTriangle(m_vertices[i].xyCoordinates(), + m_vertices[indices[0]].xyCoordinates(), + m_vertices[indices[1]].xyCoordinates(), + m_vertices[indices[2]].xyCoordinates())) { + // Produce three triangles surrounding this interior vertex. + for (int j = 0; j < 3; ++j) + addTriangle(&m_vertices[indices[j % 3]], + &m_vertices[indices[(j + 1) % 3]], + &m_vertices[i]); + // Mark the interior vertex so we ignore it if trying to trace + // the interior edge. + m_vertices[i].setInterior(true); + return; + } + } + + // There are only a few permutations of the vertices, ignoring + // rotations, which are irrelevant: + // + // 0--3 0--2 0--3 0--1 0--2 0--1 + // | | | | | | | | | | | | + // | | | | | | | | | | | | + // 1--2 1--3 2--1 2--3 3--1 3--2 + // + // Note that three of these are reflections of each other. + // Therefore there are only three possible triangulations: + // + // 0--3 0--2 0--3 + // |\ | |\ | |\ | + // | \| | \| | \| + // 1--2 1--3 2--1 + // + // From which we can choose by seeing which of the potential + // diagonals intersect. Note that we choose the shortest diagonal + // to split the quad. + if (linesIntersect(m_vertices[0].xyCoordinates(), + m_vertices[2].xyCoordinates(), + m_vertices[1].xyCoordinates(), + m_vertices[3].xyCoordinates())) { + if ((m_vertices[2].xyCoordinates() - m_vertices[0].xyCoordinates()).diagonalLengthSquared() < + (m_vertices[3].xyCoordinates() - m_vertices[1].xyCoordinates()).diagonalLengthSquared()) { + addTriangle(&m_vertices[0], &m_vertices[1], &m_vertices[2]); + addTriangle(&m_vertices[0], &m_vertices[2], &m_vertices[3]); + } else { + addTriangle(&m_vertices[0], &m_vertices[1], &m_vertices[3]); + addTriangle(&m_vertices[1], &m_vertices[2], &m_vertices[3]); + } + } else if (linesIntersect(m_vertices[0].xyCoordinates(), + m_vertices[3].xyCoordinates(), + m_vertices[1].xyCoordinates(), + m_vertices[2].xyCoordinates())) { + if ((m_vertices[3].xyCoordinates() - m_vertices[0].xyCoordinates()).diagonalLengthSquared() < + (m_vertices[2].xyCoordinates() - m_vertices[1].xyCoordinates()).diagonalLengthSquared()) { + addTriangle(&m_vertices[0], &m_vertices[1], &m_vertices[3]); + addTriangle(&m_vertices[0], &m_vertices[3], &m_vertices[2]); + } else { + addTriangle(&m_vertices[0], &m_vertices[1], &m_vertices[2]); + addTriangle(&m_vertices[2], &m_vertices[1], &m_vertices[3]); + } + } else { + // Lines (0->1), (2->3) intersect -- or should, modulo numerical + // precision issues + if ((m_vertices[1].xyCoordinates() - m_vertices[0].xyCoordinates()).diagonalLengthSquared() < + (m_vertices[3].xyCoordinates() - m_vertices[2].xyCoordinates()).diagonalLengthSquared()) { + addTriangle(&m_vertices[0], &m_vertices[2], &m_vertices[1]); + addTriangle(&m_vertices[0], &m_vertices[1], &m_vertices[3]); + } else { + addTriangle(&m_vertices[0], &m_vertices[2], &m_vertices[3]); + addTriangle(&m_vertices[3], &m_vertices[2], &m_vertices[1]); + } + } +} + +void LoopBlinnLocalTriangulator::addTriangle(Vertex* v0, Vertex* v1, Vertex* v2) +{ + ASSERT(m_numberOfTriangles < 3); + m_triangles[m_numberOfTriangles++].setVertices(v0, v1, v2); +} + +void LoopBlinnLocalTriangulator::addInteriorVertex(Vertex* v) +{ + ASSERT(m_numberOfInteriorVertices < 4); + m_interiorVertices[m_numberOfInteriorVertices++] = v; + v->setMarked(true); +} + +bool LoopBlinnLocalTriangulator::isSharedEdge(Vertex* v0, Vertex* v1) +{ + bool haveEdge01 = false; + bool haveEdge10 = false; + for (int i = 0; i < numberOfTriangles(); ++i) { + Triangle* tri = getTriangle(i); + if (tri->contains(v0) && tri->nextVertex(v0, true) == v1) + haveEdge01 = true; + if (tri->contains(v1) && tri->nextVertex(v1, true) == v0) + haveEdge10 = true; + } + return haveEdge01 && haveEdge10; +} + +} // namespace WebCore diff --git a/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h b/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h new file mode 100644 index 0000000..ea3d7e3 --- /dev/null +++ b/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 LoopBlinnLocalTriangulator_h +#define LoopBlinnLocalTriangulator_h + +#include "FloatPoint.h" +#include "FloatPoint3D.h" +#include "LoopBlinnConstants.h" +#include <wtf/Assertions.h> +#include <wtf/Noncopyable.h> + +namespace WebCore { + +// Performs a localized triangulation of the triangle mesh +// corresponding to the four control point vertices of a cubic curve +// segment. +class LoopBlinnLocalTriangulator : public Noncopyable { +public: + // The vertices that the triangulator operates upon, containing both + // the position information as well as the cubic texture + // coordinates. + class Vertex : public Noncopyable { + public: + Vertex() + { + resetFlags(); + } + + const FloatPoint& xyCoordinates() const + { + return m_xyCoordinates; + } + + const FloatPoint3D& klmCoordinates() const + { + return m_klmCoordinates; + } + + // Sets the position and texture coordinates of the vertex. + void set(float x, float y, + float k, float l, float m) + { + m_xyCoordinates.set(x, y); + m_klmCoordinates.set(k, l, m); + } + + // Flags for walking from the start vertex to the end vertex. + bool end() + { + return m_end; + } + + void setEnd(bool end) + { + m_end = end; + } + + bool marked() + { + return m_marked; + } + + void setMarked(bool marked) + { + m_marked = marked; + } + + bool interior() + { + return m_interior; + } + + void setInterior(bool interior) + { + m_interior = interior; + } + + void resetFlags() + { + m_end = false; + m_marked = false; + m_interior = false; + } + + private: + // 2D coordinates of the vertex in the plane. + FloatPoint m_xyCoordinates; + // Cubic texture coordinates for rendering the curve. + FloatPoint3D m_klmCoordinates; + + // Flags for walking from the start vertex to the end vertex. + bool m_end; + bool m_marked; + bool m_interior; + }; + + // The triangles the Triangulator produces. + class Triangle { + public: + Triangle() + { + m_vertices[0] = 0; + m_vertices[1] = 0; + m_vertices[2] = 0; + } + + // Gets the vertex at the given index, 0 <= index < 3. + Vertex* getVertex(int index) + { + ASSERT(index >= 0 && index < 3); + return m_vertices[index]; + } + + // Returns true if this triangle contains the given vertex (by + // identity, not geometrically). + bool contains(Vertex* v); + + // Returns the vertex following the current one in the specified + // direction, counterclockwise or clockwise. + Vertex* nextVertex(Vertex* current, bool traverseCounterClockwise); + + // Sets the vertices of this triangle, potentially reordering them + // to produce a canonical orientation. + void setVertices(Vertex* v0, + Vertex* v1, + Vertex* v2) + { + m_vertices[0] = v0; + m_vertices[1] = v1; + m_vertices[2] = v2; + makeCounterClockwise(); + } + + private: + // Returns the index [0..2] associated with the given vertex, or + // -1 if not found. + int indexForVertex(Vertex* vertex); + + // Reorders the vertices in this triangle to make them + // counterclockwise when viewed in the 2D plane, in order to + // achieve a canonical ordering. + void makeCounterClockwise(); + + // Note: these are raw pointers because they point to the + // m_vertices contained in the surrounding triangulator. + Vertex* m_vertices[3]; + }; + + LoopBlinnLocalTriangulator(); + + // Resets the triangulator's state. After each triangulation and + // before the next, call this to re-initialize the internal + // vertices' state. + void reset(); + + // Returns a mutable vertex stored in the triangulator. Use this to + // set up the vertices before a triangulation. + Vertex* getVertex(int index) + { + ASSERT(index >= 0 && index < 4); + return &m_vertices[index]; + } + + enum InsideEdgeComputation { + ComputeInsideEdges, + DontComputeInsideEdges + }; + + // Once the vertices' contents have been set up, call triangulate() + // to recompute the triangles. + // + // If computeInsideEdges is ComputeInsideEdges, then sideToFill + // will be used to determine which side of the cubic curve defined + // by the four control points is to be filled. + // + // The triangulation obeys the following guarantees: + // - If the convex hull is a quadrilateral, then the shortest edge + // will be chosen for the cut into two triangles. + // - If one of the vertices is contained in the triangle spanned + // by the other three, three triangles will be produced. + void triangulate(InsideEdgeComputation computeInsideEdges, + LoopBlinnConstants::FillSide sideToFill); + + // Number of triangles computed by triangulate(). + int numberOfTriangles() const + { + return m_numberOfTriangles; + } + + // Returns the computed triangle at index, 0 <= index < numberOfTriangles(). + Triangle* getTriangle(int index) + { + ASSERT(index >= 0 && index < m_numberOfTriangles); + return &m_triangles[index]; + } + + // Number of vertices facing the inside of the shape, if + // ComputeInsideEdges was passed when triangulate() was called. + int numberOfInteriorVertices() const + { + return m_numberOfInteriorVertices; + } + + // Fetches the given interior vertex, 0 <= index < numberOfInteriorVertices(). + Vertex* getInteriorVertex(int index) + { + ASSERT(index >= 0 && index < m_numberOfInteriorVertices); + return m_interiorVertices[index]; + } + +private: + void triangulateHelper(LoopBlinnConstants::FillSide sideToFill); + + // Adds a triangle to the triangulation. + void addTriangle(Vertex* v0, Vertex* v1, Vertex* v2); + + // Adds a vertex to the list of interior vertices. + void addInteriorVertex(Vertex* v); + + // Indicates whether the edge between vertex v0 and v1 is shared + // between two or more triangles. + bool isSharedEdge(Vertex* v0, Vertex* v1); + + // The vertices being triangulated. + Vertex m_vertices[4]; + + // The vertices corresponding to the edges facing the inside of the + // shape, in order from the start vertex to the end vertex. The more + // general triangulation algorithm tessellates this interior region. + Vertex* m_interiorVertices[4]; + // The number of interior vertices that are valid for the current + // triangulation. + int m_numberOfInteriorVertices; + + // There can be at most three triangles computed by this local + // algorithm, which occurs when one of the vertices is contained in + // the triangle spanned by the other three. Most of the time the + // algorithm computes two triangles. + Triangle m_triangles[3]; + int m_numberOfTriangles; +}; + +} // namespace WebCore + +#endif // LoopBlinnLocalTriangulator_h diff --git a/WebCore/platform/graphics/gpu/Texture.cpp b/WebCore/platform/graphics/gpu/Texture.cpp index 95436ba..6023fe9 100644 --- a/WebCore/platform/graphics/gpu/Texture.cpp +++ b/WebCore/platform/graphics/gpu/Texture.cpp @@ -129,7 +129,7 @@ static uint32_t* copySubRect(uint32_t* src, int srcX, int srcY, uint32_t* dst, i for (int y = 0; y < height; ++y) { for (int x = 0; x < width ; ++x) { uint32_t pixel = srcOffset[x + y * srcStride]; - *dstPixel = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); + *dstPixel = (pixel & 0xFF00FF00) | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); dstPixel++; } } diff --git a/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.cpp b/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.cpp index 63555bf..5a94fd4 100644 --- a/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.cpp @@ -18,7 +18,7 @@ #include "config.h" #include "DataSourceGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <gio/gio.h> #include <glib.h> @@ -243,4 +243,4 @@ static void webkit_data_src_uri_handler_init(gpointer g_iface, gpointer iface_da iface->set_uri = webkit_data_src_uri_set_uri; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h b/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h index 453685a..d462ccc4 100644 --- a/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h @@ -19,7 +19,7 @@ #ifndef DataSourceGStreamer_h #define DataSourceGStreamer_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <glib-object.h> #include <gst/base/gstbasesrc.h> @@ -53,5 +53,5 @@ GType webkit_data_src_get_type(void); G_END_DECLS -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp b/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp index 6333437..06eec14 100644 --- a/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "GOwnPtrGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <gst/gstelement.h> namespace WTF { @@ -32,4 +32,4 @@ template <> void freeOwnedGPtr<GstElement>(GstElement* ptr) } } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h b/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h index 84a3e30..672a23d 100644 --- a/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h @@ -19,7 +19,7 @@ #ifndef GOwnPtrGStreamer_h #define GOwnPtrGStreamer_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "GOwnPtr.h" @@ -31,5 +31,5 @@ template<> void freeOwnedGPtr<GstElement>(GstElement* ptr); } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp index efccff0..539d92a 100644 --- a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp +++ b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp @@ -19,7 +19,7 @@ #include "config.h" #include "GStreamerGWorld.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "GOwnPtrGStreamer.h" #include <gst/gst.h> @@ -203,4 +203,4 @@ void GStreamerGWorld::setWindowOverlay(GstMessage* message) } } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h index 282f13c..f519911 100644 --- a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h +++ b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h @@ -20,7 +20,7 @@ #ifndef GStreamerGWorld_h #define GStreamerGWorld_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "PlatformVideoWindow.h" #include "RefCounted.h" @@ -62,5 +62,5 @@ private: }; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamer.h b/WebCore/platform/graphics/gstreamer/ImageGStreamer.h index 4a4ff2b..cf2b9d6 100644 --- a/WebCore/platform/graphics/gstreamer/ImageGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/ImageGStreamer.h @@ -20,7 +20,7 @@ #ifndef ImageGStreamer_h #define ImageGStreamer_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "BitmapImage.h" #include <gst/gst.h> @@ -59,5 +59,5 @@ class ImageGStreamer : public RefCounted<ImageGStreamer> { }; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm b/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm index 076df4a..c73adc0 100644 --- a/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm +++ b/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm @@ -19,7 +19,7 @@ #include "config.h" #include "ImageGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) using namespace WebCore; @@ -57,4 +57,4 @@ ImageGStreamer::~ImageGStreamer() m_image = 0; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp b/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp index 2fed892..6a9d068 100644 --- a/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp +++ b/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "ImageGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "GOwnPtr.h" @@ -65,4 +65,4 @@ ImageGStreamer::~ImageGStreamer() m_image = 0; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index 0071d67..da9255b 100644 --- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -24,7 +24,7 @@ #include "config.h" #include "MediaPlayerPrivateGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "ColorSpace.h" #include "DataSourceGStreamer.h" @@ -1459,4 +1459,4 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin() } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h index 6d1392d..800ca6d 100644 --- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h @@ -22,7 +22,7 @@ #ifndef MediaPlayerPrivateGStreamer_h #define MediaPlayerPrivateGStreamer_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <wtf/Forward.h> #include "MediaPlayerPrivate.h" @@ -179,5 +179,5 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface { }; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h b/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h index 3c4904b..f3df207 100644 --- a/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h +++ b/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h @@ -19,7 +19,7 @@ #ifndef PlatformVideoWindow_h #define PlatformVideoWindow_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "Widget.h" #include <wtf/PassRefPtr.h> @@ -44,5 +44,5 @@ class PlatformVideoWindow : public RefCounted<PlatformVideoWindow> { }; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/PlatformVideoWindowEfl.cpp b/WebCore/platform/graphics/gstreamer/PlatformVideoWindowEfl.cpp index 68ab7ac..c55b9cc 100644 --- a/WebCore/platform/graphics/gstreamer/PlatformVideoWindowEfl.cpp +++ b/WebCore/platform/graphics/gstreamer/PlatformVideoWindowEfl.cpp @@ -19,7 +19,7 @@ #include "config.h" #include "PlatformVideoWindow.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "NotImplemented.h" @@ -35,4 +35,4 @@ PlatformVideoWindow::~PlatformVideoWindow() notImplemented(); } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp b/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp index 88b6552..77343ae 100644 --- a/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp +++ b/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp @@ -19,7 +19,7 @@ #include "config.h" #include "PlatformVideoWindow.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <gtk/gtk.h> @@ -61,4 +61,4 @@ PlatformVideoWindow::~PlatformVideoWindow() m_videoWindowId = 0; } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp b/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp index 00fef4b..4319f6c 100644 --- a/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "VideoSinkGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <glib.h> #include <gst/gst.h> @@ -371,4 +371,4 @@ webkit_video_sink_new(void) return (GstElement*)g_object_new(WEBKIT_TYPE_VIDEO_SINK, 0); } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h b/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h index 767e83f..6cd86c2 100644 --- a/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h @@ -20,7 +20,7 @@ #ifndef VideoSinkGStreamer_h #define VideoSinkGStreamer_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include <glib-object.h> #include <gst/video/gstvideosink.h> @@ -77,5 +77,5 @@ GstElement *webkit_video_sink_new(void); G_END_DECLS -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp index 4e57193..635feff 100644 --- a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp @@ -18,7 +18,7 @@ #include "config.h" #include "WebKitWebSourceGStreamer.h" -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "Document.h" #include "GOwnPtr.h" @@ -795,5 +795,5 @@ void StreamingClient::cannotShowURL(ResourceHandle*) GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, ("Can't show \"%s\"", m_src->priv->uri), (0)); } -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) diff --git a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h index 1594062..bdb0833 100644 --- a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h @@ -18,7 +18,7 @@ #ifndef WebKitWebSourceGStreamer_h #define WebKitWebSourceGStreamer_h -#if ENABLE(VIDEO) +#if USE(GSTREAMER) #include "Frame.h" #include <gst/gst.h> @@ -50,5 +50,5 @@ void webKitWebSrcSetFrame(WebKitWebSrc* src, WebCore::Frame* frame); G_END_DECLS -#endif // ENABLE(VIDEO) +#endif // USE(GSTREAMER) #endif diff --git a/WebCore/platform/graphics/gtk/CairoUtilities.cpp b/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp index 81e00f0..d768ce2 100644 --- a/WebCore/platform/graphics/gtk/CairoUtilities.cpp +++ b/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "CairoUtilities.h" +#include "GdkCairoUtilities.h" #include <cairo.h> #include <gtk/gtk.h> diff --git a/WebCore/platform/graphics/gtk/CairoUtilities.h b/WebCore/platform/graphics/gtk/GdkCairoUtilities.h index 594abc0..ff5b3ed 100644 --- a/WebCore/platform/graphics/gtk/CairoUtilities.h +++ b/WebCore/platform/graphics/gtk/GdkCairoUtilities.h @@ -23,9 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CairoUtilities_h -#define CairoUtilities_h +#ifndef GdkCairoUtilities_h +#define GdkCairoUtilities_h GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface); -#endif // CairoUtilities_h +#endif // GdkCairoUtilities_h diff --git a/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp index 821cc12..edb26f0 100644 --- a/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp +++ b/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp @@ -21,7 +21,7 @@ #include "ImageBuffer.h" #include "Base64.h" -#include "CairoUtilities.h" +#include "GdkCairoUtilities.h" #include "GOwnPtr.h" #include "GRefPtrGtk.h" #include "MIMETypeRegistry.h" diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp index 5272243..623ace6 100644 --- a/WebCore/platform/graphics/gtk/ImageGtk.cpp +++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "BitmapImage.h" -#include "CairoUtilities.h" +#include "GdkCairoUtilities.h" #include "GOwnPtrGtk.h" #include "SharedBuffer.h" #include <wtf/text/CString.h> diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp index da381f2..a2733f8 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -185,25 +185,14 @@ void ComplexTextController::collectComplexTextRuns() // We break up glyph run generation for the string by FontData and (if needed) the use of small caps. const UChar* cp = m_run.characters(); - bool hasTrailingSoftHyphen = m_run[m_end - 1] == softHyphen; - if (m_font.isSmallCaps() || hasTrailingSoftHyphen) + if (m_font.isSmallCaps()) m_smallCapsBuffer.resize(m_end); unsigned indexOfFontTransition = m_run.rtl() ? m_end - 1 : 0; const UChar* curr = m_run.rtl() ? cp + m_end - 1 : cp; const UChar* end = m_run.rtl() ? cp - 1 : cp + m_end; - // FIXME: Using HYPHEN-MINUS rather than HYPHEN because Times has a HYPHEN-MINUS glyph that looks like its - // SOFT-HYPHEN glyph, and has no HYPHEN glyph. - static const UChar hyphen = '-'; - - if (hasTrailingSoftHyphen && m_run.rtl()) { - collectComplexTextRunsForCharacters(&hyphen, 1, m_end - 1, m_font.glyphDataForCharacter(hyphen, false).fontData); - indexOfFontTransition--; - curr--; - } - GlyphData glyphData; GlyphData nextGlyphData; @@ -267,14 +256,11 @@ void ComplexTextController::collectComplexTextRuns() } } - int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : m_end - indexOfFontTransition - (hasTrailingSoftHyphen ? 1 : 0); + int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : m_end - indexOfFontTransition; if (itemLength) { int itemStart = m_run.rtl() ? 0 : indexOfFontTransition; collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, nextGlyphData.glyph ? nextGlyphData.fontData : 0); } - - if (hasTrailingSoftHyphen && m_run.ltr()) - collectComplexTextRunsForCharacters(&hyphen, 1, m_end - 1, m_font.glyphDataForCharacter(hyphen, false).fontData); } #if USE(CORE_TEXT) && USE(ATSUI) @@ -382,9 +368,9 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer) unsigned glyphEndOffset; if (complexTextRun.isMonotonic()) { if (ltr) - glyphEndOffset = max<unsigned>(glyphStartOffset, g + 1 < glyphCount ? complexTextRun.indexAt(g + 1) : complexTextRun.stringLength()); + glyphEndOffset = max<unsigned>(glyphStartOffset, g + 1 < glyphCount ? static_cast<unsigned>(complexTextRun.indexAt(g + 1)) : complexTextRun.stringLength()); else - glyphEndOffset = max<unsigned>(glyphStartOffset, g > 0 ? complexTextRun.indexAt(g - 1) : complexTextRun.stringLength()); + glyphEndOffset = max<unsigned>(glyphStartOffset, g > 0 ? static_cast<unsigned>(complexTextRun.indexAt(g - 1)) : complexTextRun.stringLength()); } else glyphEndOffset = complexTextRun.endOffsetAt(g); diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h index 6ff3ff0..17a67ac 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h @@ -96,11 +96,10 @@ public: virtual void suspendAnimations(double time); virtual void resumeAnimations(); - virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String& keyframesName, double timeOffset); - virtual void removeAnimationsForProperty(AnimatedPropertyID); - virtual void removeAnimationsForKeyframes(const String& keyframesName); - virtual void pauseAnimation(const String& keyframesName, double timeOffset); - + virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String& animationName, double timeOffset); + virtual void pauseAnimation(const String& animationName, double timeOffset); + virtual void removeAnimation(const String& animationName); + virtual void setContentsToImage(Image*); virtual void setContentsToMedia(PlatformLayer*); virtual void setContentsToCanvas(PlatformLayer*); @@ -119,6 +118,9 @@ public: virtual void syncCompositingState(); virtual void syncCompositingStateForThisLayerOnly(); + // Should only be called by animationDidStart: callback + void animationDidStart(CAAnimation*); + protected: virtual void setOpacityInternal(float); @@ -128,17 +130,17 @@ private: CALayer* primaryLayer() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); } CALayer* hostLayerForSublayers() const; CALayer* layerForSuperlayer() const; - CALayer* animatedLayer(AnimatedPropertyID property) const; + CALayer* animatedLayer(AnimatedPropertyID) const; typedef String CloneID; // Identifier for a given clone, based on original/replica branching down the tree. static bool isReplicatedRootClone(const CloneID& cloneID) { return cloneID[0U] & 1; } typedef HashMap<CloneID, RetainPtr<CALayer> > LayerMap; LayerMap* primaryLayerClones() const { return m_structuralLayer.get() ? m_structuralLayerClones.get() : m_layerClones.get(); } - LayerMap* animatedLayerClones(AnimatedPropertyID property) const; + LayerMap* animatedLayerClones(AnimatedPropertyID) const; - bool createAnimationFromKeyframes(const KeyframeValueList&, const Animation*, const String& keyframesName, double timeOffset); - bool createTransformAnimationsFromKeyframes(const KeyframeValueList&, const Animation*, const String& keyframesName, double timeOffset, const IntSize& boxSize); + bool createAnimationFromKeyframes(const KeyframeValueList&, const Animation*, const String& animationName, double timeOffset); + bool createTransformAnimationsFromKeyframes(const KeyframeValueList&, const Animation*, const String& animationName, double timeOffset, const IntSize& boxSize); // Return autoreleased animation (use RetainPtr?) CABasicAnimation* createBasicAnimation(const Animation*, AnimatedPropertyID, bool additive); @@ -153,9 +155,9 @@ private: bool setTransformAnimationEndpoints(const KeyframeValueList&, const Animation*, CABasicAnimation*, int functionIndex, TransformOperation::OperationType, bool isMatrixAnimation, const IntSize& boxSize); bool setTransformAnimationKeyframes(const KeyframeValueList&, const Animation*, CAKeyframeAnimation*, int functionIndex, TransformOperation::OperationType, bool isMatrixAnimation, const IntSize& boxSize); - bool animationIsRunning(const String& keyframesName) const + bool animationIsRunning(const String& animationName) const { - return m_runningKeyframeAnimations.find(keyframesName) != m_runningKeyframeAnimations.end(); + return m_runningAnimations.find(animationName) != m_runningAnimations.end(); } void commitLayerChangesBeforeSublayers(); @@ -271,13 +273,13 @@ private: void ensureStructuralLayer(StructuralLayerPurpose); StructuralLayerPurpose structuralLayerPurpose() const; - void setAnimationOnLayer(CAPropertyAnimation*, AnimatedPropertyID, const String& keyframesName, int index, double timeOffset); - bool removeAnimationFromLayer(AnimatedPropertyID, const String& keyframesName, int index); - void pauseAnimationOnLayer(AnimatedPropertyID, const String& keyframesName, int index, double timeOffset); + void setCAAnimationOnLayer(CAPropertyAnimation*, AnimatedPropertyID, const String& animationName, int index, double timeOffset); + bool removeCAAnimationFromLayer(AnimatedPropertyID, const String& animationName, int index); + void pauseCAAnimationOnLayer(AnimatedPropertyID, const String& animationName, int index, double timeOffset); enum MoveOrCopy { Move, Copy }; - void moveOrCopyAnimationsForProperty(MoveOrCopy, AnimatedPropertyID property, CALayer * fromLayer, CALayer * toLayer); - static void moveOrCopyAllAnimationsForProperty(MoveOrCopy operation, AnimatedPropertyID property, const String& keyframesName, CALayer * fromLayer, CALayer * toLayer); + static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, CALayer *fromLayer, CALayer *toLayer); + void moveOrCopyAnimationsForProperty(MoveOrCopy, AnimatedPropertyID, CALayer * fromLayer, CALayer * toLayer); enum LayerChange { NoChange = 0, @@ -335,29 +337,26 @@ private: RetainPtr<CGImageRef> m_uncorrectedContentsImage; RetainPtr<CGImageRef> m_pendingContentsImage; - struct LayerAnimation { - LayerAnimation(CAPropertyAnimation* caAnim, const String& keyframesName, AnimatedPropertyID property, int index, double timeOffset) - : m_animation(caAnim) - , m_keyframesName(keyframesName) + // This represents the animation of a single property. There may be multiple transform animations for + // a single transition or keyframe animation, so index is used to distinguish these. + struct LayerPropertyAnimation { + LayerPropertyAnimation(CAPropertyAnimation* caAnimation, const String& animationName, AnimatedPropertyID property, int index, double timeOffset) + : m_animation(caAnimation) + , m_name(animationName) , m_property(property) , m_index(index) , m_timeOffset(timeOffset) { } RetainPtr<CAPropertyAnimation*> m_animation; - String m_keyframesName; + String m_name; AnimatedPropertyID m_property; int m_index; double m_timeOffset; }; - Vector<LayerAnimation> m_uncomittedAnimations; - - // Animations on the layer are identified by property + index. - typedef int AnimatedProperty; // std containers choke on the AnimatedPropertyID enum - typedef pair<AnimatedProperty, int> AnimationPair; - - HashSet<AnimatedProperty> m_transitionPropertiesToRemove; + // Uncommitted transitions and animations. + Vector<LayerPropertyAnimation> m_uncomittedAnimations; enum Action { Remove, Pause }; struct AnimationProcessingAction { @@ -367,15 +366,15 @@ private: { } Action action; - double timeOffset; // only used for pause + double timeOffset; // only used for pause }; typedef HashMap<String, AnimationProcessingAction> AnimationsToProcessMap; - AnimationsToProcessMap m_keyframeAnimationsToProcess; + AnimationsToProcessMap m_animationsToProcess; + + // Map of animation names to their associated lists of property animations, so we can remove/pause them. + typedef HashMap<String, Vector<LayerPropertyAnimation> > AnimationsMap; + AnimationsMap m_runningAnimations; - // Map of keyframe names to their associated lists of animations for running animations, so we can remove/pause them. - typedef HashMap<String, Vector<AnimationPair> > KeyframeAnimationsMap; - KeyframeAnimationsMap m_runningKeyframeAnimations; - Vector<FloatRect> m_dirtyRects; LayerChangeFlags m_uncommittedChanges; diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm index 395a691..d4cd851 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm @@ -55,6 +55,8 @@ using namespace std; namespace WebCore { +static NSString * const WebKitAnimationBeginTimeSetKey = @"WebKitAnimationBeginTimeSet"; + // The threshold width or height above which a tiled layer will be used. This should be // large enough to avoid tiled layers for most GraphicsLayers, but less than the OpenGL // texture size limit on all supported hardware. @@ -101,11 +103,8 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) - (void)animationDidStart:(CAAnimation *)animation { - if (!m_graphicsLayer) - return; - - double startTime = WebCore::mediaTimeToCurrentTime([animation beginTime]); - m_graphicsLayer->client()->notifyAnimationStarted(m_graphicsLayer, startTime); + if (m_graphicsLayer) + m_graphicsLayer->animationDidStart(animation); } - (WebCore::GraphicsLayerCA*)graphicsLayer @@ -197,7 +196,7 @@ static NSValue* getTransformFunctionValue(const TransformOperation* transformOp, } #if HAVE_MODERN_QUARTZCORE -static NSString* getValueFunctionNameForTransformOperation(TransformOperation::OperationType transformType) +static NSString *getValueFunctionNameForTransformOperation(TransformOperation::OperationType transformType) { // Use literal strings to avoid link-time dependency on those symbols. switch (transformType) { @@ -247,20 +246,9 @@ static String propertyIdToString(AnimatedPropertyID property) return ""; } -static String animationIdentifier(AnimatedPropertyID property, const String& keyframesName, int index) +static String animationIdentifier(const String& animationName, AnimatedPropertyID property, int index) { - StringBuilder builder; - - builder.append(propertyIdToString(property)); - builder.append("_"); - - if (!keyframesName.isEmpty()) { - builder.append(keyframesName); - builder.append("_"); - } - builder.append("_"); - builder.append(String::number(index)); - return builder.toString(); + return animationName + String::format("_%d_%d", property, index); } static CAMediaTimingFunction* getCAMediaTimingFunction(const TimingFunction* timingFunction) @@ -550,39 +538,40 @@ void GraphicsLayerCA::setChildrenTransform(const TransformationMatrix& t) noteLayerPropertyChanged(ChildrenTransformChanged); } -void GraphicsLayerCA::moveOrCopyAllAnimationsForProperty(MoveOrCopy operation, AnimatedPropertyID property, const String& keyframesName, CALayer *fromLayer, CALayer *toLayer) +void GraphicsLayerCA::moveOrCopyLayerAnimation(MoveOrCopy operation, const String& animationIdentifier, CALayer *fromLayer, CALayer *toLayer) { - for (int index = 0; ; ++index) { - String animName = animationIdentifier(property, keyframesName, index); + NSString *animationID = animationIdentifier; + CAAnimation *anim = [fromLayer animationForKey:animationID]; + if (!anim) + return; - CAAnimation* anim = [fromLayer animationForKey:animName]; - if (!anim) + switch (operation) { + case Move: + [anim retain]; + [fromLayer removeAnimationForKey:animationID]; + [toLayer addAnimation:anim forKey:animationID]; + [anim release]; break; - switch (operation) { - case Move: - [anim retain]; - [fromLayer removeAnimationForKey:animName]; - [toLayer addAnimation:anim forKey:animName]; - [anim release]; - break; - - case Copy: - [toLayer addAnimation:anim forKey:animName]; - break; - } + case Copy: + [toLayer addAnimation:anim forKey:animationID]; + break; } } void GraphicsLayerCA::moveOrCopyAnimationsForProperty(MoveOrCopy operation, AnimatedPropertyID property, CALayer *fromLayer, CALayer *toLayer) { - // Move transitions for this property. - moveOrCopyAllAnimationsForProperty(operation, property, "", fromLayer, toLayer); - // Look for running animations affecting this property. - KeyframeAnimationsMap::const_iterator end = m_runningKeyframeAnimations.end(); - for (KeyframeAnimationsMap::const_iterator it = m_runningKeyframeAnimations.begin(); it != end; ++it) - moveOrCopyAllAnimationsForProperty(operation, property, it->first, fromLayer, toLayer); + AnimationsMap::const_iterator end = m_runningAnimations.end(); + for (AnimationsMap::const_iterator it = m_runningAnimations.begin(); it != end; ++it) { + const Vector<LayerPropertyAnimation>& propertyAnimations = it->second; + size_t numAnimations = propertyAnimations.size(); + for (size_t i = 0; i < numAnimations; ++i) { + const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; + if (currAnimation.m_property == property) + moveOrCopyLayerAnimation(operation, animationIdentifier(currAnimation.m_name, currAnimation.m_property, currAnimation.m_index), fromLayer, toLayer); + } + } } void GraphicsLayerCA::setPreserves3D(bool preserves3D) @@ -704,8 +693,10 @@ void GraphicsLayerCA::setContentsRect(const IntRect& rect) noteLayerPropertyChanged(ContentsRectChanged); } -bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset) +bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& animationName, double timeOffset) { + ASSERT(!animationName.isEmpty()); + if (forceSoftwareAnimation() || !anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2) return false; @@ -723,9 +714,9 @@ bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const Int bool createdAnimations = false; if (valueList.property() == AnimatedPropertyWebkitTransform) - createdAnimations = createTransformAnimationsFromKeyframes(valueList, anim, keyframesName, timeOffset, boxSize); + createdAnimations = createTransformAnimationsFromKeyframes(valueList, anim, animationName, timeOffset, boxSize); else - createdAnimations = createAnimationFromKeyframes(valueList, anim, keyframesName, timeOffset); + createdAnimations = createAnimationFromKeyframes(valueList, anim, animationName, timeOffset); if (createdAnimations) noteLayerPropertyChanged(AnimationChanged); @@ -733,39 +724,46 @@ bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const Int return createdAnimations; } -void GraphicsLayerCA::removeAnimationsForProperty(AnimatedPropertyID property) +void GraphicsLayerCA::pauseAnimation(const String& animationName, double timeOffset) { - if (m_transitionPropertiesToRemove.find(property) != m_transitionPropertiesToRemove.end()) + if (!animationIsRunning(animationName)) return; - m_transitionPropertiesToRemove.add(property); + AnimationsToProcessMap::iterator it = m_animationsToProcess.find(animationName); + if (it != m_animationsToProcess.end()) { + AnimationProcessingAction& processingInfo = it->second; + // If an animation is scheduled to be removed, don't change the remove to a pause. + if (processingInfo.action != Remove) + processingInfo.action = Pause; + } else + m_animationsToProcess.add(animationName, AnimationProcessingAction(Pause, timeOffset)); + noteLayerPropertyChanged(AnimationChanged); } -void GraphicsLayerCA::removeAnimationsForKeyframes(const String& animationName) +void GraphicsLayerCA::removeAnimation(const String& animationName) { if (!animationIsRunning(animationName)) return; - m_keyframeAnimationsToProcess.add(animationName, AnimationProcessingAction(Remove)); + m_animationsToProcess.add(animationName, AnimationProcessingAction(Remove)); noteLayerPropertyChanged(AnimationChanged); } -void GraphicsLayerCA::pauseAnimation(const String& keyframesName, double timeOffset) +void GraphicsLayerCA::animationDidStart(CAAnimation* caAnimation) { - if (!animationIsRunning(keyframesName)) - return; + bool hadNonZeroBeginTime = [[caAnimation valueForKey:WebKitAnimationBeginTimeSetKey] boolValue]; - AnimationsToProcessMap::iterator it = m_keyframeAnimationsToProcess.find(keyframesName); - if (it != m_keyframeAnimationsToProcess.end()) { - AnimationProcessingAction& processingInfo = it->second; - // If an animation is scheduled to be removed, don't change the remove to a pause. - if (processingInfo.action != Remove) - processingInfo.action = Pause; + double startTime; + if (hadNonZeroBeginTime) { + // We don't know what time CA used to commit the animation, so just use the current time + // (even though this will be slightly off). + startTime = WebCore::mediaTimeToCurrentTime(CACurrentMediaTime()); } else - m_keyframeAnimationsToProcess.add(keyframesName, AnimationProcessingAction(Pause, timeOffset)); + startTime = WebCore::mediaTimeToCurrentTime([caAnimation beginTime]); - noteLayerPropertyChanged(AnimationChanged); + if (m_client) + m_client->notifyAnimationStarted(this, startTime); } void GraphicsLayerCA::setContentsToImage(Image* image) @@ -1496,68 +1494,49 @@ CALayer *GraphicsLayerCA::replicatedLayerRoot(ReplicaState& replicaState) void GraphicsLayerCA::updateLayerAnimations() { - if (m_transitionPropertiesToRemove.size()) { - HashSet<int>::const_iterator end = m_transitionPropertiesToRemove.end(); - for (HashSet<AnimatedProperty>::const_iterator it = m_transitionPropertiesToRemove.begin(); it != end; ++it) { - AnimatedPropertyID currProperty = static_cast<AnimatedPropertyID>(*it); - // Remove all animations with this property in the key. - for (int index = 0; ; ++index) { - if (!removeAnimationFromLayer(currProperty, "", index)) - break; - } - } - - m_transitionPropertiesToRemove.clear(); - } - - if (m_keyframeAnimationsToProcess.size()) { - AnimationsToProcessMap::const_iterator end = m_keyframeAnimationsToProcess.end(); - for (AnimationsToProcessMap::const_iterator it = m_keyframeAnimationsToProcess.begin(); it != end; ++it) { - const String& currKeyframeName = it->first; - KeyframeAnimationsMap::iterator animationIt = m_runningKeyframeAnimations.find(currKeyframeName); - if (animationIt == m_runningKeyframeAnimations.end()) + if (m_animationsToProcess.size()) { + AnimationsToProcessMap::const_iterator end = m_animationsToProcess.end(); + for (AnimationsToProcessMap::const_iterator it = m_animationsToProcess.begin(); it != end; ++it) { + const String& currAnimationName = it->first; + AnimationsMap::iterator animationIt = m_runningAnimations.find(currAnimationName); + if (animationIt == m_runningAnimations.end()) continue; const AnimationProcessingAction& processingInfo = it->second; - const Vector<AnimationPair>& animations = animationIt->second; + const Vector<LayerPropertyAnimation>& animations = animationIt->second; for (size_t i = 0; i < animations.size(); ++i) { - const AnimationPair& currPair = animations[i]; + const LayerPropertyAnimation& currAnimation = animations[i]; switch (processingInfo.action) { case Remove: - removeAnimationFromLayer(static_cast<AnimatedPropertyID>(currPair.first), currKeyframeName, currPair.second); + removeCAAnimationFromLayer(currAnimation.m_property, currAnimationName, currAnimation.m_index); break; case Pause: - pauseAnimationOnLayer(static_cast<AnimatedPropertyID>(currPair.first), currKeyframeName, currPair.second, processingInfo.timeOffset); + pauseCAAnimationOnLayer(currAnimation.m_property, currAnimationName, currAnimation.m_index, processingInfo.timeOffset); break; } } if (processingInfo.action == Remove) - m_runningKeyframeAnimations.remove(currKeyframeName); + m_runningAnimations.remove(currAnimationName); } - m_keyframeAnimationsToProcess.clear(); + m_animationsToProcess.clear(); } size_t numAnimations; if ((numAnimations = m_uncomittedAnimations.size())) { for (size_t i = 0; i < numAnimations; ++i) { - const LayerAnimation& pendingAnimation = m_uncomittedAnimations[i]; - setAnimationOnLayer(pendingAnimation.m_animation.get(), pendingAnimation.m_property, pendingAnimation.m_keyframesName, pendingAnimation.m_index, pendingAnimation.m_timeOffset); + const LayerPropertyAnimation& pendingAnimation = m_uncomittedAnimations[i]; + setCAAnimationOnLayer(pendingAnimation.m_animation.get(), pendingAnimation.m_property, pendingAnimation.m_name, pendingAnimation.m_index, pendingAnimation.m_timeOffset); - if (!pendingAnimation.m_keyframesName.isEmpty()) { - // If this is a keyframe anim, we have to remember the association of keyframes name to property/index pairs, - // so we can remove the animations later if needed. - // For transitions, we can just generate animation names with property and index. - KeyframeAnimationsMap::iterator it = m_runningKeyframeAnimations.find(pendingAnimation.m_keyframesName); - if (it == m_runningKeyframeAnimations.end()) { - Vector<AnimationPair> firstPair; - firstPair.append(AnimationPair(pendingAnimation.m_property, pendingAnimation.m_index)); - m_runningKeyframeAnimations.add(pendingAnimation.m_keyframesName, firstPair); - } else { - Vector<AnimationPair>& animPairs = it->second; - animPairs.append(AnimationPair(pendingAnimation.m_property, pendingAnimation.m_index)); - } + AnimationsMap::iterator it = m_runningAnimations.find(pendingAnimation.m_name); + if (it == m_runningAnimations.end()) { + Vector<LayerPropertyAnimation> animations; + animations.append(pendingAnimation); + m_runningAnimations.add(pendingAnimation.m_name, animations); + } else { + Vector<LayerPropertyAnimation>& animations = it->second; + animations.append(pendingAnimation); } } @@ -1565,16 +1544,19 @@ void GraphicsLayerCA::updateLayerAnimations() } } -void GraphicsLayerCA::setAnimationOnLayer(CAPropertyAnimation* caAnim, AnimatedPropertyID property, const String& keyframesName, int index, double timeOffset) +void GraphicsLayerCA::setCAAnimationOnLayer(CAPropertyAnimation* caAnim, AnimatedPropertyID property, const String& animationName, int index, double timeOffset) { PlatformLayer* layer = animatedLayer(property); - [caAnim setTimeOffset:timeOffset]; - - String animationName = animationIdentifier(property, keyframesName, index); - - [layer removeAnimationForKey:animationName]; - [layer addAnimation:caAnim forKey:animationName]; + if (timeOffset) { + [caAnim setBeginTime:CACurrentMediaTime() - timeOffset]; + [caAnim setValue:[NSNumber numberWithBool:YES] forKey:WebKitAnimationBeginTimeSetKey]; + } + + NSString *animationID = animationIdentifier(animationName, property, index); + + [layer removeAnimationForKey:animationID]; + [layer addAnimation:caAnim forKey:animationID]; if (LayerMap* layerCloneMap = animatedLayerClones(property)) { LayerMap::const_iterator end = layerCloneMap->end(); @@ -1583,8 +1565,8 @@ void GraphicsLayerCA::setAnimationOnLayer(CAPropertyAnimation* caAnim, AnimatedP if (m_replicaLayer && isReplicatedRootClone(it->first)) continue; CALayer *currLayer = it->second.get(); - [currLayer removeAnimationForKey:animationName]; - [currLayer addAnimation:caAnim forKey:animationName]; + [currLayer removeAnimationForKey:animationID]; + [currLayer addAnimation:caAnim forKey:animationID]; } } } @@ -1604,16 +1586,16 @@ static void bug7311367Workaround(CALayer* transformLayer, const TransformationMa [transformLayer setTransform:caTransform]; } -bool GraphicsLayerCA::removeAnimationFromLayer(AnimatedPropertyID property, const String& keyframesName, int index) +bool GraphicsLayerCA::removeCAAnimationFromLayer(AnimatedPropertyID property, const String& animationName, int index) { PlatformLayer* layer = animatedLayer(property); - String animationName = animationIdentifier(property, keyframesName, index); + NSString *animationID = animationIdentifier(animationName, property, index); - if (![layer animationForKey:animationName]) + if (![layer animationForKey:animationID]) return false; - [layer removeAnimationForKey:animationName]; + [layer removeAnimationForKey:animationID]; bug7311367Workaround(m_structuralLayer.get(), m_transform); if (LayerMap* layerCloneMap = animatedLayerClones(property)) { @@ -1624,7 +1606,7 @@ bool GraphicsLayerCA::removeAnimationFromLayer(AnimatedPropertyID property, cons continue; CALayer *currLayer = it->second.get(); - [currLayer removeAnimationForKey:animationName]; + [currLayer removeAnimationForKey:animationID]; } } return true; @@ -1644,15 +1626,18 @@ static void copyAnimationProperties(CAPropertyAnimation* from, CAPropertyAnimati #if HAVE_MODERN_QUARTZCORE [to setValueFunction:[from valueFunction]]; #endif + + if (id object = [from valueForKey:WebKitAnimationBeginTimeSetKey]) + [to setValue:object forKey:WebKitAnimationBeginTimeSetKey]; } -void GraphicsLayerCA::pauseAnimationOnLayer(AnimatedPropertyID property, const String& keyframesName, int index, double timeOffset) +void GraphicsLayerCA::pauseCAAnimationOnLayer(AnimatedPropertyID property, const String& animationName, int index, double timeOffset) { PlatformLayer* layer = animatedLayer(property); - String animationName = animationIdentifier(property, keyframesName, index); + NSString *animationID = animationIdentifier(animationName, property, index); - CAAnimation* caAnim = [layer animationForKey:animationName]; + CAAnimation *caAnim = [layer animationForKey:animationID]; if (!caAnim) return; @@ -1679,7 +1664,7 @@ void GraphicsLayerCA::pauseAnimationOnLayer(AnimatedPropertyID property, const S [pausedAnim setSpeed:0]; [pausedAnim setTimeOffset:timeOffset]; - [layer addAnimation:pausedAnim forKey:animationName]; // This will replace the running animation. + [layer addAnimation:pausedAnim forKey:animationID]; // This will replace the running animation. // Pause the animations on the clones too. if (LayerMap* layerCloneMap = animatedLayerClones(property)) { @@ -1689,7 +1674,7 @@ void GraphicsLayerCA::pauseAnimationOnLayer(AnimatedPropertyID property, const S if (m_replicaLayer && isReplicatedRootClone(it->first)) continue; CALayer *currLayer = it->second.get(); - [currLayer addAnimation:pausedAnim forKey:animationName]; + [currLayer addAnimation:pausedAnim forKey:animationID]; } } } @@ -1726,7 +1711,7 @@ void GraphicsLayerCA::updateContentsNeedsDisplay() [m_contentsLayer.get() setNeedsDisplay]; } -bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& keyframesName, double timeOffset) +bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset) { ASSERT(valueList.property() != AnimatedPropertyWebkitTransform); @@ -1752,14 +1737,14 @@ bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valu if (!valuesOK) return false; - m_uncomittedAnimations.append(LayerAnimation(caAnimation, keyframesName, valueList.property(), animationIndex, timeOffset)); + m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation, animationName, valueList.property(), animationIndex, timeOffset)); END_BLOCK_OBJC_EXCEPTIONS; return true; } -bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& keyframesName, double timeOffset, const IntSize& boxSize) +bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset, const IntSize& boxSize) { ASSERT(valueList.property() == AnimatedPropertyWebkitTransform); @@ -1810,7 +1795,7 @@ bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValue if (!validMatrices) break; - m_uncomittedAnimations.append(LayerAnimation(caAnimation, keyframesName, valueList.property(), animationIndex, timeOffset)); + m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation, animationName, valueList.property(), animationIndex, timeOffset)); } END_BLOCK_OBJC_EXCEPTIONS; @@ -1844,7 +1829,7 @@ void GraphicsLayerCA::setupAnimation(CAPropertyAnimation* propertyAnim, const An else if (anim->direction() == Animation::AnimationDirectionAlternate) repeatCount /= 2; - NSString* fillMode = 0; + NSString *fillMode = 0; switch (anim->fillMode()) { case AnimationFillModeNone: fillMode = kCAFillModeForwards; // Use "forwards" rather than "removed" because the style system will remove the animation when it is finished. This avoids a flash. @@ -1983,7 +1968,7 @@ bool GraphicsLayerCA::setTransformAnimationEndpoints(const KeyframeValueList& va [basicAnim setToValue:toValue]; #if HAVE_MODERN_QUARTZCORE - if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(transformOp)) + if (NSString *valueFunctionName = getValueFunctionNameForTransformOperation(transformOp)) [basicAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]]; #endif @@ -2028,7 +2013,7 @@ bool GraphicsLayerCA::setTransformAnimationKeyframes(const KeyframeValueList& va [keyframeAnim setTimingFunctions:timingFunctions.get()]; #if HAVE_MODERN_QUARTZCORE - if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(transformOpType)) + if (NSString *valueFunctionName = getValueFunctionNameForTransformOperation(transformOpType)) [keyframeAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]]; #endif return true; @@ -2045,7 +2030,7 @@ void GraphicsLayerCA::suspendAnimations(double time) LayerMap::const_iterator end = layerCloneMap->end(); for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) { CALayer *currLayer = it->second.get(); - [currLayer setSpeed:0 ]; + [currLayer setSpeed:0]; [currLayer setTimeOffset:t]; } } diff --git a/WebCore/platform/graphics/mac/ImageMac.mm b/WebCore/platform/graphics/mac/ImageMac.mm index 96b93be..6ad3080 100644 --- a/WebCore/platform/graphics/mac/ImageMac.mm +++ b/WebCore/platform/graphics/mac/ImageMac.mm @@ -27,7 +27,6 @@ #import "BitmapImage.h" #import "FloatRect.h" -#import "FoundationExtras.h" #import "GraphicsContext.h" #import "PlatformString.h" #import "SharedBuffer.h" diff --git a/WebCore/platform/graphics/qt/ContextShadowQt.cpp b/WebCore/platform/graphics/qt/ContextShadowQt.cpp new file mode 100644 index 0000000..342e027 --- /dev/null +++ b/WebCore/platform/graphics/qt/ContextShadowQt.cpp @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2010 Sencha, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "ContextShadow.h" + +#include <QPainter> +#include <QTimerEvent> + +namespace WebCore { + +// ContextShadow needs a scratch image as the buffer for the blur filter. +// Instead of creating and destroying the buffer for every operation, +// we create a buffer which will be automatically purged via a timer. + +class ShadowBuffer: public QObject { +public: + ShadowBuffer(QObject* parent = 0); + + QImage* scratchImage(const QSize& size); + + void schedulePurge(); + +protected: + void timerEvent(QTimerEvent* event); + +private: + QImage image; + int timerId; +}; + +ShadowBuffer::ShadowBuffer(QObject* parent) + : QObject(parent) + , timerId(0) +{ +} + +QImage* ShadowBuffer::scratchImage(const QSize& size) +{ + int width = size.width(); + int height = size.height(); + + // We do not need to recreate the buffer if the buffer is reasonably + // larger than the requested size. However, if the requested size is + // much smaller than our buffer, reduce our buffer so that we will not + // keep too many allocated pixels for too long. + if (!image.isNull() && (image.width() > width) && (image.height() > height)) + if (((2 * width) > image.width()) && ((2 * height) > image.height())) { + image.fill(Qt::transparent); + return ℑ + } + + // Round to the nearest 32 pixels so we do not grow the buffer everytime + // there is larger request by 1 pixel. + width = (1 + (width >> 5)) << 5; + height = (1 + (height >> 5)) << 5; + + image = QImage(width, height, QImage::Format_ARGB32_Premultiplied); + image.fill(Qt::transparent); + return ℑ +} + +void ShadowBuffer::schedulePurge() +{ + static const double BufferPurgeDelay = 2; // seconds + killTimer(timerId); + timerId = startTimer(BufferPurgeDelay * 1000); +} + +void ShadowBuffer::timerEvent(QTimerEvent* event) +{ + if (event->timerId() == timerId) { + killTimer(timerId); + image = QImage(); + } + QObject::timerEvent(event); +} + +Q_GLOBAL_STATIC(ShadowBuffer, scratchShadowBuffer) + +PlatformContext ContextShadow::beginShadowLayer(PlatformContext p, const FloatRect& layerArea) +{ + QRect clipRect; + if (p->hasClipping()) +#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) + clipRect = p->clipBoundingRect().toAlignedRect(); +#else + clipRect = p->clipRegion().boundingRect(); +#endif + else + clipRect = p->transform().inverted().mapRect(p->window()); + + calculateLayerBoundingRect(layerArea, IntRect(clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height())); + + // Don't paint if we are totally outside the clip region. + if (m_layerRect.isEmpty()) + return 0; + + ShadowBuffer* shadowBuffer = scratchShadowBuffer(); + QImage* shadowImage = shadowBuffer->scratchImage(m_layerRect.size()); + m_layerImage = QImage(*shadowImage); + + m_layerContext = new QPainter; + m_layerContext->begin(&m_layerImage); + m_layerContext->setFont(p->font()); + m_layerContext->translate(m_offset.width(), m_offset.height()); + + // The origin is now the top left corner of the scratch image. + m_layerContext->translate(-m_layerRect.x(), -m_layerRect.y()); + + return m_layerContext; +} + +void ContextShadow::endShadowLayer(PlatformContext p) +{ + m_layerContext->end(); + delete m_layerContext; + m_layerContext = 0; + + if (m_type == BlurShadow) { + blurLayerImage(m_layerImage.bits(), IntSize(m_layerImage.width(), m_layerImage.height()), + m_layerImage.bytesPerLine()); + + // "Colorize" with the right shadow color. + QPainter p(&m_layerImage); + p.setCompositionMode(QPainter::CompositionMode_SourceIn); + p.fillRect(m_layerImage.rect(), m_color.rgb()); + p.end(); + } + + p->drawImage(m_layerRect.topLeft(), m_layerImage); + scratchShadowBuffer()->schedulePurge(); +} + +} diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp index 2b246de..e7566eb 100644 --- a/WebCore/platform/graphics/qt/FontQt.cpp +++ b/WebCore/platform/graphics/qt/FontQt.cpp @@ -125,37 +125,38 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float ContextShadow* ctxShadow = ctx->contextShadow(); - if (ctxShadow->type != ContextShadow::NoShadow) { + if (ctxShadow->m_type != ContextShadow::NoShadow) { qreal dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; - if (ctxShadow->offset.x() > 0) - dx2 = ctxShadow->offset.x(); + if (ctxShadow->offset().x() > 0) + dx2 = ctxShadow->offset().x(); else - dx1 = -ctxShadow->offset.x(); - if (ctxShadow->offset.y() > 0) - dy2 = ctxShadow->offset.y(); + dx1 = -ctxShadow->offset().x(); + if (ctxShadow->offset().y() > 0) + dy2 = ctxShadow->offset().y(); else - dy1 = -ctxShadow->offset.y(); + dy1 = -ctxShadow->offset().y(); // expand the clip rect to include the text shadow as well clip.adjust(dx1, dx2, dy1, dy2); - clip.adjust(-ctxShadow->blurRadius, -ctxShadow->blurRadius, ctxShadow->blurRadius, ctxShadow->blurRadius); + clip.adjust(-ctxShadow->m_blurRadius, -ctxShadow->m_blurRadius, ctxShadow->m_blurRadius, ctxShadow->m_blurRadius); } p->save(); p->setClipRect(clip.toRect(), Qt::IntersectClip); pt.setY(pt.y() - ascent); - if (ctxShadow->type != ContextShadow::NoShadow) { + if (ctxShadow->m_type != ContextShadow::NoShadow) { ContextShadow* ctxShadow = ctx->contextShadow(); - if (ctxShadow->type != ContextShadow::BlurShadow) { + if (ctxShadow->m_type != ContextShadow::BlurShadow) { p->save(); - p->setPen(ctxShadow->color); - p->translate(ctxShadow->offset); + p->setPen(ctxShadow->m_color); + p->translate(ctxShadow->offset()); line.draw(p, pt); p->restore(); } else { QPainter* shadowPainter = ctxShadow->beginShadowLayer(p, boundingRect); if (shadowPainter) { // Since it will be blurred anyway, we don't care about render hints. - shadowPainter->setPen(ctxShadow->color); + shadowPainter->setFont(p->font()); + shadowPainter->setPen(ctxShadow->m_color); line.draw(shadowPainter, pt); ctxShadow->endShadowLayer(p); } @@ -181,12 +182,12 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float if (!isComplexText && !(ctx->textDrawingMode() & cTextStroke)) flags |= Qt::TextBypassShaping; #endif - if (ctx->contextShadow()->type != ContextShadow::NoShadow) { + if (ctx->contextShadow()->m_type != ContextShadow::NoShadow) { ContextShadow* ctxShadow = ctx->contextShadow(); - if (ctxShadow->type != ContextShadow::BlurShadow) { + if (ctxShadow->m_type != ContextShadow::BlurShadow) { p->save(); - p->setPen(ctxShadow->color); - p->translate(ctxShadow->offset); + p->setPen(ctxShadow->m_color); + p->translate(ctxShadow->offset()); p->drawText(pt, string, flags, run.padding()); p->restore(); } else { @@ -196,7 +197,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float if (shadowPainter) { // Since it will be blurred anyway, we don't care about render hints. shadowPainter->setFont(p->font()); - shadowPainter->setPen(ctxShadow->color); + shadowPainter->setPen(ctxShadow->m_color); shadowPainter->drawText(pt, string, flags, run.padding()); ctxShadow->endShadowLayer(p); } @@ -205,12 +206,13 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float if (ctx->textDrawingMode() & cTextStroke) { QPainterPath path; path.addText(pt, font, string); - p->setPen(textStrokePen); - p->strokePath(path, p->pen()); + p->strokePath(path, textStrokePen); } if (ctx->textDrawingMode() & cTextFill) { + QPen previousPen = p->pen(); p->setPen(textFillPen); p->drawText(pt, string, flags, run.padding()); + p->setPen(previousPen); } } diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 5a29ad4..7e4af40 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -201,7 +201,7 @@ public: bool hasShadow() const { - return shadow.type != ContextShadow::NoShadow; + return shadow.m_type != ContextShadow::NoShadow; } QRectF clipBoundingRect() const @@ -440,9 +440,9 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (m_data->hasShadow()) { p->save(); - p->translate(m_data->shadow.offset); + p->translate(m_data->shadow.offset()); QPen pen(p->pen()); - pen.setColor(m_data->shadow.color); + pen.setColor(m_data->shadow.m_color); p->setPen(pen); p->drawArc(rect, startAngle, angleSpan); p->restore(); @@ -470,12 +470,12 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points p->setRenderHint(QPainter::Antialiasing, shouldAntialias); if (m_data->hasShadow()) { p->save(); - p->translate(m_data->shadow.offset); + p->translate(m_data->shadow.offset()); if (p->brush().style() != Qt::NoBrush) - p->setBrush(QBrush(m_data->shadow.color)); + p->setBrush(QBrush(m_data->shadow.m_color)); QPen pen(p->pen()); if (pen.style() != Qt::NoPen) { - pen.setColor(m_data->shadow.color); + pen.setColor(m_data->shadow.m_color); p->setPen(pen); } p->drawConvexPolygon(polygon); @@ -519,9 +519,9 @@ void GraphicsContext::fillPath() path.setFillRule(toQtFillRule(fillRule())); if (m_data->hasShadow()) { - p->translate(m_data->shadow.offset); - p->fillPath(path, m_data->shadow.color); - p->translate(-m_data->shadow.offset); + p->translate(m_data->shadow.offset()); + p->fillPath(path, QColor(m_data->shadow.m_color)); + p->translate(-m_data->shadow.offset()); } if (m_common->state.fillPattern) { AffineTransform affine; @@ -547,11 +547,11 @@ void GraphicsContext::strokePath() path.setFillRule(toQtFillRule(fillRule())); if (m_data->hasShadow()) { - p->translate(m_data->shadow.offset); + p->translate(m_data->shadow.offset()); QPen shadowPen(pen); - shadowPen.setColor(m_data->shadow.color); + shadowPen.setColor(m_data->shadow.m_color); p->strokePath(path, shadowPen); - p->translate(-m_data->shadow.offset); + p->translate(-m_data->shadow.offset()); } if (m_common->state.strokePattern) { AffineTransform affine; @@ -653,7 +653,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (shadowPainter) { drawRepeatPattern(shadowPainter, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY()); shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn); - shadowPainter->fillRect(normalizedRect, shadow->color); + shadowPainter->fillRect(normalizedRect, shadow->m_color); shadow->endShadowLayer(p); } drawRepeatPattern(p, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY()); @@ -664,13 +664,13 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (shadowPainter) { shadowPainter->fillRect(normalizedRect, brush); shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn); - shadowPainter->fillRect(normalizedRect, shadow->color); + shadowPainter->fillRect(normalizedRect, shadow->m_color); shadow->endShadowLayer(p); } p->fillRect(normalizedRect, brush); } else { if (m_data->hasShadow()) { - if (shadow->type == ContextShadow::BlurShadow) { + if (shadow->m_type == ContextShadow::BlurShadow) { QPainter* shadowPainter = shadow->beginShadowLayer(p, normalizedRect); if (shadowPainter) { shadowPainter->fillRect(normalizedRect, p->brush()); @@ -679,9 +679,9 @@ void GraphicsContext::fillRect(const FloatRect& rect) } else { // Solid rectangle fill with no blur shadow can be done faster // without using the shadow layer at all. - QColor shadowColor = shadow->color; + QColor shadowColor = shadow->m_color; shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF()); - p->fillRect(normalizedRect.translated(shadow->offset), shadowColor); + p->fillRect(normalizedRect.translated(shadow->offset()), shadowColor); } } p->fillRect(normalizedRect, p->brush()); @@ -701,14 +701,14 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS if (m_data->hasShadow()) { ContextShadow* shadow = contextShadow(); - if (shadow->type != ContextShadow::BlurShadow) { + if (shadow->m_type != ContextShadow::BlurShadow) { // We do not need any layer for simple shadow. - p->fillRect(normalizedRect.translated(shadow->offset), shadow->color); + p->fillRect(normalizedRect.translated(shadow->offset()), shadow->m_color); } else { QPainter* shadowPainter = shadow->beginShadowLayer(p, normalizedRect); if (shadowPainter) { shadowPainter->setCompositionMode(QPainter::CompositionMode_Source); - shadowPainter->fillRect(normalizedRect, shadow->color); + shadowPainter->fillRect(normalizedRect, shadow->m_color); shadow->endShadowLayer(p); } } @@ -725,9 +725,9 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef Path path = Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight); QPainter* p = m_data->p(); if (m_data->hasShadow()) { - p->translate(m_data->shadow.offset); - p->fillPath(path.platformPath(), m_data->shadow.color); - p->translate(-m_data->shadow.offset); + p->translate(m_data->shadow.offset()); + p->fillPath(path.platformPath(), QColor(m_data->shadow.m_color)); + p->translate(-m_data->shadow.offset()); } p->fillPath(path.platformPath(), QColor(color)); } @@ -884,9 +884,9 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const // Meaning that this graphics context is associated with a CanvasRenderingContext // We flip the height since CG and HTML5 Canvas have opposite Y axis m_common->state.shadowOffset = FloatSize(size.width(), -size.height()); - m_data->shadow = ContextShadow(color, blur, size.width(), -size.height()); + m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height())); } else { - m_data->shadow = ContextShadow(color, blur, size.width(), size.height()); + m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), size.height())); } } @@ -1002,7 +1002,7 @@ void GraphicsContext::setLineDash(const DashArray& dashes, float dashOffset) pattern.append(dashes[i % dashLength] / penWidth); pen.setDashPattern(pattern); - pen.setDashOffset(dashOffset); + pen.setDashOffset(dashOffset / penWidth); } else pen.setStyle(Qt::SolidLine); p->setPen(pen); diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp index 08eb816..b881036 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp @@ -51,7 +51,7 @@ using namespace Phonon; #define LOG_MEDIAOBJECT() (LOG(Media, "%s", debugMediaObject(this, *m_mediaObject).constData())) #if !LOG_DISABLED -static QByteArray debugMediaObject(WebCore::MediaPlayerPrivate* mediaPlayer, const MediaObject& mediaObject) +static QByteArray debugMediaObject(WebCore::MediaPlayerPrivatePhonon* mediaPlayer, const MediaObject& mediaObject) { QByteArray byteArray; QTextStream stream(&byteArray); @@ -84,7 +84,7 @@ using namespace WTF; namespace WebCore { -MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) +MediaPlayerPrivatePhonon::MediaPlayerPrivatePhonon(MediaPlayer* player) : m_player(player) , m_networkState(MediaPlayer::Empty) , m_readyState(MediaPlayer::HaveNothing) @@ -118,19 +118,19 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) connect(m_mediaObject, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); } -MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player) +MediaPlayerPrivateInterface* MediaPlayerPrivatePhonon::create(MediaPlayer* player) { - return new MediaPlayerPrivate(player); + return new MediaPlayerPrivatePhonon(player); } -void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar) +void MediaPlayerPrivatePhonon::registerMediaEngine(MediaEngineRegistrar registrar) { if (isAvailable()) registrar(create, getSupportedTypes, supportsType); } -MediaPlayerPrivate::~MediaPlayerPrivate() +MediaPlayerPrivatePhonon::~MediaPlayerPrivatePhonon() { LOG(Media, "MediaPlayerPrivatePhonon::dtor deleting videowidget"); m_videoWidget->close(); @@ -146,7 +146,7 @@ MediaPlayerPrivate::~MediaPlayerPrivate() m_mediaObject = 0; } -HashSet<String>& MediaPlayerPrivate::supportedTypesCache() +HashSet<String>& MediaPlayerPrivatePhonon::supportedTypesCache() { static HashSet<String> supportedTypes; if (!supportedTypes.isEmpty()) @@ -190,12 +190,12 @@ HashSet<String>& MediaPlayerPrivate::supportedTypesCache() return supportedTypes; } -void MediaPlayerPrivate::getSupportedTypes(HashSet<String>& types) +void MediaPlayerPrivatePhonon::getSupportedTypes(HashSet<String>& types) { types = supportedTypesCache(); } -MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs) +MediaPlayer::SupportsType MediaPlayerPrivatePhonon::supportsType(const String& type, const String& codecs) { if (type.isEmpty()) return MediaPlayer::IsNotSupported; @@ -205,14 +205,14 @@ MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, c return MediaPlayer::IsNotSupported; } -bool MediaPlayerPrivate::hasVideo() const +bool MediaPlayerPrivatePhonon::hasVideo() const { bool hasVideo = m_mediaObject->hasVideo(); LOG(Media, "MediaPlayerPrivatePhonon::hasVideo() -> %s", hasVideo ? "true" : "false"); return hasVideo; } -bool MediaPlayerPrivate::hasAudio() const +bool MediaPlayerPrivatePhonon::hasAudio() const { // FIXME: Phonon::MediaObject does not have such a hasAudio() function bool hasAudio = true; @@ -220,7 +220,7 @@ bool MediaPlayerPrivate::hasAudio() const return hasAudio; } -void MediaPlayerPrivate::load(const String& url) +void MediaPlayerPrivatePhonon::load(const String& url) { LOG(Media, "MediaPlayerPrivatePhonon::load(\"%s\")", url.utf8().data()); @@ -241,33 +241,33 @@ void MediaPlayerPrivate::load(const String& url) setVisible(m_player->visible()); } -void MediaPlayerPrivate::cancelLoad() +void MediaPlayerPrivatePhonon::cancelLoad() { notImplemented(); } -void MediaPlayerPrivate::play() +void MediaPlayerPrivatePhonon::play() { LOG(Media, "MediaPlayerPrivatePhonon::play()"); m_mediaObject->play(); } -void MediaPlayerPrivate::pause() +void MediaPlayerPrivatePhonon::pause() { LOG(Media, "MediaPlayerPrivatePhonon::pause()"); m_mediaObject->pause(); } -bool MediaPlayerPrivate::paused() const +bool MediaPlayerPrivatePhonon::paused() const { bool paused = m_mediaObject->state() == Phonon::PausedState; LOG(Media, "MediaPlayerPrivatePhonon::paused() --> %s", paused ? "true" : "false"); return paused; } -void MediaPlayerPrivate::seek(float position) +void MediaPlayerPrivatePhonon::seek(float position) { LOG(Media, "MediaPlayerPrivatePhonon::seek(%f)", position); @@ -280,12 +280,12 @@ void MediaPlayerPrivate::seek(float position) m_mediaObject->seek(position * 1000.0f); } -bool MediaPlayerPrivate::seeking() const +bool MediaPlayerPrivatePhonon::seeking() const { return false; } -float MediaPlayerPrivate::duration() const +float MediaPlayerPrivatePhonon::duration() const { if (m_readyState < MediaPlayer::HaveMetadata) return 0.0f; @@ -299,7 +299,7 @@ float MediaPlayerPrivate::duration() const return duration; } -float MediaPlayerPrivate::currentTime() const +float MediaPlayerPrivatePhonon::currentTime() const { float currentTime = m_mediaObject->currentTime() / 1000.0f; @@ -307,48 +307,48 @@ float MediaPlayerPrivate::currentTime() const return currentTime; } -PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const +PassRefPtr<TimeRanges> MediaPlayerPrivatePhonon::buffered() const { notImplemented(); return TimeRanges::create(); } -float MediaPlayerPrivate::maxTimeSeekable() const +float MediaPlayerPrivatePhonon::maxTimeSeekable() const { notImplemented(); return 0.0f; } -unsigned MediaPlayerPrivate::bytesLoaded() const +unsigned MediaPlayerPrivatePhonon::bytesLoaded() const { notImplemented(); return 0; } -unsigned MediaPlayerPrivate::totalBytes() const +unsigned MediaPlayerPrivatePhonon::totalBytes() const { //notImplemented(); return 0; } -void MediaPlayerPrivate::setRate(float) +void MediaPlayerPrivatePhonon::setRate(float) { notImplemented(); } -void MediaPlayerPrivate::setVolume(float volume) +void MediaPlayerPrivatePhonon::setVolume(float volume) { LOG(Media, "MediaPlayerPrivatePhonon::setVolume()"); m_audioOutput->setVolume(volume); } -void MediaPlayerPrivate::setMuted(bool muted) +void MediaPlayerPrivatePhonon::setMuted(bool muted) { LOG(Media, "MediaPlayerPrivatePhonon::setMuted()"); m_audioOutput->setMuted(muted); } -MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const +MediaPlayer::NetworkState MediaPlayerPrivatePhonon::networkState() const { const QMetaObject* metaObj = this->metaObject(); QMetaEnum networkStates = metaObj->enumerator(metaObj->indexOfEnumerator("NetworkState")); @@ -356,7 +356,7 @@ MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const return m_networkState; } -MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const +MediaPlayer::ReadyState MediaPlayerPrivatePhonon::readyState() const { const QMetaObject* metaObj = this->metaObject(); QMetaEnum readyStates = metaObj->enumerator(metaObj->indexOfEnumerator("ReadyState")); @@ -364,7 +364,7 @@ MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const return m_readyState; } -void MediaPlayerPrivate::updateStates() +void MediaPlayerPrivatePhonon::updateStates() { MediaPlayer::NetworkState oldNetworkState = m_networkState; MediaPlayer::ReadyState oldReadyState = m_readyState; @@ -412,7 +412,7 @@ void MediaPlayerPrivate::updateStates() } } -void MediaPlayerPrivate::setVisible(bool visible) +void MediaPlayerPrivatePhonon::setVisible(bool visible) { m_isVisible = visible; LOG(Media, "MediaPlayerPrivatePhonon::setVisible(%s)", visible ? "true" : "false"); @@ -420,7 +420,7 @@ void MediaPlayerPrivate::setVisible(bool visible) m_videoWidget->setVisible(m_isVisible); } -void MediaPlayerPrivate::setSize(const IntSize& newSize) +void MediaPlayerPrivatePhonon::setSize(const IntSize& newSize) { if (!m_videoWidget) return; @@ -434,7 +434,7 @@ void MediaPlayerPrivate::setSize(const IntSize& newSize) m_videoWidget->resize(newSize.width(), newSize.height()); } -IntSize MediaPlayerPrivate::naturalSize() const +IntSize MediaPlayerPrivatePhonon::naturalSize() const { if (!hasVideo()) { LOG(Media, "MediaPlayerPrivatePhonon::naturalSize() -> %dx%d", @@ -455,7 +455,7 @@ IntSize MediaPlayerPrivate::naturalSize() const return naturalSize; } -bool MediaPlayerPrivate::eventFilter(QObject* obj, QEvent* event) +bool MediaPlayerPrivatePhonon::eventFilter(QObject* obj, QEvent* event) { if (event->type() == QEvent::UpdateRequest) m_player->repaint(); @@ -463,7 +463,7 @@ bool MediaPlayerPrivate::eventFilter(QObject* obj, QEvent* event) return QObject::eventFilter(obj, event); } -void MediaPlayerPrivate::paint(GraphicsContext* graphicsContect, const IntRect& rect) +void MediaPlayerPrivatePhonon::paint(GraphicsContext* graphicsContect, const IntRect& rect) { if (graphicsContect->paintingDisabled()) return; @@ -481,7 +481,7 @@ void MediaPlayerPrivate::paint(GraphicsContext* graphicsContect, const IntRect& // ====================== Phonon::MediaObject signals ====================== -void MediaPlayerPrivate::stateChanged(Phonon::State newState, Phonon::State oldState) +void MediaPlayerPrivatePhonon::stateChanged(Phonon::State newState, Phonon::State oldState) { const QMetaObject* metaObj = this->metaObject(); QMetaEnum phononStates = metaObj->enumerator(metaObj->indexOfEnumerator("PhononState")); @@ -491,48 +491,48 @@ void MediaPlayerPrivate::stateChanged(Phonon::State newState, Phonon::State oldS updateStates(); } -void MediaPlayerPrivate::metaDataChanged() +void MediaPlayerPrivatePhonon::metaDataChanged() { LOG(Media, "MediaPlayerPrivatePhonon::metaDataChanged()"); LOG_MEDIAOBJECT(); } -void MediaPlayerPrivate::seekableChanged(bool) +void MediaPlayerPrivatePhonon::seekableChanged(bool) { notImplemented(); LOG_MEDIAOBJECT(); } -void MediaPlayerPrivate::hasVideoChanged(bool hasVideo) +void MediaPlayerPrivatePhonon::hasVideoChanged(bool hasVideo) { LOG(Media, "MediaPlayerPrivatePhonon::hasVideoChanged(%s)", hasVideo ? "true" : "false"); } -void MediaPlayerPrivate::bufferStatus(int) +void MediaPlayerPrivatePhonon::bufferStatus(int) { notImplemented(); LOG_MEDIAOBJECT(); } -void MediaPlayerPrivate::finished() +void MediaPlayerPrivatePhonon::finished() { notImplemented(); LOG_MEDIAOBJECT(); } -void MediaPlayerPrivate::currentSourceChanged(const Phonon::MediaSource&) +void MediaPlayerPrivatePhonon::currentSourceChanged(const Phonon::MediaSource&) { notImplemented(); LOG_MEDIAOBJECT(); } -void MediaPlayerPrivate::aboutToFinish() +void MediaPlayerPrivatePhonon::aboutToFinish() { notImplemented(); LOG_MEDIAOBJECT(); } -void MediaPlayerPrivate::totalTimeChanged(qint64 totalTime) +void MediaPlayerPrivatePhonon::totalTimeChanged(qint64 totalTime) { #if OS(WINDOWS) LOG(Media, "MediaPlayerPrivatePhonon::totalTimeChanged(%I64d)", totalTime); diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h b/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h index ff6a01c..d793675 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h @@ -40,13 +40,13 @@ QT_END_NAMESPACE namespace WebCore { - class MediaPlayerPrivate : public QObject, public MediaPlayerPrivateInterface { + class MediaPlayerPrivatePhonon : public QObject, public MediaPlayerPrivateInterface { Q_OBJECT public: static void registerMediaEngine(MediaEngineRegistrar); - ~MediaPlayerPrivate(); + ~MediaPlayerPrivatePhonon(); // These enums are used for debugging Q_ENUMS(ReadyState NetworkState PhononState) @@ -127,7 +127,7 @@ namespace WebCore { void totalTimeChanged(qint64); private: - MediaPlayerPrivate(MediaPlayer*); + MediaPlayerPrivatePhonon(MediaPlayer*); static MediaPlayerPrivateInterface* create(MediaPlayer* player); static void getSupportedTypes(HashSet<String>&); diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index 1bf1a3d..1a31d1e 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -53,17 +53,17 @@ using namespace WTF; namespace WebCore { -MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player) +MediaPlayerPrivateInterface* MediaPlayerPrivateQt::create(MediaPlayer* player) { - return new MediaPlayerPrivate(player); + return new MediaPlayerPrivateQt(player); } -void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar) +void MediaPlayerPrivateQt::registerMediaEngine(MediaEngineRegistrar registrar) { registrar(create, getSupportedTypes, supportsType); } -void MediaPlayerPrivate::getSupportedTypes(HashSet<String> &supported) +void MediaPlayerPrivateQt::getSupportedTypes(HashSet<String> &supported) { QStringList types = QMediaPlayer::supportedMimeTypes(); @@ -74,7 +74,7 @@ void MediaPlayerPrivate::getSupportedTypes(HashSet<String> &supported) } } -MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& mime, const String& codec) +MediaPlayer::SupportsType MediaPlayerPrivateQt::supportsType(const String& mime, const String& codec) { if (!mime.startsWith("audio/") && !mime.startsWith("video/")) return MediaPlayer::IsNotSupported; @@ -85,8 +85,8 @@ MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& mime, c return MediaPlayer::MayBeSupported; } -MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) - : m_player(player) +MediaPlayerPrivateQt::MediaPlayerPrivateQt(MediaPlayer* player) + : m_webCorePlayer(player) , m_mediaPlayer(new QMediaPlayer) , m_mediaPlayerControl(0) , m_videoItem(new QGraphicsVideoItem) @@ -132,23 +132,23 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) } } -MediaPlayerPrivate::~MediaPlayerPrivate() +MediaPlayerPrivateQt::~MediaPlayerPrivateQt() { delete m_mediaPlayer; delete m_videoScene; } -bool MediaPlayerPrivate::hasVideo() const +bool MediaPlayerPrivateQt::hasVideo() const { return m_mediaPlayer->isVideoAvailable(); } -bool MediaPlayerPrivate::hasAudio() const +bool MediaPlayerPrivateQt::hasAudio() const { return true; } -void MediaPlayerPrivate::load(const String& url) +void MediaPlayerPrivateQt::load(const String& url) { m_mediaUrl = url; @@ -162,25 +162,25 @@ void MediaPlayerPrivate::load(const String& url) commitLoad(url); } -void MediaPlayerPrivate::commitLoad(const String& url) +void MediaPlayerPrivateQt::commitLoad(const String& url) { // We are now loading if (m_networkState != MediaPlayer::Loading) { m_networkState = MediaPlayer::Loading; - m_player->networkStateChanged(); + m_webCorePlayer->networkStateChanged(); } // And we don't have any data yet if (m_readyState != MediaPlayer::HaveNothing) { m_readyState = MediaPlayer::HaveNothing; - m_player->readyStateChanged(); + m_webCorePlayer->readyStateChanged(); } const QUrl rUrl = QUrl(QString(url)); const QString scheme = rUrl.scheme().toLower(); // Grab the client media element - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_player->mediaPlayerClient()); + HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); // Construct the media content with a network request if the resource is http[s] if (scheme == "http" || scheme == "https") { @@ -236,7 +236,7 @@ void MediaPlayerPrivate::commitLoad(const String& url) m_mediaPlayer->play(); } -void MediaPlayerPrivate::resumeLoad() +void MediaPlayerPrivateQt::resumeLoad() { m_delayingLoad = false; @@ -244,36 +244,36 @@ void MediaPlayerPrivate::resumeLoad() commitLoad(m_mediaUrl); } -void MediaPlayerPrivate::cancelLoad() +void MediaPlayerPrivateQt::cancelLoad() { m_mediaPlayer->setMedia(QMediaContent()); updateStates(); } -void MediaPlayerPrivate::prepareToPlay() +void MediaPlayerPrivateQt::prepareToPlay() { if (m_mediaPlayer->media().isNull() || m_delayingLoad) resumeLoad(); } -void MediaPlayerPrivate::play() +void MediaPlayerPrivateQt::play() { if (m_mediaPlayer->state() != QMediaPlayer::PlayingState) m_mediaPlayer->play(); } -void MediaPlayerPrivate::pause() +void MediaPlayerPrivateQt::pause() { if (m_mediaPlayer->state() == QMediaPlayer::PlayingState) m_mediaPlayer->pause(); } -bool MediaPlayerPrivate::paused() const +bool MediaPlayerPrivateQt::paused() const { return (m_mediaPlayer->state() != QMediaPlayer::PlayingState); } -void MediaPlayerPrivate::seek(float position) +void MediaPlayerPrivateQt::seek(float position) { if (!m_mediaPlayer->isSeekable()) return; @@ -309,12 +309,12 @@ void MediaPlayerPrivate::seek(float position) } } -bool MediaPlayerPrivate::seeking() const +bool MediaPlayerPrivateQt::seeking() const { return m_isSeeking; } -float MediaPlayerPrivate::duration() const +float MediaPlayerPrivateQt::duration() const { if (m_readyState < MediaPlayer::HaveMetadata) return 0.0f; @@ -328,13 +328,13 @@ float MediaPlayerPrivate::duration() const return duration; } -float MediaPlayerPrivate::currentTime() const +float MediaPlayerPrivateQt::currentTime() const { float currentTime = m_mediaPlayer->position() / 1000.0f; return currentTime; } -PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const +PassRefPtr<TimeRanges> MediaPlayerPrivateQt::buffered() const { RefPtr<TimeRanges> buffered = TimeRanges::create(); @@ -352,7 +352,7 @@ PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const return buffered.release(); } -float MediaPlayerPrivate::maxTimeSeekable() const +float MediaPlayerPrivateQt::maxTimeSeekable() const { if (!m_mediaPlayerControl) return 0; @@ -360,7 +360,7 @@ float MediaPlayerPrivate::maxTimeSeekable() const return static_cast<float>(m_mediaPlayerControl->availablePlaybackRanges().latestTime()) / 1000.0f; } -unsigned MediaPlayerPrivate::bytesLoaded() const +unsigned MediaPlayerPrivateQt::bytesLoaded() const { QLatin1String bytesLoadedKey("bytes-loaded"); if (m_mediaPlayer->availableExtendedMetaData().contains(bytesLoadedKey)) @@ -369,7 +369,7 @@ unsigned MediaPlayerPrivate::bytesLoaded() const return m_mediaPlayer->bufferStatus(); } -unsigned MediaPlayerPrivate::totalBytes() const +unsigned MediaPlayerPrivateQt::totalBytes() const { if (m_mediaPlayer->availableMetaData().contains(QtMultimediaKit::Size)) return m_mediaPlayer->metaData(QtMultimediaKit::Size).toInt(); @@ -377,59 +377,59 @@ unsigned MediaPlayerPrivate::totalBytes() const return 100; } -void MediaPlayerPrivate::setPreload(MediaPlayer::Preload preload) +void MediaPlayerPrivateQt::setPreload(MediaPlayer::Preload preload) { m_preload = preload; if (m_delayingLoad && m_preload != MediaPlayer::None) resumeLoad(); } -void MediaPlayerPrivate::setRate(float rate) +void MediaPlayerPrivateQt::setRate(float rate) { m_mediaPlayer->setPlaybackRate(rate); } -void MediaPlayerPrivate::setVolume(float volume) +void MediaPlayerPrivateQt::setVolume(float volume) { m_mediaPlayer->setVolume(static_cast<int>(volume * 100.0)); } -bool MediaPlayerPrivate::supportsMuting() const +bool MediaPlayerPrivateQt::supportsMuting() const { return true; } -void MediaPlayerPrivate::setMuted(bool muted) +void MediaPlayerPrivateQt::setMuted(bool muted) { m_mediaPlayer->setMuted(muted); } -MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const +MediaPlayer::NetworkState MediaPlayerPrivateQt::networkState() const { return m_networkState; } -MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const +MediaPlayer::ReadyState MediaPlayerPrivateQt::readyState() const { return m_readyState; } -void MediaPlayerPrivate::setVisible(bool visible) +void MediaPlayerPrivateQt::setVisible(bool visible) { m_isVisible = visible; } -void MediaPlayerPrivate::mediaStatusChanged(QMediaPlayer::MediaStatus) +void MediaPlayerPrivateQt::mediaStatusChanged(QMediaPlayer::MediaStatus) { updateStates(); } -void MediaPlayerPrivate::handleError(QMediaPlayer::Error) +void MediaPlayerPrivateQt::handleError(QMediaPlayer::Error) { updateStates(); } -void MediaPlayerPrivate::stateChanged(QMediaPlayer::State state) +void MediaPlayerPrivateQt::stateChanged(QMediaPlayer::State state) { if (state != QMediaPlayer::PlayingState && m_isSeeking && m_queuedSeek >= 0) { m_mediaPlayer->setPosition(m_queuedSeek); @@ -437,12 +437,12 @@ void MediaPlayerPrivate::stateChanged(QMediaPlayer::State state) } } -void MediaPlayerPrivate::nativeSizeChanged(const QSizeF&) +void MediaPlayerPrivateQt::nativeSizeChanged(const QSizeF&) { - m_player->sizeChanged(); + m_webCorePlayer->sizeChanged(); } -void MediaPlayerPrivate::queuedSeekTimeout() +void MediaPlayerPrivateQt::queuedSeekTimeout() { // If we haven't heard anything, assume the player is now paused // and we can attempt the seek @@ -455,45 +455,45 @@ void MediaPlayerPrivate::queuedSeekTimeout() } } -void MediaPlayerPrivate::seekTimeout() +void MediaPlayerPrivateQt::seekTimeout() { // If we haven't heard anything, assume the seek succeeded if (m_isSeeking) { - m_player->timeChanged(); + m_webCorePlayer->timeChanged(); m_isSeeking = false; } } -void MediaPlayerPrivate::positionChanged(qint64) +void MediaPlayerPrivateQt::positionChanged(qint64) { // Only propogate this event if we are seeking if (m_isSeeking && m_queuedSeek == -1) { - m_player->timeChanged(); + m_webCorePlayer->timeChanged(); m_isSeeking = false; } } -void MediaPlayerPrivate::bufferStatusChanged(int) +void MediaPlayerPrivateQt::bufferStatusChanged(int) { notImplemented(); } -void MediaPlayerPrivate::durationChanged(qint64) +void MediaPlayerPrivateQt::durationChanged(qint64) { - m_player->durationChanged(); + m_webCorePlayer->durationChanged(); } -void MediaPlayerPrivate::volumeChanged(int volume) +void MediaPlayerPrivateQt::volumeChanged(int volume) { - m_player->volumeChanged(static_cast<float>(volume) / 100.0); + m_webCorePlayer->volumeChanged(static_cast<float>(volume) / 100.0); } -void MediaPlayerPrivate::mutedChanged(bool muted) +void MediaPlayerPrivateQt::mutedChanged(bool muted) { - m_player->muteChanged(muted); + m_webCorePlayer->muteChanged(muted); } -void MediaPlayerPrivate::updateStates() +void MediaPlayerPrivateQt::updateStates() { // Store the old states so that we can detect a change and raise change events MediaPlayer::NetworkState oldNetworkState = m_networkState; @@ -538,13 +538,13 @@ void MediaPlayerPrivate::updateStates() // Breaking this invariant will cause the resource selection algorithm for multiple // sources to fail. if (m_readyState != oldReadyState) - m_player->readyStateChanged(); + m_webCorePlayer->readyStateChanged(); if (m_networkState != oldNetworkState) - m_player->networkStateChanged(); + m_webCorePlayer->networkStateChanged(); } -void MediaPlayerPrivate::setSize(const IntSize& size) +void MediaPlayerPrivateQt::setSize(const IntSize& size) { if (size == m_currentSize) return; @@ -553,7 +553,7 @@ void MediaPlayerPrivate::setSize(const IntSize& size) m_videoItem->setSize(QSizeF(QSize(size))); } -IntSize MediaPlayerPrivate::naturalSize() const +IntSize MediaPlayerPrivateQt::naturalSize() const { if (!hasVideo() || m_readyState < MediaPlayer::HaveMetadata) return IntSize(); @@ -561,7 +561,7 @@ IntSize MediaPlayerPrivate::naturalSize() const return IntSize(m_videoItem->nativeSize().toSize()); } -void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect) +void MediaPlayerPrivateQt::paint(GraphicsContext* context, const IntRect& rect) { #if USE(ACCELERATED_COMPOSITING) if (m_composited) @@ -580,15 +580,16 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect) m_videoScene->render(painter, QRectF(QRect(rect)), m_videoItem->sceneBoundingRect()); } -void MediaPlayerPrivate::repaint() +void MediaPlayerPrivateQt::repaint() { - m_player->repaint(); + m_webCorePlayer->repaint(); } #if USE(ACCELERATED_COMPOSITING) -void MediaPlayerPrivate::acceleratedRenderingStateChanged() +void MediaPlayerPrivateQt::acceleratedRenderingStateChanged() { - bool composited = m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player); + MediaPlayerClient* client = m_webCorePlayer->mediaPlayerClient(); + bool composited = client->mediaPlayerRenderingCanBeAccelerated(m_webCorePlayer); if (composited == m_composited) return; @@ -599,17 +600,17 @@ void MediaPlayerPrivate::acceleratedRenderingStateChanged() m_videoScene->addItem(m_videoItem); } -PlatformLayer* MediaPlayerPrivate::platformLayer() const +PlatformLayer* MediaPlayerPrivateQt::platformLayer() const { return m_composited ? m_videoItem : 0; } #endif -PlatformMedia MediaPlayerPrivate::platformMedia() const +PlatformMedia MediaPlayerPrivateQt::platformMedia() const { PlatformMedia pm; pm.type = PlatformMedia::QtMediaPlayerType; - pm.media.qtMediaPlayer = const_cast<MediaPlayerPrivate*>(this); + pm.media.qtMediaPlayer = const_cast<MediaPlayerPrivateQt*>(this); return pm; } diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h index 117187d..179bf2a 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h @@ -33,13 +33,13 @@ QT_END_NAMESPACE namespace WebCore { -class MediaPlayerPrivate : public QObject, public MediaPlayerPrivateInterface { +class MediaPlayerPrivateQt : public QObject, public MediaPlayerPrivateInterface { Q_OBJECT public: static MediaPlayerPrivateInterface* create(MediaPlayer* player); - ~MediaPlayerPrivate(); + ~MediaPlayerPrivateQt(); static void registerMediaEngine(MediaEngineRegistrar); static void getSupportedTypes(HashSet<String>&); @@ -118,9 +118,9 @@ private: void updateStates(); private: - MediaPlayerPrivate(MediaPlayer*); + MediaPlayerPrivateQt(MediaPlayer*); - MediaPlayer* m_player; + MediaPlayer* m_webCorePlayer; QMediaPlayer* m_mediaPlayer; QMediaPlayerControl* m_mediaPlayerControl; QGraphicsVideoItem* m_videoItem; diff --git a/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp b/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp index b6d6e65..8301871 100644 --- a/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp @@ -36,7 +36,7 @@ #include "Base64.h" #include "ChromiumBridge.h" #include "OpenTypeUtilities.h" -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) #include "SkStream.h" #endif @@ -47,7 +47,7 @@ #if OS(WINDOWS) #include <objbase.h> -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) #include <cstring> #endif @@ -58,7 +58,7 @@ FontCustomPlatformData::~FontCustomPlatformData() #if OS(WINDOWS) if (m_fontReference) RemoveFontMemResourceEx(m_fontReference); -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) if (m_fontReference) m_fontReference->unref(); #endif @@ -99,7 +99,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b HFONT hfont = CreateFontIndirect(&logFont); return FontPlatformData(hfont, size); -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) ASSERT(m_fontReference); return FontPlatformData(m_fontReference, "", size, bold && !m_fontReference->isBold(), italic && !m_fontReference->isItalic()); #else @@ -123,7 +123,7 @@ static String createUniqueFontName() } #endif -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) class RemoteFontStream : public SkStream { public: explicit RemoteFontStream(PassRefPtr<SharedBuffer> buffer) @@ -189,7 +189,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) if (!fontReference) return 0; return new FontCustomPlatformData(fontReference, fontName); -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) RemoteFontStream* stream = new RemoteFontStream(buffer); SkTypeface* typeface = SkTypeface::CreateFromStream(stream); if (!typeface) diff --git a/WebCore/platform/graphics/skia/FontCustomPlatformData.h b/WebCore/platform/graphics/skia/FontCustomPlatformData.h index d451c9c..94d7ec3 100644 --- a/WebCore/platform/graphics/skia/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/skia/FontCustomPlatformData.h @@ -39,7 +39,7 @@ #if OS(WINDOWS) #include "PlatformString.h" #include <windows.h> -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) #include "SkTypeface.h" #endif @@ -54,7 +54,7 @@ struct FontCustomPlatformData : Noncopyable { : m_fontReference(fontReference) , m_name(name) {} -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) explicit FontCustomPlatformData(SkTypeface* typeface) : m_fontReference(typeface) {} @@ -70,7 +70,7 @@ struct FontCustomPlatformData : Noncopyable { #if OS(WINDOWS) HANDLE m_fontReference; String m_name; -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) SkTypeface* m_fontReference; #endif }; diff --git a/WebCore/platform/graphics/skia/GradientSkia.cpp b/WebCore/platform/graphics/skia/GradientSkia.cpp index 66a8976..a636d10 100644 --- a/WebCore/platform/graphics/skia/GradientSkia.cpp +++ b/WebCore/platform/graphics/skia/GradientSkia.cpp @@ -42,7 +42,7 @@ namespace WebCore { void Gradient::platformDestroy() { if (m_gradient) - m_gradient->safeUnref(); + SkSafeUnref(m_gradient); m_gradient = 0; } diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index d618c19..4bc98fb 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -338,13 +338,15 @@ void GraphicsContext::clearRect(const FloatRect& rect) if (paintingDisabled()) return; - if (platformContext()->useGPU()) { + if (platformContext()->useGPU() && !platformContext()->canvasClipApplied()) { platformContext()->prepareForHardwareDraw(); platformContext()->gpuCanvas()->clearRect(rect); return; } - platformContext()->prepareForSoftwareDraw(); + // Force a readback here (if we're using the GPU), since clearRect() is + // incompatible with mixed-mode rendering. + platformContext()->syncSoftwareCanvas(); SkRect r = rect; if (!isRectSkiaSafe(getCTM(), r)) diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp index 0b96d80..e123256 100644 --- a/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -36,7 +36,6 @@ #include "FloatConversion.h" #include "FloatRect.h" #include "GLES2Canvas.h" -#include "GLES2Context.h" #include "GraphicsContext.h" #include "Logging.h" #include "NativeImageSkia.h" @@ -144,7 +143,9 @@ static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext // Everything else gets resampled. // If the platform context permits high quality interpolation, use it. - if (platformContext->interpolationQuality() == InterpolationHigh) + // High quality interpolation only enabled for scaling and translation. + if (platformContext->interpolationQuality() == InterpolationHigh + && !(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) return RESAMPLE_AWESOME; return RESAMPLE_LINEAR; @@ -174,8 +175,12 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm && srcIRect.height() == bitmap.height(); // We will always draw in integer sizes, so round the destination rect. + // First we need to apply canvas transformation matrix to get desired size of + // resampled image. + SkRect destRectTransformed; + canvas.getTotalMatrix().mapRect(&destRectTransformed, destRect); SkIRect destRectRounded; - destRect.round(&destRectRounded); + destRectTransformed.round(&destRectRounded); SkIRect resizedImageRect = // Represents the size of the resized image. { 0, 0, destRectRounded.width(), destRectRounded.height() }; @@ -189,7 +194,10 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm // Compute the visible portion of our rect. SkRect destBitmapSubsetSk; ClipRectToCanvas(canvas, destRect, &destBitmapSubsetSk); - destBitmapSubsetSk.offset(-destRect.fLeft, -destRect.fTop); + // Determine size of resampled image based on clipped destination rect. + SkRect destBitmapSubsetSkTransformed; + canvas.getTotalMatrix().mapRect(&destBitmapSubsetSkTransformed, destBitmapSubsetSk); + destBitmapSubsetSkTransformed.offset(-destBitmapSubsetSkTransformed.fLeft, -destBitmapSubsetSkTransformed.fTop); // The matrix inverting, etc. could have introduced rounding error which // causes the bounds to be outside of the resized bitmap. We round outward @@ -197,7 +205,7 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm // need, and then clamp to the bitmap bounds so we don't get any invalid // data. SkIRect destBitmapSubsetSkI; - destBitmapSubsetSk.roundOut(&destBitmapSubsetSkI); + destBitmapSubsetSkTransformed.roundOut(&destBitmapSubsetSkI); if (!destBitmapSubsetSkI.intersect(resizedImageRect)) return; // Resized image does not intersect. diff --git a/WebCore/platform/graphics/skia/PatternSkia.cpp b/WebCore/platform/graphics/skia/PatternSkia.cpp index bd27b6a..72fac77 100644 --- a/WebCore/platform/graphics/skia/PatternSkia.cpp +++ b/WebCore/platform/graphics/skia/PatternSkia.cpp @@ -42,7 +42,7 @@ namespace WebCore { void Pattern::platformDestroy() { - m_pattern->safeUnref(); + SkSafeUnref(m_pattern); m_pattern = 0; } diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 88fbcdd..b469312 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -162,19 +162,19 @@ PlatformContextSkia::State::State(const State& other) , m_interpolationQuality(other.m_interpolationQuality) , m_canvasClipApplied(other.m_canvasClipApplied) { - // Up the ref count of these. saveRef does nothing if 'this' is NULL. - m_looper->safeRef(); - m_dash->safeRef(); - m_fillShader->safeRef(); - m_strokeShader->safeRef(); + // Up the ref count of these. SkSafeRef does nothing if its argument is 0. + SkSafeRef(m_looper); + SkSafeRef(m_dash); + SkSafeRef(m_fillShader); + SkSafeRef(m_strokeShader); } PlatformContextSkia::State::~State() { - m_looper->safeUnref(); - m_dash->safeUnref(); - m_fillShader->safeUnref(); - m_strokeShader->safeUnref(); + SkSafeUnref(m_looper); + SkSafeUnref(m_dash); + SkSafeUnref(m_fillShader); + SkSafeUnref(m_strokeShader); } // Returns a new State with all of this object's inherited properties copied. @@ -327,7 +327,7 @@ void PlatformContextSkia::drawRect(SkRect rect) // setFillColor() will set the shader to NULL, so save a ref to it now. SkShader* oldFillShader = m_state->m_fillShader; - oldFillShader->safeRef(); + SkSafeRef(oldFillShader); setFillColor(m_state->m_strokeColor); paint.reset(); setupPaintForFilling(&paint); @@ -341,7 +341,7 @@ void PlatformContextSkia::drawRect(SkRect rect) canvas()->drawRect(rightBorder, paint); setFillColor(oldFillColor); setFillShader(oldFillShader); - oldFillShader->safeUnref(); + SkSafeUnref(oldFillShader); } } @@ -487,9 +487,9 @@ void PlatformContextSkia::setStrokeThickness(float thickness) void PlatformContextSkia::setStrokeShader(SkShader* strokeShader) { if (strokeShader != m_state->m_strokeShader) { - m_state->m_strokeShader->safeUnref(); + SkSafeUnref(m_state->m_strokeShader); m_state->m_strokeShader = strokeShader; - m_state->m_strokeShader->safeRef(); + SkSafeRef(m_state->m_strokeShader); } } @@ -561,9 +561,9 @@ void PlatformContextSkia::setFillRule(SkPath::FillType fr) void PlatformContextSkia::setFillShader(SkShader* fillShader) { if (fillShader != m_state->m_fillShader) { - m_state->m_fillShader->safeUnref(); + SkSafeUnref(m_state->m_fillShader); m_state->m_fillShader = fillShader; - m_state->m_fillShader->safeRef(); + SkSafeRef(m_state->m_fillShader); } } @@ -580,7 +580,7 @@ void PlatformContextSkia::setInterpolationQuality(InterpolationQuality interpola void PlatformContextSkia::setDashPathEffect(SkDashPathEffect* dash) { if (dash != m_state->m_dash) { - m_state->m_dash->safeUnref(); + SkSafeUnref(m_state->m_dash); m_state->m_dash = dash; } } @@ -677,6 +677,11 @@ bool PlatformContextSkia::canAccelerate() const && !m_state->m_canvasClipApplied; // Can't accelerate with a clip to path applied. } +bool PlatformContextSkia::canvasClipApplied() const +{ + return m_state->m_canvasClipApplied; +} + class WillPublishCallbackImpl : public DrawingBuffer::WillPublishCallback { public: static PassOwnPtr<WillPublishCallback> create(PlatformContextSkia* pcs) @@ -840,7 +845,7 @@ void PlatformContextSkia::readbackHardwareToSoftware() const for (int i = 0; i < width; ++i) { uint32_t pixel = pixels[i]; // Swizzles from RGBA -> BGRA. - pixels[i] = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); + pixels[i] = (pixel & 0xFF00FF00) | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); } } } diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h index 4ba85d1..eb03224 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -180,6 +180,7 @@ public: bool hasImageResamplingHint() const; bool canAccelerate() const; + bool canvasClipApplied() const; bool useGPU() { return m_useGPU; } void setSharedGraphicsContext3D(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&); GLES2Canvas* gpuCanvas() const { return m_gpuCanvas.get(); } diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp index 9edb775..6acfd35 100644 --- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp +++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp @@ -340,7 +340,7 @@ bool paintSkiaText(GraphicsContext* context, // thing would be to draw to a new layer and then draw that layer // with a shadow. But this is a lot of extra work for something // that isn't normally an issue. - paint.setLooper(0)->safeUnref(); + SkSafeUnref(paint.setLooper(0)); } if (!skiaDrawText(hfont, dc, platformContext->canvas(), *origin, &paint, diff --git a/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp b/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp index 4072a18..80e01a9 100644 --- a/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp +++ b/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp @@ -234,7 +234,6 @@ static void addArcPoints(PathPolygon& poly, const PlatformPathElement::ArcTo& da static void drawPolygons(HDC dc, const Vector<PathPolygon>& polygons, bool fill, const AffineTransform* transformation) { - MemoryAllocationCanFail canFail; for (Vector<PathPolygon>::const_iterator i = polygons.begin(); i != polygons.end(); ++i) { int npoints = i->size(); if (!npoints) diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index 327f069..e7ee432 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -37,27 +37,27 @@ namespace WebCore { -enum ClipboardType { - ClipboardTypeText, - ClipboardTypeMarkup, - ClipboardTypeURIList, - ClipboardTypeURL, - ClipboardTypeImage, - ClipboardTypeUnknown +enum ClipboardDataType { + ClipboardDataTypeText, + ClipboardDataTypeMarkup, + ClipboardDataTypeURIList, + ClipboardDataTypeURL, + ClipboardDataTypeImage, + ClipboardDataTypeUnknown }; PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame* frame) { - return ClipboardGtk::create(policy, gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD), false, frame); + return ClipboardGtk::create(policy, gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD), frame); } PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame) { - return ClipboardGtk::create(policy, dragData->platformData(), true, frame); + return ClipboardGtk::create(policy, dragData->platformData(), DragAndDrop, frame); } ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, GtkClipboard* clipboard, Frame* frame) - : Clipboard(policy, false) + : Clipboard(policy, CopyAndPaste) , m_dataObject(DataObjectGtk::forClipboard(clipboard)) , m_clipboard(clipboard) , m_helper(Pasteboard::generalPasteboard()->helper()) @@ -65,8 +65,8 @@ ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, GtkClipboard* clipboard { } -ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, PassRefPtr<DataObjectGtk> dataObject, bool forDragging, Frame* frame) - : Clipboard(policy, forDragging) +ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, PassRefPtr<DataObjectGtk> dataObject, ClipboardType clipboardType, Frame* frame) + : Clipboard(policy, clipboardType) , m_dataObject(dataObject) , m_clipboard(0) , m_helper(Pasteboard::generalPasteboard()->helper()) @@ -78,27 +78,27 @@ ClipboardGtk::~ClipboardGtk() { } -static ClipboardType dataObjectTypeFromHTMLClipboardType(const String& rawType) +static ClipboardDataType dataObjectTypeFromHTMLClipboardType(const String& rawType) { String type(rawType.stripWhiteSpace()); // Two special cases for IE compatibility if (type == "Text") - return ClipboardTypeText; + return ClipboardDataTypeText; if (type == "URL") - return ClipboardTypeURL; + return ClipboardDataTypeURL; // From the Mac port: Ignore any trailing charset - JS strings are // Unicode, which encapsulates the charset issue. if (type == "text/plain" || type.startsWith("text/plain;")) - return ClipboardTypeText; + return ClipboardDataTypeText; if (type == "text/html" || type.startsWith("text/html;")) - return ClipboardTypeMarkup; + return ClipboardDataTypeMarkup; if (type == "Files" || type == "text/uri-list" || type.startsWith("text/uri-list;")) - return ClipboardTypeURIList; + return ClipboardDataTypeURIList; // Not a known type, so just default to using the text portion. - return ClipboardTypeUnknown; + return ClipboardDataTypeUnknown; } void ClipboardGtk::clearData(const String& typeString) @@ -106,19 +106,19 @@ void ClipboardGtk::clearData(const String& typeString) if (policy() != ClipboardWritable) return; - ClipboardType type = dataObjectTypeFromHTMLClipboardType(typeString); + ClipboardDataType type = dataObjectTypeFromHTMLClipboardType(typeString); switch (type) { - case ClipboardTypeURIList: - case ClipboardTypeURL: + case ClipboardDataTypeURIList: + case ClipboardDataTypeURL: m_dataObject->clearURIList(); break; - case ClipboardTypeMarkup: + case ClipboardDataTypeMarkup: m_dataObject->clearMarkup(); break; - case ClipboardTypeText: + case ClipboardDataTypeText: m_dataObject->clearText(); break; - case ClipboardTypeUnknown: + case ClipboardDataTypeUnknown: default: m_dataObject->clear(); } @@ -162,29 +162,29 @@ String ClipboardGtk::getData(const String& typeString, bool& success) const if (m_clipboard) m_helper->getClipboardContents(m_clipboard); - ClipboardType type = dataObjectTypeFromHTMLClipboardType(typeString); - if (type == ClipboardTypeURIList) { + ClipboardDataType type = dataObjectTypeFromHTMLClipboardType(typeString); + if (type == ClipboardDataTypeURIList) { if (!m_dataObject->hasURIList()) return String(); success = true; return joinURIList(m_dataObject->uriList()); } - if (type == ClipboardTypeURL) { + if (type == ClipboardDataTypeURL) { if (!m_dataObject->hasURL()) return String(); success = true; return m_dataObject->url(); } - if (type == ClipboardTypeMarkup) { + if (type == ClipboardDataTypeMarkup) { if (!m_dataObject->hasMarkup()) return String(); success = true; return m_dataObject->markup(); } - if (type == ClipboardTypeText) { + if (type == ClipboardDataTypeText) { if (!m_dataObject->hasText()) return String(); success = true; @@ -200,8 +200,8 @@ bool ClipboardGtk::setData(const String& typeString, const String& data) return false; bool success = false; - ClipboardType type = dataObjectTypeFromHTMLClipboardType(typeString); - if (type == ClipboardTypeURIList || type == ClipboardTypeURL) { + ClipboardDataType type = dataObjectTypeFromHTMLClipboardType(typeString); + if (type == ClipboardDataTypeURIList || type == ClipboardDataTypeURL) { Vector<KURL> uriList; gchar** uris = g_uri_list_extract_uris(data.utf8().data()); if (uris) { @@ -214,10 +214,10 @@ bool ClipboardGtk::setData(const String& typeString, const String& data) m_dataObject->setURIList(uriList); success = true; } - } else if (type == ClipboardTypeMarkup) { + } else if (type == ClipboardDataTypeMarkup) { m_dataObject->setMarkup(data); success = true; - } else if (type == ClipboardTypeText) { + } else if (type == ClipboardDataTypeText) { m_dataObject->setText(data); success = true; } diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h index f0af318..e14a583 100644 --- a/WebCore/platform/gtk/ClipboardGtk.h +++ b/WebCore/platform/gtk/ClipboardGtk.h @@ -40,14 +40,14 @@ namespace WebCore { // Created from the EventHandlerGtk to be used by the dom class ClipboardGtk : public Clipboard, public CachedResourceClient { public: - static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, bool isForDragging, Frame* frame) + static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, Frame* frame) { return adoptRef(new ClipboardGtk(policy, clipboard, frame)); } - static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, PassRefPtr<DataObjectGtk> dataObject, bool isForDragging, Frame* frame) + static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, PassRefPtr<DataObjectGtk> dataObject, ClipboardType clipboardType, Frame* frame) { - return adoptRef(new ClipboardGtk(policy, dataObject, isForDragging, frame)); + return adoptRef(new ClipboardGtk(policy, dataObject, clipboardType, frame)); } virtual ~ClipboardGtk(); @@ -78,7 +78,7 @@ namespace WebCore { private: ClipboardGtk(ClipboardAccessPolicy, GtkClipboard*, Frame*); - ClipboardGtk(ClipboardAccessPolicy, PassRefPtr<DataObjectGtk>, bool, Frame*); + ClipboardGtk(ClipboardAccessPolicy, PassRefPtr<DataObjectGtk>, ClipboardType, Frame*); RefPtr<DataObjectGtk> m_dataObject; GtkClipboard* m_clipboard; diff --git a/WebCore/platform/gtk/ContextMenuItemGtk.cpp b/WebCore/platform/gtk/ContextMenuItemGtk.cpp index e2c5b84..68d0a9a 100644 --- a/WebCore/platform/gtk/ContextMenuItemGtk.cpp +++ b/WebCore/platform/gtk/ContextMenuItemGtk.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2010 Igalia S.L * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,11 +34,13 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti switch (action) { case ContextMenuItemTagCopyLinkToClipboard: case ContextMenuItemTagCopyImageToClipboard: + case ContextMenuItemTagCopyMediaLinkToClipboard: case ContextMenuItemTagCopy: return GTK_STOCK_COPY; case ContextMenuItemTagOpenLinkInNewWindow: case ContextMenuItemTagOpenImageInNewWindow: case ContextMenuItemTagOpenFrameInNewWindow: + case ContextMenuItemTagOpenMediaInNewWindow: return GTK_STOCK_OPEN; case ContextMenuItemTagDownloadLinkToDisk: case ContextMenuItemTagDownloadImageToDisk: @@ -59,7 +62,7 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti case ContextMenuItemTagSelectAll: return GTK_STOCK_SELECT_ALL; case ContextMenuItemTagSpellingGuess: - return NULL; + return 0; case ContextMenuItemTagIgnoreSpelling: return GTK_STOCK_NO; case ContextMenuItemTagLearnSpelling: @@ -99,8 +102,14 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti return GTK_STOCK_UNDERLINE; case ContextMenuItemTagShowColors: return GTK_STOCK_SELECT_COLOR; + case ContextMenuItemTagToggleMediaControls: + case ContextMenuItemTagToggleMediaLoop: + // No icon for this. + return 0; + case ContextMenuItemTagEnterVideoFullscreen: + return GTK_STOCK_FULLSCREEN; default: - return NULL; + return 0; } } diff --git a/WebCore/platform/gtk/GtkVersioning.c b/WebCore/platform/gtk/GtkVersioning.c index 7dd601e..f5466be 100644 --- a/WebCore/platform/gtk/GtkVersioning.c +++ b/WebCore/platform/gtk/GtkVersioning.c @@ -60,10 +60,41 @@ GdkDevice *getDefaultGDKPointerDevice(GdkWindow* window) } #if !GTK_CHECK_VERSION(2, 17, 3) -static void gdk_window_get_root_coords(GdkWindow* window, gint x, gint y, gint* rootX, gint* rootY) +void gdk_window_get_root_coords(GdkWindow* window, gint x, gint y, gint* rootX, gint* rootY) { gdk_window_get_root_origin(window, rootX, rootY); *rootX = *rootX + x; *rootY = *rootY + y; } #endif + +GdkCursor * blankCursor() +{ +#if GTK_CHECK_VERSION(2, 16, 0) + return gdk_cursor_new(GDK_BLANK_CURSOR); +#else + GdkCursor * cursor; + GdkPixmap * source; + GdkPixmap * mask; + GdkColor foreground = { 0, 65535, 0, 0 }; // Red. + GdkColor background = { 0, 0, 0, 65535 }; // Blue. + static gchar cursorBits[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; + + source = gdk_bitmap_create_from_data(0, cursorBits, 8, 8); + mask = gdk_bitmap_create_from_data(0, cursorBits, 8, 8); + cursor = gdk_cursor_new_from_pixmap(source, mask, &foreground, &background, 8, 8); + gdk_pixmap_unref(source); + gdk_pixmap_unref(mask); + return cursor; +#endif // GTK_CHECK_VERSION(2, 16, 0) +} + +#if !GTK_CHECK_VERSION(2, 16, 0) +const gchar* gtk_menu_item_get_label(GtkMenuItem* menuItem) +{ + GtkWidget * label = gtk_bin_get_child(GTK_BIN(menuItem)); + if (GTK_IS_LABEL(label)) + return gtk_label_get_text(GTK_LABEL(label)); + return 0; +} +#endif // GTK_CHECK_VERSION(2, 16, 0) diff --git a/WebCore/platform/gtk/GtkVersioning.h b/WebCore/platform/gtk/GtkVersioning.h index 867e14f..a874e9e 100644 --- a/WebCore/platform/gtk/GtkVersioning.h +++ b/WebCore/platform/gtk/GtkVersioning.h @@ -57,6 +57,8 @@ G_BEGIN_DECLS #if !GTK_CHECK_VERSION(2, 18, 0) #define gtk_widget_set_visible(widget, FALSE) GTK_WIDGET_UNSET_FLAGS((widget), GTK_VISIBLE) +#define gtk_widget_get_visible(widget) (GTK_WIDGET_FLAGS(widget) & GTK_VISIBLE) + #define gtk_widget_set_window(widget, new_window) (widget)->window = (new_window) #define gtk_widget_set_can_focus(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_CAN_FOCUS) #define gtk_widget_get_allocation(widget, alloc) (*(alloc) = (widget)->allocation) @@ -64,8 +66,13 @@ G_BEGIN_DECLS #endif // GTK_CHECK_VERSION(2, 18, 0) #if !GTK_CHECK_VERSION(2, 17, 3) -static void gdk_window_get_root_coords(GdkWindow* window, gint x, gint y, gint* rootX, gint* rootY); -#endif //GTK_CHECK_VERSION(2, 17, 3) +void gdk_window_get_root_coords(GdkWindow* window, gint x, gint y, gint* rootX, gint* rootY); +#endif // GTK_CHECK_VERSION(2, 17, 3) + +#if !GTK_CHECK_VERSION(2, 16, 0) +const gchar* gtk_menu_item_get_label(GtkMenuItem*); +#endif // GTK_CHECK_VERSION(2, 16, 0) + #if !GTK_CHECK_VERSION(2, 14, 0) #define gtk_widget_get_window(widget) (widget)->window @@ -84,6 +91,7 @@ void gtk_adjustment_set_value(GtkAdjustment* adjusment, gdouble value); #endif // GTK_CHECK_VERSION(2, 14, 0) GdkDevice* getDefaultGDKPointerDevice(GdkWindow* window); +GdkCursor* blankCursor(); G_END_DECLS diff --git a/WebCore/platform/gtk/LocalizedStringsGtk.cpp b/WebCore/platform/gtk/LocalizedStringsGtk.cpp index 432c92f..7851326 100644 --- a/WebCore/platform/gtk/LocalizedStringsGtk.cpp +++ b/WebCore/platform/gtk/LocalizedStringsGtk.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2008 Christian Dywan <christian@imendio.com> * Copyright (C) 2008 Nuanti Ltd. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -110,6 +111,56 @@ String contextMenuItemTagCopyImageToClipboard() return String::fromUTF8(_("Cop_y Image")); } +String contextMenuItemTagOpenVideoInNewWindow() +{ + return String::fromUTF8(_("Open _Video in New Window")); +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return String::fromUTF8(_("Open _Audio in New Window")); +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return String::fromUTF8(_("Cop_y Video Link Location")); +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return String::fromUTF8(_("Cop_y Audio Link Location")); +} + +String contextMenuItemTagToggleMediaControls() +{ + return String::fromUTF8(_("_Toggle Media Controls")); +} + +String contextMenuItemTagToggleMediaLoop() +{ + return String::fromUTF8(_("Toggle Media _Loop Playback")); +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return String::fromUTF8(_("Switch Video to _Fullscreen")); +} + +String contextMenuItemTagMediaPlay() +{ + return String::fromUTF8(_("_Play")); +} + +String contextMenuItemTagMediaPause() +{ + return String::fromUTF8(_("_Pause")); +} + +String contextMenuItemTagMediaMute() +{ + return String::fromUTF8(_("_Mute")); +} + String contextMenuItemTagOpenFrameInNewWindow() { return String::fromUTF8(_("Open _Frame in New Window")); diff --git a/WebCore/platform/haiku/ClipboardHaiku.cpp b/WebCore/platform/haiku/ClipboardHaiku.cpp index da242c1..495f1d2 100644 --- a/WebCore/platform/haiku/ClipboardHaiku.cpp +++ b/WebCore/platform/haiku/ClipboardHaiku.cpp @@ -44,11 +44,11 @@ namespace WebCore { PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData*, Frame*) { - return ClipboardHaiku::create(policy, true); + return ClipboardHaiku::create(policy, DragAndDrop); } -ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, bool forDragging) - : Clipboard(policy, forDragging) +ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(policy, clipboardType) { } diff --git a/WebCore/platform/haiku/ClipboardHaiku.h b/WebCore/platform/haiku/ClipboardHaiku.h index 37ffe5c..89dc7bd 100644 --- a/WebCore/platform/haiku/ClipboardHaiku.h +++ b/WebCore/platform/haiku/ClipboardHaiku.h @@ -36,9 +36,9 @@ namespace WebCore { // State available during IE's events for drag and drop and copy/paste. class ClipboardHaiku : public Clipboard { public: - static PassRefPtr<ClipboardHaiku> create(ClipboardAccessPolicy policy, bool forDragging) + static PassRefPtr<ClipboardHaiku> create(ClipboardAccessPolicy policy, ClipboardType clipboardType) { - return adoptRef(new ClipboardHaiku(policy, forDragging)); + return adoptRef(new ClipboardHaiku(policy, clipboardType)); } ~ClipboardHaiku() { } @@ -66,7 +66,7 @@ namespace WebCore { virtual bool hasData(); private: - ClipboardHaiku(ClipboardAccessPolicy, bool forDragging); + ClipboardHaiku(ClipboardAccessPolicy, ClipboardType); }; } // namespace WebCore diff --git a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp index 5321792..4c12cf3 100644 --- a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp +++ b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp @@ -98,6 +98,56 @@ String contextMenuItemTagCopyImageToClipboard() return "Copy image to clipboard"; } +String contextMenuItemTagOpenVideoInNewWindow() +{ + return "Open video in new window"; +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return "Open audio in new window"; +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return "Copy video link location"; +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return "Copy audio link location"; +} + +String contextMenuItemTagToggleMediaControls() +{ + return "Toggle media controls"; +} + +String contextMenuItemTagToggleMediaLoop() +{ + return "Toggle media loop playback"; +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return "Switch video to fullscreen"; +} + +String contextMenuItemTagMediaPlay() +{ + return "Play"; +} + +String contextMenuItemTagMediaPause() +{ + return "Pause"; +} + +String contextMenuItemTagMediaMute() +{ + return "Mute"; +} + String contextMenuItemTagOpenFrameInNewWindow() { return "Open frame in new window"; diff --git a/WebCore/platform/image-decoders/ImageDecoder.cpp b/WebCore/platform/image-decoders/ImageDecoder.cpp index 475bd9f..1c3dcf8 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.cpp +++ b/WebCore/platform/image-decoders/ImageDecoder.cpp @@ -133,14 +133,15 @@ void RGBA32Buffer::zeroFill() m_hasAlpha = true; } -void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) +bool RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) { if (this == &other) - return; + return true; m_bytes = other.m_bytes; m_size = other.m_size; setHasAlpha(other.m_hasAlpha); + return true; } bool RGBA32Buffer::setSize(int newWidth, int newHeight) diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index 4012168..90e8ae2 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -85,8 +85,8 @@ namespace WebCore { void zeroFill(); // Creates a new copy of the image data in |other|, so the two images - // can be modified independently. - void copyBitmapData(const RGBA32Buffer& other); + // can be modified independently. Returns whether the copy succeeded. + bool copyBitmapData(const RGBA32Buffer& other); // Copies the pixel data at [(startX, startY), (endX, startY)) to the // same X-coordinates on each subsequent row up to but not including diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp index 4d2a92d..4797495 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp +++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp @@ -60,7 +60,7 @@ bool GIFImageDecoder::isSizeAvailable() return ImageDecoder::isSizeAvailable(); } -bool GIFImageDecoder::setSize(unsigned width, unsigned height) +bool GIFImageDecoder::setSize(int width, int height) { if (ImageDecoder::isSizeAvailable() && size().width() == width && size().height() == height) return true; @@ -356,7 +356,8 @@ bool GIFImageDecoder::initFrameBuffer(unsigned frameIndex) if ((prevMethod == RGBA32Buffer::DisposeNotSpecified) || (prevMethod == RGBA32Buffer::DisposeKeep)) { // Preserve the last frame as the starting state for this frame. - buffer->copyBitmapData(*prevBuffer); + if (!buffer->copyBitmapData(*prevBuffer)) + return setFailed(); } else { // We want to clear the previous frame to transparent, without // affecting pixels in the image outside of the frame. @@ -369,7 +370,8 @@ bool GIFImageDecoder::initFrameBuffer(unsigned frameIndex) return setFailed(); } else { // Copy the whole previous buffer, then clear just its frame. - buffer->copyBitmapData(*prevBuffer); + if (!buffer->copyBitmapData(*prevBuffer)) + return setFailed(); for (int y = prevRect.y(); y < prevRect.bottom(); ++y) { for (int x = prevRect.x(); x < prevRect.right(); ++x) buffer->setRGBA(x, y, 0, 0, 0, 0); diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h index 21c1c57..0a88ffd 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h +++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h @@ -45,7 +45,7 @@ namespace WebCore { virtual String filenameExtension() const { return "gif"; } virtual void setData(SharedBuffer* data, bool allDataReceived); virtual bool isSizeAvailable(); - virtual bool setSize(unsigned width, unsigned height); + virtual bool setSize(int width, int height); virtual size_t frameCount(); virtual int repetitionCount() const; virtual RGBA32Buffer* frameBufferAtIndex(size_t index); diff --git a/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp b/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp index 044515a..a782373 100644 --- a/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp +++ b/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp @@ -75,15 +75,16 @@ void RGBA32Buffer::zeroFill() m_pixmap.fill(QColor(0, 0, 0, 0)); } -void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) +bool RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) { if (this == &other) - return; + return true; m_image = other.m_image; m_pixmap = other.m_pixmap; m_size = other.m_size; m_hasAlpha = other.m_hasAlpha; + return true; } bool RGBA32Buffer::setSize(int newWidth, int newHeight) diff --git a/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp b/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp index c7e2114..7baca5f 100644 --- a/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp +++ b/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp @@ -72,14 +72,14 @@ void RGBA32Buffer::zeroFill() m_bitmap.eraseARGB(0, 0, 0, 0); } -void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) +bool RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) { if (this == &other) - return; + return true; m_bitmap.reset(); const NativeImageSkia& otherBitmap = other.m_bitmap; - otherBitmap.copyTo(&m_bitmap, otherBitmap.config()); + return otherBitmap.copyTo(&m_bitmap, otherBitmap.config()); } bool RGBA32Buffer::setSize(int newWidth, int newHeight) diff --git a/WebCore/platform/mac/ClipboardMac.h b/WebCore/platform/mac/ClipboardMac.h index adde09c..7187ecf 100644 --- a/WebCore/platform/mac/ClipboardMac.h +++ b/WebCore/platform/mac/ClipboardMac.h @@ -45,9 +45,9 @@ class FileList; class ClipboardMac : public Clipboard, public CachedResourceClient { public: - static PassRefPtr<ClipboardMac> create(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame* frame) + static PassRefPtr<ClipboardMac> create(ClipboardType clipboardType, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame* frame) { - return adoptRef(new ClipboardMac(forDragging, pasteboard, policy, frame)); + return adoptRef(new ClipboardMac(clipboardType, pasteboard, policy, frame)); } virtual ~ClipboardMac(); @@ -79,7 +79,7 @@ public: NSPasteboard *pasteboard() { return m_pasteboard.get(); } private: - ClipboardMac(bool forDragging, NSPasteboard *, ClipboardAccessPolicy, Frame*); + ClipboardMac(ClipboardType, NSPasteboard *, ClipboardAccessPolicy, Frame*); void setDragImage(CachedImage*, Node*, const IntPoint&); diff --git a/WebCore/platform/mac/ClipboardMac.mm b/WebCore/platform/mac/ClipboardMac.mm index 74a93b6..10d196a 100644 --- a/WebCore/platform/mac/ClipboardMac.mm +++ b/WebCore/platform/mac/ClipboardMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,7 +31,6 @@ #import "DragController.h" #import "DragData.h" #import "Editor.h" -#import "FoundationExtras.h" #import "FileList.h" #import "Frame.h" #import "Image.h" @@ -50,11 +49,11 @@ namespace WebCore { PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame) { - return ClipboardMac::create(true, [dragData->platformData() draggingPasteboard], policy, frame); + return ClipboardMac::create(DragAndDrop, [dragData->platformData() draggingPasteboard], policy, frame); } -ClipboardMac::ClipboardMac(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame *frame) - : Clipboard(policy, forDragging) +ClipboardMac::ClipboardMac(ClipboardType clipboardType, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame *frame) + : Clipboard(policy, clipboardType) , m_pasteboard(pasteboard) , m_frame(frame) { @@ -70,7 +69,7 @@ bool ClipboardMac::hasData() return m_pasteboard && [m_pasteboard.get() types] && [[m_pasteboard.get() types] count] > 0; } -static NSString *cocoaTypeFromHTMLClipboardType(const String& type) +static RetainPtr<NSString> cocoaTypeFromHTMLClipboardType(const String& type) { String qType = type.stripWhiteSpace(); @@ -93,11 +92,11 @@ static NSString *cocoaTypeFromHTMLClipboardType(const String& type) if (utiType) { CFStringRef pbType = UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassNSPboardType); if (pbType) - return HardAutorelease(pbType); + return (NSString *)pbType; } - // No mapping, just pass the whole string though - return qType; + // No mapping, just pass the whole string though + return (NSString *)qType; } static String utiTypeFromCocoaType(NSString *type) @@ -151,9 +150,8 @@ void ClipboardMac::clearData(const String& type) // note NSPasteboard enforces changeCount itself on writing - can't write if not the owner - NSString *cocoaType = cocoaTypeFromHTMLClipboardType(type); - if (cocoaType) - [m_pasteboard.get() setString:@"" forType:cocoaType]; + if (RetainPtr<NSString> cocoaType = cocoaTypeFromHTMLClipboardType(type)) + [m_pasteboard.get() setString:@"" forType:cocoaType.get()]; } void ClipboardMac::clearAllData() @@ -218,19 +216,19 @@ String ClipboardMac::getData(const String& type, bool& success) const if (policy() != ClipboardReadable) return String(); - NSString *cocoaType = cocoaTypeFromHTMLClipboardType(type); + RetainPtr<NSString> cocoaType = cocoaTypeFromHTMLClipboardType(type); NSString *cocoaValue = nil; // Grab the value off the pasteboard corresponding to the cocoaType - if ([cocoaType isEqualToString:NSURLPboardType]) { + if ([cocoaType.get() isEqualToString:NSURLPboardType]) { // "URL" and "text/url-list" both map to NSURLPboardType in cocoaTypeFromHTMLClipboardType(), "URL" only wants the first URL bool onlyFirstURL = (type == "URL"); NSArray *absoluteURLs = absoluteURLsFromPasteboard(m_pasteboard.get(), onlyFirstURL); cocoaValue = [absoluteURLs componentsJoinedByString:@"\n"]; - } else if ([cocoaType isEqualToString:NSStringPboardType]) { - cocoaValue = [[m_pasteboard.get() stringForType:cocoaType] precomposedStringWithCanonicalMapping]; + } else if ([cocoaType.get() isEqualToString:NSStringPboardType]) { + cocoaValue = [[m_pasteboard.get() stringForType:cocoaType.get()] precomposedStringWithCanonicalMapping]; } else if (cocoaType) - cocoaValue = [m_pasteboard.get() stringForType:cocoaType]; + cocoaValue = [m_pasteboard.get() stringForType:cocoaType.get()]; // Enforce changeCount ourselves for security. We check after reading instead of before to be // sure it doesn't change between our testing the change count and accessing the data. @@ -248,10 +246,10 @@ bool ClipboardMac::setData(const String &type, const String &data) return false; // note NSPasteboard enforces changeCount itself on writing - can't write if not the owner - NSString *cocoaType = cocoaTypeFromHTMLClipboardType(type); + RetainPtr<NSString> cocoaType = cocoaTypeFromHTMLClipboardType(type); NSString *cocoaData = data; - if ([cocoaType isEqualToString:NSURLPboardType]) { + if ([cocoaType.get() isEqualToString:NSURLPboardType]) { [m_pasteboard.get() addTypes:[NSArray arrayWithObject:NSURLPboardType] owner:nil]; NSURL *url = [[NSURL alloc] initWithString:cocoaData]; [url writeToPasteboard:m_pasteboard.get()]; @@ -268,8 +266,8 @@ bool ClipboardMac::setData(const String &type, const String &data) if (cocoaType) { // everything else we know of goes on the pboard as a string - [m_pasteboard.get() addTypes:[NSArray arrayWithObject:cocoaType] owner:nil]; - return [m_pasteboard.get() setString:cocoaData forType:cocoaType]; + [m_pasteboard.get() addTypes:[NSArray arrayWithObject:cocoaType.get()] owner:nil]; + return [m_pasteboard.get() setString:cocoaData forType:cocoaType.get()]; } return false; diff --git a/WebCore/platform/mac/CursorMac.mm b/WebCore/platform/mac/CursorMac.mm index 1b4c1b1..c006cbc 100644 --- a/WebCore/platform/mac/CursorMac.mm +++ b/WebCore/platform/mac/CursorMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +27,6 @@ #import "Cursor.h" #import "BlockExceptions.h" -#import "FoundationExtras.h" #import <wtf/StdLibExtras.h> @interface WebCoreCursorBundle : NSObject { } @@ -41,14 +40,14 @@ namespace WebCore { // Simple NSCursor calls shouldn't need protection, // but creating a cursor with a bad image might throw. -static NSCursor* createCustomCursor(Image* image, const IntPoint& hotSpot) +static RetainPtr<NSCursor> createCustomCursor(Image* image, const IntPoint& hotSpot) { // FIXME: The cursor won't animate. Not sure if that's a big deal. - NSImage* img = image->getNSImage(); - if (!img) + NSImage* nsImage = image->getNSImage(); + if (!nsImage) return 0; BEGIN_BLOCK_OBJC_EXCEPTIONS; - return [[NSCursor alloc] initWithImage:img hotSpot:hotSpot]; + return RetainPtr<NSCursor>(AdoptNS, [[NSCursor alloc] initWithImage:nsImage hotSpot:hotSpot]); END_BLOCK_OBJC_EXCEPTIONS; return 0; } @@ -81,118 +80,118 @@ void Cursor::ensurePlatformCursor() const switch (m_type) { case Cursor::Pointer: - m_platformCursor = HardRetain([NSCursor arrowCursor]); + m_platformCursor = [NSCursor arrowCursor]; break; case Cursor::Cross: - m_platformCursor = HardRetain(leakNamedCursor("crossHairCursor", 11, 11)); + m_platformCursor = leakNamedCursor("crossHairCursor", 11, 11); break; case Cursor::Hand: - m_platformCursor = HardRetain(leakNamedCursor("linkCursor", 6, 1)); + m_platformCursor = leakNamedCursor("linkCursor", 6, 1); break; case Cursor::IBeam: - m_platformCursor = HardRetain([NSCursor IBeamCursor]); + m_platformCursor = [NSCursor IBeamCursor]; break; case Cursor::Wait: - m_platformCursor = HardRetain(leakNamedCursor("waitCursor", 7, 7)); + m_platformCursor = leakNamedCursor("waitCursor", 7, 7); break; case Cursor::Help: - m_platformCursor = HardRetain(leakNamedCursor("helpCursor", 8, 8)); + m_platformCursor = leakNamedCursor("helpCursor", 8, 8); break; case Cursor::Move: case Cursor::MiddlePanning: - m_platformCursor = HardRetain(leakNamedCursor("moveCursor", 7, 7)); + m_platformCursor = leakNamedCursor("moveCursor", 7, 7); break; case Cursor::EastResize: case Cursor::EastPanning: - m_platformCursor = HardRetain(leakNamedCursor("eastResizeCursor", 14, 7)); + m_platformCursor = leakNamedCursor("eastResizeCursor", 14, 7); break; case Cursor::NorthResize: case Cursor::NorthPanning: - m_platformCursor = HardRetain(leakNamedCursor("northResizeCursor", 7, 1)); + m_platformCursor = leakNamedCursor("northResizeCursor", 7, 1); break; case Cursor::NorthEastResize: case Cursor::NorthEastPanning: - m_platformCursor = HardRetain(leakNamedCursor("northEastResizeCursor", 14, 1)); + m_platformCursor = leakNamedCursor("northEastResizeCursor", 14, 1); break; case Cursor::NorthWestResize: case Cursor::NorthWestPanning: - m_platformCursor = HardRetain(leakNamedCursor("northWestResizeCursor", 0, 0)); + m_platformCursor = leakNamedCursor("northWestResizeCursor", 0, 0); break; case Cursor::SouthResize: case Cursor::SouthPanning: - m_platformCursor = HardRetain(leakNamedCursor("southResizeCursor", 7, 14)); + m_platformCursor = leakNamedCursor("southResizeCursor", 7, 14); break; case Cursor::SouthEastResize: case Cursor::SouthEastPanning: - m_platformCursor = HardRetain(leakNamedCursor("southEastResizeCursor", 14, 14)); + m_platformCursor = leakNamedCursor("southEastResizeCursor", 14, 14); break; case Cursor::SouthWestResize: case Cursor::SouthWestPanning: - m_platformCursor = HardRetain(leakNamedCursor("southWestResizeCursor", 1, 14)); + m_platformCursor = leakNamedCursor("southWestResizeCursor", 1, 14); break; case Cursor::WestResize: - m_platformCursor = HardRetain(leakNamedCursor("westResizeCursor", 1, 7)); + m_platformCursor = leakNamedCursor("westResizeCursor", 1, 7); break; case Cursor::NorthSouthResize: - m_platformCursor = HardRetain(leakNamedCursor("northSouthResizeCursor", 7, 7)); + m_platformCursor = leakNamedCursor("northSouthResizeCursor", 7, 7); break; case Cursor::EastWestResize: case Cursor::WestPanning: - m_platformCursor = HardRetain(leakNamedCursor("eastWestResizeCursor", 7, 7)); + m_platformCursor = leakNamedCursor("eastWestResizeCursor", 7, 7); break; case Cursor::NorthEastSouthWestResize: - m_platformCursor = HardRetain(leakNamedCursor("northEastSouthWestResizeCursor", 7, 7)); + m_platformCursor = leakNamedCursor("northEastSouthWestResizeCursor", 7, 7); break; case Cursor::NorthWestSouthEastResize: - m_platformCursor = HardRetain(leakNamedCursor("northWestSouthEastResizeCursor", 7, 7)); + m_platformCursor = leakNamedCursor("northWestSouthEastResizeCursor", 7, 7); break; case Cursor::ColumnResize: - m_platformCursor = HardRetain([NSCursor resizeLeftRightCursor]); + m_platformCursor = [NSCursor resizeLeftRightCursor]; break; case Cursor::RowResize: - m_platformCursor = HardRetain([NSCursor resizeUpDownCursor]); + m_platformCursor = [NSCursor resizeUpDownCursor]; break; case Cursor::VerticalText: - m_platformCursor = HardRetain(leakNamedCursor("verticalTextCursor", 7, 7)); + m_platformCursor = leakNamedCursor("verticalTextCursor", 7, 7); break; case Cursor::Cell: - m_platformCursor = HardRetain(leakNamedCursor("cellCursor", 7, 7)); + m_platformCursor = leakNamedCursor("cellCursor", 7, 7); break; case Cursor::ContextMenu: - m_platformCursor = HardRetain(leakNamedCursor("contextMenuCursor", 3, 2)); + m_platformCursor = leakNamedCursor("contextMenuCursor", 3, 2); break; case Cursor::Alias: - m_platformCursor = HardRetain(leakNamedCursor("aliasCursor", 11, 3)); + m_platformCursor = leakNamedCursor("aliasCursor", 11, 3); break; case Cursor::Progress: - m_platformCursor = HardRetain(leakNamedCursor("progressCursor", 3, 2)); + m_platformCursor = leakNamedCursor("progressCursor", 3, 2); break; case Cursor::NoDrop: - m_platformCursor = HardRetain(leakNamedCursor("noDropCursor", 3, 1)); + m_platformCursor = leakNamedCursor("noDropCursor", 3, 1); break; case Cursor::Copy: - m_platformCursor = HardRetain(leakNamedCursor("copyCursor", 3, 2)); + m_platformCursor = leakNamedCursor("copyCursor", 3, 2); break; case Cursor::None: - m_platformCursor = HardRetain(leakNamedCursor("noneCursor", 7, 7)); + m_platformCursor = leakNamedCursor("noneCursor", 7, 7); break; case Cursor::NotAllowed: - m_platformCursor = HardRetain(leakNamedCursor("notAllowedCursor", 11, 11)); + m_platformCursor = leakNamedCursor("notAllowedCursor", 11, 11); break; case Cursor::ZoomIn: - m_platformCursor = HardRetain(leakNamedCursor("zoomInCursor", 7, 7)); + m_platformCursor = leakNamedCursor("zoomInCursor", 7, 7); break; case Cursor::ZoomOut: - m_platformCursor = HardRetain(leakNamedCursor("zoomOutCursor", 7, 7)); + m_platformCursor = leakNamedCursor("zoomOutCursor", 7, 7); break; case Cursor::Grab: - m_platformCursor = HardRetain([NSCursor openHandCursor]); + m_platformCursor = [NSCursor openHandCursor]; break; case Cursor::Grabbing: - m_platformCursor = HardRetain([NSCursor closedHandCursor]); + m_platformCursor = [NSCursor closedHandCursor]; break; case Cursor::Custom: - m_platformCursor = HardRetainWithNSRelease(createCustomCursor(m_image.get(), m_hotSpot)); + m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot); break; } } @@ -201,7 +200,7 @@ Cursor::Cursor(const Cursor& other) : m_type(other.m_type) , m_image(other.m_image) , m_hotSpot(other.m_hotSpot) - , m_platformCursor(HardRetain(other.m_platformCursor)) + , m_platformCursor(other.m_platformCursor) { } @@ -210,16 +209,18 @@ Cursor& Cursor::operator=(const Cursor& other) m_type = other.m_type; m_image = other.m_image; m_hotSpot = other.m_hotSpot; - - HardRetain(other.m_platformCursor); - HardRelease(m_platformCursor); m_platformCursor = other.m_platformCursor; return *this; } Cursor::~Cursor() { - HardRelease(m_platformCursor); +} + +NSCursor *Cursor::platformCursor() const +{ + ensurePlatformCursor(); + return m_platformCursor.get(); } } // namespace WebCore diff --git a/WebCore/platform/mac/FoundationExtras.h b/WebCore/platform/mac/FoundationExtras.h index 85ce8d7..39b12ea 100644 --- a/WebCore/platform/mac/FoundationExtras.h +++ b/WebCore/platform/mac/FoundationExtras.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2004 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,50 +26,15 @@ #import <CoreFoundation/CFBase.h> #import <Foundation/NSObject.h> -// nil-checked CFRetain/CFRelease covers for Objective-C ids - -// Use CFRetain, CFRelease, HardRetain, or HardRelease instead of -// -[NSObject retain] and -[NSObject release] if you want to store -// a pointer to an Objective-C object into memory that won't -// be scanned for GC, like a C++ object. - -static inline id HardRetain(id obj) -{ - if (obj) CFRetain(obj); - return obj; -} - -static inline void HardRelease(id obj) -{ - if (obj) CFRelease(obj); -} - -// As if CF and Foundation had logically separate reference counts, -// this function first increments the CF retain count, and then -// decrements the NS retain count. This is needed to handle cases where -// -retain/-release aren't equivalent to CFRetain/HardRelease, such as -// when GC is used. - -// Use HardRetainWithNSRelease after allocating and initializing a NSObject -// if you want to store a pointer to that object into memory that won't -// be scanned for GC, like a C++ object. - -static inline id HardRetainWithNSRelease(id obj) -{ - HardRetain(obj); - [obj release]; - return obj; -} - // Use HardAutorelease to return an object made by a CoreFoundation // "create" or "copy" function as an autoreleased and garbage collected // object. CF objects need to be "made collectable" for autorelease to work // properly under GC. -static inline id HardAutorelease(CFTypeRef obj) +static inline id HardAutorelease(CFTypeRef object) { - if (obj) - CFMakeCollectable(obj); - [(id)obj autorelease]; - return (id)obj; + if (object) + CFMakeCollectable(object); + [(id)object autorelease]; + return (id)object; } diff --git a/WebCore/platform/mac/RuntimeApplicationChecks.h b/WebCore/platform/mac/RuntimeApplicationChecks.h index 24b8ae1..f938048 100644 --- a/WebCore/platform/mac/RuntimeApplicationChecks.h +++ b/WebCore/platform/mac/RuntimeApplicationChecks.h @@ -32,6 +32,8 @@ bool applicationIsAppleMail(); bool applicationIsSafari(); bool applicationIsMicrosoftMessenger(); bool applicationIsAdobeInstaller(); +bool applicationIsAOLInstantMessenger(); +bool applicationIsMicrosoftMyDay(); } // namespace WebCore diff --git a/WebCore/platform/mac/RuntimeApplicationChecks.mm b/WebCore/platform/mac/RuntimeApplicationChecks.mm index bcc1dc9..7fe8378 100644 --- a/WebCore/platform/mac/RuntimeApplicationChecks.mm +++ b/WebCore/platform/mac/RuntimeApplicationChecks.mm @@ -52,5 +52,17 @@ bool applicationIsAdobeInstaller() static bool isAdobeInstaller = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.adobe.Installers.Setup"]; return isAdobeInstaller; } + +bool applicationIsAOLInstantMessenger() +{ + static bool isAOLInstantMessenger = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.aol.aim.desktop"]; + return isAOLInstantMessenger; +} + +bool applicationIsMicrosoftMyDay() +{ + static bool isMicrosoftMyDay = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.microsoft.myday"]; + return isMicrosoftMyDay; +} } // namespace WebCore diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm index c57e8df..75cbd36 100644 --- a/WebCore/platform/mac/ThemeMac.mm +++ b/WebCore/platform/mac/ThemeMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -375,43 +375,53 @@ static const int* buttonMargins(NSControlSize controlSize) return margins[controlSize]; } -static void setupButtonCell(NSButtonCell *&buttonCell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) +enum ButtonCellType { NormalButtonCell, DefaultButtonCell }; + +static NSButtonCell *leakButtonCell(ButtonCellType type) { - if (!buttonCell) { - buttonCell = [[NSButtonCell alloc] init]; - [buttonCell setTitle:nil]; - [buttonCell setButtonType:NSMomentaryPushInButton]; - if (states & DefaultState) - [buttonCell setKeyEquivalent:@"\r"]; - } + NSButtonCell *cell = [[NSButtonCell alloc] init]; + [cell setTitle:nil]; + [cell setButtonType:NSMomentaryPushInButton]; + if (type == DefaultButtonCell) + [cell setKeyEquivalent:@"\r"]; + return cell; +} +static void setUpButtonCell(NSButtonCell *cell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) +{ // Set the control size based off the rectangle we're painting into. const IntSize* sizes = buttonSizes(); #if ENABLE(DATALIST) if (part == ListButtonPart) { - [buttonCell setBezelStyle:NSRoundedDisclosureBezelStyle]; + [cell setBezelStyle:NSRoundedDisclosureBezelStyle]; sizes = listButtonSizes(); } else #endif if (part == SquareButtonPart || zoomedRect.height() > buttonSizes()[NSRegularControlSize].height() * zoomFactor) { // Use the square button - if ([buttonCell bezelStyle] != NSShadowlessSquareBezelStyle) - [buttonCell setBezelStyle:NSShadowlessSquareBezelStyle]; - } else if ([buttonCell bezelStyle] != NSRoundedBezelStyle) - [buttonCell setBezelStyle:NSRoundedBezelStyle]; + if ([cell bezelStyle] != NSShadowlessSquareBezelStyle) + [cell setBezelStyle:NSShadowlessSquareBezelStyle]; + } else if ([cell bezelStyle] != NSRoundedBezelStyle) + [cell setBezelStyle:NSRoundedBezelStyle]; - setControlSize(buttonCell, sizes, zoomedRect.size(), zoomFactor); + setControlSize(cell, sizes, zoomedRect.size(), zoomFactor); // Update the various states we respond to. - updateStates(buttonCell, states); + updateStates(cell, states); } - + static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - bool isDefault = states & DefaultState; - static NSButtonCell *cells[2]; - setupButtonCell(cells[isDefault], part, states, zoomedRect, zoomFactor); - return cells[isDefault]; + NSButtonCell *cell; + if (states & DefaultState) { + static NSButtonCell *defaultCell = leakButtonCell(DefaultButtonCell); + cell = defaultCell; + } else { + static NSButtonCell *normalCell = leakButtonCell(NormalButtonCell); + cell = normalCell; + } + setUpButtonCell(cell, part, states, zoomedRect, zoomFactor); + return cell; } static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) diff --git a/WebCore/platform/mac/WidgetMac.mm b/WebCore/platform/mac/WidgetMac.mm index 2598591..e8bb81d 100644 --- a/WebCore/platform/mac/WidgetMac.mm +++ b/WebCore/platform/mac/WidgetMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,7 +35,6 @@ #import "Cursor.h" #import "Document.h" #import "Font.h" -#import "FoundationExtras.h" #import "Frame.h" #import "GraphicsContext.h" #import "NotImplemented.h" @@ -100,7 +99,6 @@ Widget::Widget(NSView *view) Widget::~Widget() { - releasePlatformWidget(); delete m_data; } @@ -354,16 +352,18 @@ IntPoint Widget::convertFromContainingWindowToRoot(const Widget* rootWidget, con return point; } -void Widget::releasePlatformWidget() +NSView *Widget::platformWidget() const { - HardRelease(m_widget); - m_data->previousVisibleRect = NSZeroRect; + return m_widget.get(); } -void Widget::retainPlatformWidget() +void Widget::setPlatformWidget(NSView *widget) { - HardRetain(m_widget); + if (widget == m_widget) + return; + + m_widget = widget; + m_data->previousVisibleRect = NSZeroRect; } } // namespace WebCore - diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.h b/WebCore/platform/mock/DeviceOrientationClientMock.h index 6691130..baa4245 100644 --- a/WebCore/platform/mock/DeviceOrientationClientMock.h +++ b/WebCore/platform/mock/DeviceOrientationClientMock.h @@ -49,6 +49,7 @@ public: virtual void startUpdating(); virtual void stopUpdating(); virtual DeviceOrientation* lastOrientation() const { return m_orientation.get(); } + virtual void deviceOrientationControllerDestroyed() { } void setOrientation(PassRefPtr<DeviceOrientation>); diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h index 1cb9ee0..2ea42b1 100644 --- a/WebCore/platform/network/ResourceHandle.h +++ b/WebCore/platform/network/ResourceHandle.h @@ -46,11 +46,6 @@ typedef unsigned long DWORD; typedef unsigned long DWORD_PTR; typedef void* LPVOID; typedef LPVOID HINTERNET; -typedef unsigned WPARAM; -typedef long LPARAM; -typedef struct HWND__* HWND; -typedef _W64 long LONG_PTR; -typedef LONG_PTR LRESULT; #endif @@ -168,14 +163,11 @@ public: static void forceContentSniffing(); #if USE(WININET) - void setHasReceivedResponse(bool = true); - bool hasReceivedResponse() const; + void setSynchronousInternetHandle(HINTERNET); void fileLoadTimer(Timer<ResourceHandle>*); - void onHandleCreated(LPARAM); - void onRequestRedirected(LPARAM); - void onRequestComplete(LPARAM); - friend void __stdcall transferJobStatusCallback(HINTERNET, DWORD_PTR, DWORD, LPVOID, DWORD); - friend LRESULT __stdcall ResourceHandleWndProc(HWND, unsigned message, WPARAM, LPARAM); + void onRedirect(); + bool onRequestComplete(); + static void CALLBACK internetStatusCallback(HINTERNET, DWORD_PTR, DWORD, LPVOID, DWORD); #endif #if PLATFORM(QT) || USE(CURL) || USE(SOUP) || PLATFORM(ANDROID) diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h index 7b6db90..96fbf00 100644 --- a/WebCore/platform/network/ResourceHandleInternal.h +++ b/WebCore/platform/network/ResourceHandleInternal.h @@ -92,16 +92,13 @@ namespace WebCore { #endif #if USE(WININET) , m_fileLoadTimer(loader, &ResourceHandle::fileLoadTimer) - , m_resourceHandle(0) - , m_secondaryHandle(0) - , m_jobId(0) - , m_threadId(0) - , m_writing(false) - , m_formDataString(0) - , m_formDataLength(0) + , m_internetHandle(0) + , m_connectHandle(0) + , m_requestHandle(0) + , m_sentEndRequest(false) , m_bytesRemainingToWrite(0) + , m_loadSynchronously(false) , m_hasReceivedResponse(false) - , m_resend(false) #endif #if USE(CURL) , m_handle(0) @@ -167,17 +164,15 @@ namespace WebCore { #endif #if USE(WININET) Timer<ResourceHandle> m_fileLoadTimer; - HINTERNET m_resourceHandle; - HINTERNET m_secondaryHandle; - unsigned m_jobId; - DWORD m_threadId; - bool m_writing; - char* m_formDataString; - int m_formDataLength; - int m_bytesRemainingToWrite; - String m_postReferrer; + HINTERNET m_internetHandle; + HINTERNET m_connectHandle; + HINTERNET m_requestHandle; + bool m_sentEndRequest; + Vector<char> m_formData; + size_t m_bytesRemainingToWrite; + bool m_loadSynchronously; bool m_hasReceivedResponse; - bool m_resend; + String m_redirectUrl; #endif #if USE(CURL) CURL* m_handle; diff --git a/WebCore/platform/network/mac/WebCoreURLResponse.mm b/WebCore/platform/network/mac/WebCoreURLResponse.mm index 9be4714..e287e5f 100644 --- a/WebCore/platform/network/mac/WebCoreURLResponse.mm +++ b/WebCore/platform/network/mac/WebCoreURLResponse.mm @@ -29,7 +29,6 @@ #import "config.h" #import "WebCoreURLResponse.h" -#import "FoundationExtras.h" #import "MIMETypeRegistry.h" #import <objc/objc-class.h> #import <wtf/Assertions.h> @@ -327,12 +326,12 @@ static NSDictionary *createExtensionToMIMETypeMap() ]; } -static NSString *mimeTypeFromUTITree(CFStringRef uti) +static RetainPtr<NSString> mimeTypeFromUTITree(CFStringRef uti) { // Check if this UTI has a MIME type. RetainPtr<CFStringRef> mimeType(AdoptCF, UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)); if (mimeType) - return (NSString *)HardAutorelease(mimeType.releaseRef()); + return (NSString *)mimeType.get(); // If not, walk the ancestory of this UTI via its "ConformsTo" tags and return the first MIME type we find. RetainPtr<CFDictionaryRef> decl(AdoptCF, UTTypeCopyDeclaration(uti)); @@ -354,7 +353,7 @@ static NSString *mimeTypeFromUTITree(CFStringRef uti) if (CFGetTypeID(object) != CFStringGetTypeID()) continue; - if (NSString *mimeType = mimeTypeFromUTITree((CFStringRef)object)) + if (RetainPtr<NSString> mimeType = mimeTypeFromUTITree((CFStringRef)object)) return mimeType; } } @@ -366,13 +365,13 @@ static NSString *mimeTypeFromUTITree(CFStringRef uti) -(void)adjustMIMETypeIfNecessary { - NSString *result = [self MIMEType]; - NSString *originalResult = result; + RetainPtr<NSString> result = [self MIMEType]; + RetainPtr<NSString> originalResult = result; #ifdef BUILDING_ON_TIGER // When content sniffing is disabled, Tiger's CFNetwork automatically returns application/octet-stream for certain // extensions even when scouring the UTI maps would end up with a better result, so we'll give a chance for that to happen. - if ([[self URL] isFileURL] && [result caseInsensitiveCompare:@"application/octet-stream"] == NSOrderedSame) + if ([[self URL] isFileURL] && [result.get() caseInsensitiveCompare:@"application/octet-stream"] == NSOrderedSame) result = nil; #endif @@ -403,7 +402,7 @@ static NSString *mimeTypeFromUTITree(CFStringRef uti) #ifndef BUILDING_ON_TIGER // <rdar://problem/5321972> Plain text document from HTTP server detected as application/octet-stream // Make the best guess when deciding between "generic binary" and "generic text" using a table of known binary MIME types. - if ([result isEqualToString:@"application/octet-stream"] && [self respondsToSelector:@selector(allHeaderFields)] && [[[self performSelector:@selector(allHeaderFields)] objectForKey:@"Content-Type"] hasPrefix:@"text/plain"]) { + if ([result.get() isEqualToString:@"application/octet-stream"] && [self respondsToSelector:@selector(allHeaderFields)] && [[[self performSelector:@selector(allHeaderFields)] objectForKey:@"Content-Type"] hasPrefix:@"text/plain"]) { static NSSet *binaryExtensions = createBinaryExtensionsSet(); if (![binaryExtensions containsObject:[[[self suggestedFilename] pathExtension] lowercaseString]]) result = @"text/plain"; @@ -413,12 +412,12 @@ static NSString *mimeTypeFromUTITree(CFStringRef uti) #ifdef BUILDING_ON_LEOPARD // Workaround for <rdar://problem/5539824> - if ([result isEqualToString:@"text/xml"]) + if ([result.get() isEqualToString:@"text/xml"]) result = @"application/xml"; #endif if (result != originalResult) - [self _setMIMEType:result]; + [self _setMIMEType:result.get()]; } @end diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 30f7011..ca3af75 100644 --- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -161,10 +161,8 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load m_method = QNetworkAccessManager::PostOperation; else if (r.httpMethod() == "PUT") m_method = QNetworkAccessManager::PutOperation; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) else if (r.httpMethod() == "DELETE") m_method = QNetworkAccessManager::DeleteOperation; -#endif #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) else if (r.httpMethod() == "OPTIONS") m_method = QNetworkAccessManager::CustomOperation; @@ -246,6 +244,9 @@ void QNetworkReplyHandler::finish() if (m_shouldFinish) return; + if (!m_reply) + return; + sendResponseIfNeeded(); if (!m_resourceHandle) @@ -465,12 +466,10 @@ void QNetworkReplyHandler::start() putDevice->setParent(m_reply); break; } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) case QNetworkAccessManager::DeleteOperation: { m_reply = manager->deleteResource(m_request); break; } -#endif #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) case QNetworkAccessManager::CustomOperation: m_reply = manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data()); diff --git a/WebCore/platform/network/qt/ResourceRequestQt.cpp b/WebCore/platform/network/qt/ResourceRequestQt.cpp index 4d576c7..7e162ed 100644 --- a/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -47,9 +47,7 @@ QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) con { QNetworkRequest request; request.setUrl(url()); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) request.setOriginatingObject(originatingFrame); -#endif const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); diff --git a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp index e666ff7..cc508b6 100644 --- a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp +++ b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp @@ -148,12 +148,9 @@ void SocketStreamHandlePrivate::socketErrorCallback(int error) } #ifndef QT_NO_OPENSSL -void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>&) +void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>& error) { - // FIXME: based on http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-68#page-15 - // we should abort on certificate errors. - // We don't abort while this is still work in progress. - static_cast<QSslSocket*>(m_socket)->ignoreSslErrors(); + QMetaObject::invokeMethod(this, "socketErrorCallback", Qt::QueuedConnection, Q_ARG(int, error[0].error())); } #endif diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index 0009e36..0d84388 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -866,7 +866,10 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) return; } - response.setMimeType(g_file_info_get_content_type(info)); + // According to http://library.gnome.org/devel/gio/stable/gio-GContentType.html + // GContentType on Unix is the mime type, but not on Win32. + GOwnPtr<gchar> mimeType(g_content_type_get_mime_type(g_file_info_get_content_type(info))); + response.setMimeType(mimeType.get()); response.setExpectedContentLength(g_file_info_get_size(info)); GTimeVal tv; diff --git a/WebCore/platform/network/win/ResourceHandleWin.cpp b/WebCore/platform/network/win/ResourceHandleWin.cpp index 832a8e2..5de2e1b 100644 --- a/WebCore/platform/network/win/ResourceHandleWin.cpp +++ b/WebCore/platform/network/win/ResourceHandleWin.cpp @@ -27,43 +27,38 @@ #include "config.h" #include "ResourceHandle.h" -#include "CachedResourceLoader.h" -#include "Document.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "Page.h" +#include "HTTPParsers.h" +#include "MIMETypeRegistry.h" +#include "MainThread.h" +#include "NotImplemented.h" #include "ResourceError.h" #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" -#include "ResourceHandleWin.h" +#include "SharedBuffer.h" #include "Timer.h" -#include "WebCoreInstanceHandle.h" - +#include "UnusedParam.h" #include <wtf/text/CString.h> #include <windows.h> #include <wininet.h> namespace WebCore { -static unsigned transferJobId = 0; -static HashMap<int, ResourceHandle*>* jobIdMap = 0; +static inline HINTERNET createInternetHandle(const String& userAgent, bool asynchronous) +{ + String userAgentString = userAgent; + HINTERNET internetHandle = InternetOpenW(userAgentString.charactersWithNullTermination(), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, asynchronous ? INTERNET_FLAG_ASYNC : 0); -static HWND transferJobWindowHandle = 0; -const LPCWSTR kResourceHandleWindowClassName = L"ResourceHandleWindowClass"; + if (asynchronous) + InternetSetStatusCallback(internetHandle, &ResourceHandle::internetStatusCallback); -// Message types for internal use (keep in sync with kMessageHandlers) -enum { - handleCreatedMessage = WM_USER, - requestRedirectedMessage, - requestCompleteMessage -}; + return internetHandle; +} -typedef void (ResourceHandle:: *ResourceHandleEventHandler)(LPARAM); -static const ResourceHandleEventHandler messageHandlers[] = { - &ResourceHandle::onHandleCreated, - &ResourceHandle::onRequestRedirected, - &ResourceHandle::onRequestComplete -}; +static HINTERNET asynchronousInternetHandle(const String& userAgent) +{ + static HINTERNET internetHandle = createInternetHandle(userAgent, true); + return internetHandle; +} static String queryHTTPHeader(HINTERNET requestHandle, DWORD infoLevel) { @@ -79,69 +74,13 @@ static String queryHTTPHeader(HINTERNET requestHandle, DWORD infoLevel) return String::adopt(characters); } -static int addToOutstandingJobs(ResourceHandle* job) -{ - if (!jobIdMap) - jobIdMap = new HashMap<int, ResourceHandle*>; - transferJobId++; - jobIdMap->set(transferJobId, job); - return transferJobId; -} - -static void removeFromOutstandingJobs(int jobId) -{ - if (!jobIdMap) - return; - jobIdMap->remove(jobId); -} - -static ResourceHandle* lookupResourceHandle(int jobId) -{ - if (!jobIdMap) - return 0; - return jobIdMap->get(jobId); -} - -static LRESULT CALLBACK ResourceHandleWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam) -{ - if (message >= handleCreatedMessage) { - UINT index = message - handleCreatedMessage; - if (index < _countof(messageHandlers)) { - unsigned jobId = (unsigned) wParam; - ResourceHandle* job = lookupResourceHandle(jobId); - if (job) { - ASSERT(job->d->m_jobId == jobId); - ASSERT(job->d->m_threadId == GetCurrentThreadId()); - (job->*(messageHandlers[index]))(lParam); - } - return 0; - } - } - return DefWindowProc(hWnd, message, wParam, lParam); -} - -static void initializeOffScreenResourceHandleWindow() -{ - if (transferJobWindowHandle) - return; - - WNDCLASSEX wcex; - memset(&wcex, 0, sizeof(WNDCLASSEX)); - wcex.cbSize = sizeof(WNDCLASSEX); - wcex.lpfnWndProc = ResourceHandleWndProc; - wcex.hInstance = WebCore::instanceHandle(); - wcex.lpszClassName = kResourceHandleWindowClassName; - RegisterClassEx(&wcex); - - transferJobWindowHandle = CreateWindow(kResourceHandleWindowClassName, 0, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - HWND_MESSAGE, 0, WebCore::instanceHandle(), 0); -} - class WebCoreSynchronousLoader : public ResourceHandleClient, public Noncopyable { public: WebCoreSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&, const String& userAgent); + ~WebCoreSynchronousLoader(); + + HINTERNET internetHandle() const { return m_internetHandle; } virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived); @@ -152,13 +91,20 @@ private: ResourceError& m_error; ResourceResponse& m_response; Vector<char>& m_data; + HINTERNET m_internetHandle; }; WebCoreSynchronousLoader::WebCoreSynchronousLoader(ResourceError& error, ResourceResponse& response, Vector<char>& data, const String& userAgent) : m_error(error) , m_response(response) , m_data(data) + , m_internetHandle(createInternetHandle(userAgent, false)) +{ +} + +WebCoreSynchronousLoader::~WebCoreSynchronousLoader() { + InternetCloseHandle(m_internetHandle); } void WebCoreSynchronousLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response) @@ -183,107 +129,79 @@ void WebCoreSynchronousLoader::didFail(ResourceHandle*, const ResourceError& err ResourceHandleInternal::~ResourceHandleInternal() { - if (m_fileHandle != INVALID_HANDLE_VALUE) - CloseHandle(m_fileHandle); } ResourceHandle::~ResourceHandle() { - if (d->m_jobId) - removeFromOutstandingJobs(d->m_jobId); } -void ResourceHandle::onHandleCreated(LPARAM lParam) +static void callOnRedirect(void* context) { - if (!d->m_resourceHandle) { - d->m_resourceHandle = HINTERNET(lParam); - if (d->status != 0) { - // We were canceled before Windows actually created a handle for us, close and delete now. - InternetCloseHandle(d->m_resourceHandle); - delete this; - return; - } + ResourceHandle* handle = static_cast<ResourceHandle*>(context); + handle->onRedirect(); +} - if (request().httpMethod() == "POST") { - // FIXME: Too late to set referrer properly. - String urlStr = request().url().path(); - int fragmentIndex = urlStr.find('#'); - if (fragmentIndex != -1) - urlStr = urlStr.left(fragmentIndex); - static LPCSTR accept[2]={"*/*", NULL}; - HINTERNET urlHandle = HttpOpenRequestA(d->m_resourceHandle, - "POST", urlStr.latin1().data(), 0, 0, accept, - INTERNET_FLAG_KEEP_CONNECTION | - INTERNET_FLAG_FORMS_SUBMIT | - INTERNET_FLAG_RELOAD | - INTERNET_FLAG_NO_CACHE_WRITE | - INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | - INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP, - (DWORD_PTR)d->m_jobId); - if (urlHandle == INVALID_HANDLE_VALUE) { - InternetCloseHandle(d->m_resourceHandle); - delete this; - } - } - } else if (!d->m_secondaryHandle) { - assert(request().httpMethod() == "POST"); - d->m_secondaryHandle = HINTERNET(lParam); - - // Need to actually send the request now. - String headers = "Content-Type: application/x-www-form-urlencoded\n"; - headers += "Referer: "; - headers += d->m_postReferrer; - headers += "\n"; - const CString& headersLatin1 = headers.latin1(); - String formData = request().httpBody()->flattenToString(); - INTERNET_BUFFERSA buffers; - memset(&buffers, 0, sizeof(buffers)); - buffers.dwStructSize = sizeof(INTERNET_BUFFERSA); - buffers.lpcszHeader = headersLatin1.data(); - buffers.dwHeadersLength = headers.length(); - buffers.dwBufferTotal = formData.length(); - - d->m_bytesRemainingToWrite = formData.length(); - d->m_formDataString = (char*)malloc(formData.length()); - d->m_formDataLength = formData.length(); - strncpy(d->m_formDataString, formData.latin1().data(), formData.length()); - d->m_writing = true; - HttpSendRequestExA(d->m_secondaryHandle, &buffers, 0, 0, (DWORD_PTR)d->m_jobId); - // FIXME: add proper error handling +static void callOnRequestComplete(void* context) +{ + ResourceHandle* handle = static_cast<ResourceHandle*>(context); + handle->onRequestComplete(); +} + +void ResourceHandle::internetStatusCallback(HINTERNET internetHandle, DWORD_PTR context, DWORD internetStatus, + LPVOID statusInformation, DWORD statusInformationLength) +{ + ResourceHandle* handle = reinterpret_cast<ResourceHandle*>(context); + + switch (internetStatus) { + case INTERNET_STATUS_REDIRECT: + handle->d->m_redirectUrl = String(static_cast<UChar*>(statusInformation), statusInformationLength); + callOnMainThread(callOnRedirect, handle); + break; + + case INTERNET_STATUS_REQUEST_COMPLETE: + callOnMainThread(callOnRequestComplete, handle); + break; + + default: + break; } } -void ResourceHandle::onRequestRedirected(LPARAM lParam) +void ResourceHandle::onRedirect() { - // If already canceled, then ignore this event. - if (d->status != 0) - return; + ResourceRequest newRequest = firstRequest(); + newRequest.setURL(KURL(ParsedURLString, d->m_redirectUrl)); + + ResourceResponse response(firstRequest().url(), String(), 0, String(), String()); - ResourceRequest request((StringImpl*) lParam); - ResourceResponse redirectResponse; - client()->willSendRequest(this, request, redirectResponse); + if (ResourceHandleClient* resourceHandleClient = client()) + resourceHandleClient->willSendRequest(this, newRequest, response); } -void ResourceHandle::onRequestComplete(LPARAM lParam) +bool ResourceHandle::onRequestComplete() { - if (d->m_writing) { + if (!d->m_internetHandle) { // 0 if canceled. + deref(); // balances ref in start + return false; + } + + if (d->m_bytesRemainingToWrite) { DWORD bytesWritten; - InternetWriteFile(d->m_secondaryHandle, - d->m_formDataString + (d->m_formDataLength - d->m_bytesRemainingToWrite), + InternetWriteFile(d->m_requestHandle, + d->m_formData.data() + (d->m_formData.size() - d->m_bytesRemainingToWrite), d->m_bytesRemainingToWrite, &bytesWritten); d->m_bytesRemainingToWrite -= bytesWritten; - if (!d->m_bytesRemainingToWrite) { - // End the request. - d->m_writing = false; - HttpEndRequest(d->m_secondaryHandle, 0, 0, (DWORD_PTR)d->m_jobId); - free(d->m_formDataString); - d->m_formDataString = 0; - } - return; + if (d->m_bytesRemainingToWrite) + return true; + d->m_formData.clear(); } - HINTERNET handle = (request().httpMethod() == "POST") ? d->m_secondaryHandle : d->m_resourceHandle; + if (!d->m_sentEndRequest) { + HttpEndRequestW(d->m_requestHandle, 0, 0, reinterpret_cast<DWORD_PTR>(this)); + d->m_sentEndRequest = true; + return true; + } static const int bufferSize = 32768; char buffer[bufferSize]; @@ -293,9 +211,10 @@ void ResourceHandle::onRequestComplete(LPARAM lParam) buffers.dwBufferLength = bufferSize; BOOL ok = FALSE; - while ((ok = InternetReadFileExA(handle, &buffers, IRF_NO_WAIT, (DWORD_PTR)this)) && buffers.dwBufferLength) { - if (!hasReceivedResponse()) { - setHasReceivedResponse(); + while ((ok = InternetReadFileExA(d->m_requestHandle, &buffers, d->m_loadSynchronously ? 0 : IRF_NO_WAIT, reinterpret_cast<DWORD_PTR>(this))) && buffers.dwBufferLength) { + if (!d->m_hasReceivedResponse) { + d->m_hasReceivedResponse = true; + ResourceResponse response; response.setURL(firstRequest().url()); @@ -317,160 +236,112 @@ void ResourceHandle::onRequestComplete(LPARAM lParam) response.setTextEncodingName(extractCharsetFromMediaType(httpContentType)); } - client()->didReceiveResponse(this, response); + if (ResourceHandleClient* resourceHandleClient = client()) + resourceHandleClient->didReceiveResponse(this, response); } - client()->didReceiveData(this, buffer, buffers.dwBufferLength, 0); + + if (ResourceHandleClient* resourceHandleClient = client()) + resourceHandleClient->didReceiveData(this, buffer, buffers.dwBufferLength, 0); buffers.dwBufferLength = bufferSize; } - PlatformDataStruct platformData; - platformData.errorString = 0; - platformData.error = 0; - platformData.loaded = ok; - - if (!ok) { - int error = GetLastError(); - if (error == ERROR_IO_PENDING) - return; - DWORD errorStringChars = 0; - if (!InternetGetLastResponseInfo(&platformData.error, 0, &errorStringChars)) { - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - platformData.errorString = new TCHAR[errorStringChars]; - InternetGetLastResponseInfo(&platformData.error, platformData.errorString, &errorStringChars); - } - } -#ifdef RESOURCE_LOADER_DEBUG - char buf[64]; - _snprintf(buf, sizeof(buf), "Load error: %i\n", error); - OutputDebugStringA(buf); -#endif - } - - if (d->m_secondaryHandle) - InternetCloseHandle(d->m_secondaryHandle); - InternetCloseHandle(d->m_resourceHandle); + if (!ok && GetLastError() == ERROR_IO_PENDING) + return true; - client()->didFinishLoading(this, 0); - delete this; + if (ResourceHandleClient* resourceHandleClient = client()) + resourceHandleClient->didFinishLoading(this, 0); + + InternetCloseHandle(d->m_requestHandle); + InternetCloseHandle(d->m_connectHandle); + deref(); // balances ref in start + return false; } -static void __stdcall transferJobStatusCallback(HINTERNET internetHandle, - DWORD_PTR jobId, - DWORD internetStatus, - LPVOID statusInformation, - DWORD statusInformationLength) +bool ResourceHandle::start(NetworkingContext* context) { -#ifdef RESOURCE_LOADER_DEBUG - char buf[64]; - _snprintf(buf, sizeof(buf), "status-callback: status=%u, job=%p\n", - internetStatus, jobId); - OutputDebugStringA(buf); -#endif + if (request().url().isLocalFile()) { + ref(); // balanced by deref in fileLoadTimer + if (d->m_loadSynchronously) + fileLoadTimer(0); + else + d->m_fileLoadTimer.startOneShot(0.0); + return true; + } - UINT msg; - LPARAM lParam; + if (!d->m_internetHandle) + d->m_internetHandle = asynchronousInternetHandle(context->userAgent()); - switch (internetStatus) { - case INTERNET_STATUS_HANDLE_CREATED: - // tell the main thread about the newly created handle - msg = handleCreatedMessage; - lParam = (LPARAM) LPINTERNET_ASYNC_RESULT(statusInformation)->dwResult; - break; - case INTERNET_STATUS_REQUEST_COMPLETE: -#ifdef RESOURCE_LOADER_DEBUG - _snprintf(buf, sizeof(buf), "request-complete: result=%p, error=%u\n", - LPINTERNET_ASYNC_RESULT(statusInformation)->dwResult, - LPINTERNET_ASYNC_RESULT(statusInformation)->dwError); - OutputDebugStringA(buf); -#endif - // tell the main thread that the request is done - msg = requestCompleteMessage; - lParam = 0; - break; - case INTERNET_STATUS_REDIRECT: - // tell the main thread to observe this redirect (FIXME: we probably - // need to block the redirect at this point so the application can - // decide whether or not to follow the redirect) - msg = requestRedirectedMessage; - lParam = (LPARAM) StringImpl::create((const UChar*) statusInformation, - statusInformationLength).releaseRef(); - break; - case INTERNET_STATUS_USER_INPUT_REQUIRED: - // FIXME: prompt the user if necessary - ResumeSuspendedDownload(internetHandle, 0); - case INTERNET_STATUS_STATE_CHANGE: - // may need to call ResumeSuspendedDownload here as well - default: - return; + if (!d->m_internetHandle) + return false; + + DWORD flags = INTERNET_FLAG_KEEP_CONNECTION + | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS + | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP; + + d->m_connectHandle = InternetConnectW(d->m_internetHandle, firstRequest().url().host().charactersWithNullTermination(), firstRequest().url().port(), + 0, 0, INTERNET_SERVICE_HTTP, flags, reinterpret_cast<DWORD_PTR>(this)); + + if (!d->m_connectHandle) + return false; + + String urlStr = firstRequest().url().path(); + String urlQuery = firstRequest().url().query(); + + if (!urlQuery.isEmpty()) { + urlStr.append('?'); + urlStr.append(urlQuery); } - PostMessage(transferJobWindowHandle, msg, (WPARAM) jobId, lParam); -} + String httpMethod = firstRequest().httpMethod(); + String httpReferrer = firstRequest().httpReferrer(); -bool ResourceHandle::start(NetworkingContext* context) -{ - ref(); - if (request().url().isLocalFile()) { - d->m_fileLoadTimer.startOneShot(0.0); - return true; - } else { - static HINTERNET internetHandle = 0; - if (!internetHandle) { - String userAgentStr = context->userAgent() + String("", 1); - LPCWSTR userAgent = reinterpret_cast<const WCHAR*>(userAgentStr.characters()); - // leak the Internet for now - internetHandle = InternetOpen(userAgent, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, INTERNET_FLAG_ASYNC); - } - if (!internetHandle) { - delete this; - return false; - } - static INTERNET_STATUS_CALLBACK callbackHandle = - InternetSetStatusCallback(internetHandle, transferJobStatusCallback); - - initializeOffScreenResourceHandleWindow(); - d->m_jobId = addToOutstandingJobs(this); - - DWORD flags = - INTERNET_FLAG_KEEP_CONNECTION | - INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | - INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP; - - // For form posting, we can't use InternetOpenURL. We have to use - // InternetConnect followed by HttpSendRequest. - HINTERNET urlHandle; - String referrer = context->referrer(); - if (request().httpMethod() == "POST") { - d->m_postReferrer = referrer; - String host = request().url().host(); - urlHandle = InternetConnectA(internetHandle, host.latin1().data(), - request().url().port(), - NULL, // no username - NULL, // no password - INTERNET_SERVICE_HTTP, - flags, (DWORD_PTR)d->m_jobId); - } else { - String urlStr = request().url().string(); - int fragmentIndex = urlStr.find('#'); - if (fragmentIndex != -1) - urlStr = urlStr.left(fragmentIndex); - String headers; - if (!referrer.isEmpty()) - headers += String("Referer: ") + referrer + "\r\n"; - - urlHandle = InternetOpenUrlA(internetHandle, urlStr.latin1().data(), - headers.latin1().data(), headers.length(), - flags, (DWORD_PTR)d->m_jobId); - } + LPCWSTR httpAccept[] = { L"*/*", 0 }; - if (urlHandle == INVALID_HANDLE_VALUE) { - delete this; - return false; - } - d->m_threadId = GetCurrentThreadId(); + d->m_requestHandle = HttpOpenRequestW(d->m_connectHandle, httpMethod.charactersWithNullTermination(), urlStr.charactersWithNullTermination(), + 0, httpReferrer.charactersWithNullTermination(), httpAccept, flags, reinterpret_cast<DWORD_PTR>(this)); - return true; + if (!d->m_requestHandle) { + InternetCloseHandle(d->m_connectHandle); + return false; + } + + if (firstRequest().httpBody()) { + firstRequest().httpBody()->flatten(d->m_formData); + d->m_bytesRemainingToWrite = d->m_formData.size(); + } + + Vector<UChar> httpHeaders; + const HTTPHeaderMap& httpHeaderFields = firstRequest().httpHeaderFields(); + + for (HTTPHeaderMap::const_iterator it = httpHeaderFields.begin(); it != httpHeaderFields.end(); ++it) { + if (equalIgnoringCase(it->first, "Accept") || equalIgnoringCase(it->first, "Referer") || equalIgnoringCase(it->first, "User-Agent")) + continue; + + if (!httpHeaders.isEmpty()) + httpHeaders.append('\n'); + + httpHeaders.append(it->first.characters(), it->first.length()); + httpHeaders.append(':'); + httpHeaders.append(it->second.characters(), it->second.length()); } + + INTERNET_BUFFERSW internetBuffers; + ZeroMemory(&internetBuffers, sizeof(internetBuffers)); + internetBuffers.dwStructSize = sizeof(internetBuffers); + internetBuffers.lpcszHeader = httpHeaders.data(); + internetBuffers.dwHeadersLength = httpHeaders.size(); + internetBuffers.dwBufferTotal = d->m_bytesRemainingToWrite; + + HttpSendRequestExW(d->m_requestHandle, &internetBuffers, 0, 0, reinterpret_cast<DWORD_PTR>(this)); + + ref(); // balanced by deref in onRequestComplete + + if (d->m_loadSynchronously) + while (onRequestComplete()) { + // Loop until finished. + } + + return true; } void ResourceHandle::fileLoadTimer(Timer<ResourceHandle>*) @@ -517,37 +388,29 @@ void ResourceHandle::fileLoadTimer(Timer<ResourceHandle>*) void ResourceHandle::cancel() { - if (d->m_resourceHandle) - InternetCloseHandle(d->m_resourceHandle); - else + if (d->m_requestHandle) { + d->m_internetHandle = 0; + InternetCloseHandle(d->m_requestHandle); + InternetCloseHandle(d->m_connectHandle); + } else d->m_fileLoadTimer.stop(); - - client()->didFinishLoading(this, 0); - - if (!d->m_resourceHandle) - // Async load canceled before we have a handle -- mark ourselves as in error, to be deleted later. - // FIXME: need real cancel error - client()->didFail(this, ResourceError()); } -void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame) +void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data) { UNUSED_PARAM(storedCredentials); WebCoreSynchronousLoader syncLoader(error, response, data, request.httpUserAgent()); ResourceHandle handle(request, &syncLoader, true, false); - handle.start(frame); -} - -void ResourceHandle::setHasReceivedResponse(bool b) -{ - d->m_hasReceivedResponse = b; + handle.setSynchronousInternetHandle(syncLoader.internetHandle()); + handle.start(context); } -bool ResourceHandle::hasReceivedResponse() const +void ResourceHandle::setSynchronousInternetHandle(HINTERNET internetHandle) { - return d->m_hasReceivedResponse; + d->m_internetHandle = internetHandle; + d->m_loadSynchronously = true; } bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*) diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp index 6cbde0c..90e3bfe 100644 --- a/WebCore/platform/qt/ClipboardQt.cpp +++ b/WebCore/platform/qt/ClipboardQt.cpp @@ -75,15 +75,15 @@ PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* } ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, const QMimeData* readableClipboard) - : Clipboard(policy, true) + : Clipboard(policy, DragAndDrop) , m_readableData(readableClipboard) , m_writableData(0) { Q_ASSERT(policy == ClipboardReadable || policy == ClipboardTypesReadable); } -ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, bool forDragging) - : Clipboard(policy, forDragging) +ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(policy, clipboardType) , m_readableData(0) , m_writableData(0) { @@ -91,7 +91,7 @@ ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, bool forDragging) #ifndef QT_NO_CLIPBOARD if (policy != ClipboardWritable) { - Q_ASSERT(!forDragging); + Q_ASSERT(isForCopyAndPaste()); m_readableData = QApplication::clipboard()->mimeData(); } #endif @@ -99,7 +99,7 @@ ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, bool forDragging) ClipboardQt::~ClipboardQt() { - if (m_writableData && !isForDragging()) + if (m_writableData && isForCopyAndPaste()) m_writableData = 0; else delete m_writableData; @@ -114,13 +114,13 @@ void ClipboardQt::clearData(const String& type) if (m_writableData) { m_writableData->removeFormat(type); if (m_writableData->formats().isEmpty()) { - if (isForDragging()) + if (isForDragAndDrop()) delete m_writableData; m_writableData = 0; } } #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(m_writableData); #endif } @@ -131,7 +131,7 @@ void ClipboardQt::clearAllData() return; #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(0); else #endif @@ -182,7 +182,7 @@ bool ClipboardQt::setData(const String& type, const String& data) } #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(m_writableData); #endif return true; @@ -287,7 +287,7 @@ void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, co m_writableData->setText(title); m_writableData->setUrls(urls); #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(m_writableData); #endif } @@ -303,7 +303,7 @@ void ClipboardQt::writeURL(const KURL& url, const String& title, Frame* frame) m_writableData->setUrls(urls); m_writableData->setText(title); #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(m_writableData); #endif } @@ -320,7 +320,7 @@ void ClipboardQt::writeRange(Range* range, Frame* frame) m_writableData->setText(text); m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange, false, AbsoluteURLs)); #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(m_writableData); #endif } @@ -333,7 +333,7 @@ void ClipboardQt::writePlainText(const String& str) text.replace(QChar(0xa0), QLatin1Char(' ')); m_writableData->setText(text); #ifndef QT_NO_CLIPBOARD - if (!isForDragging()) + if (isForCopyAndPaste()) QApplication::clipboard()->setMimeData(m_writableData); #endif } diff --git a/WebCore/platform/qt/ClipboardQt.h b/WebCore/platform/qt/ClipboardQt.h index 9b54d5f..5aca1a6 100644 --- a/WebCore/platform/qt/ClipboardQt.h +++ b/WebCore/platform/qt/ClipboardQt.h @@ -44,9 +44,9 @@ namespace WebCore { { return adoptRef(new ClipboardQt(policy, readableClipboard)); } - static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, bool forDragging = false) + static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, ClipboardType clipboardType = CopyAndPaste) { - return adoptRef(new ClipboardQt(policy, forDragging)); + return adoptRef(new ClipboardQt(policy, clipboardType)); } virtual ~ClipboardQt(); @@ -77,7 +77,7 @@ namespace WebCore { ClipboardQt(ClipboardAccessPolicy, const QMimeData* readableClipboard); // Clipboard is writable so it will create its own QMimeData object - ClipboardQt(ClipboardAccessPolicy, bool forDragging); + ClipboardQt(ClipboardAccessPolicy, ClipboardType); void setDragImage(CachedImage*, Node*, const IntPoint& loc); diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h index a0a0218..9301cd5 100644 --- a/WebCore/platform/qt/QWebPageClient.h +++ b/WebCore/platform/qt/QWebPageClient.h @@ -58,9 +58,7 @@ public: virtual bool allowsAcceleratedCompositing() const { return false; } #endif -#if QT_VERSION >= 0x040600 virtual void setInputMethodHints(Qt::InputMethodHints hint) = 0; -#endif #ifndef QT_NO_CURSOR inline void resetCursor() diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp index 4a461ac..7388b76 100644 --- a/WebCore/platform/qt/RenderThemeQt.cpp +++ b/WebCore/platform/qt/RenderThemeQt.cpp @@ -219,7 +219,7 @@ String RenderThemeQt::extraDefaultStyleSheet() result += String(themeQtNoListboxesUserAgentStyleSheet, sizeof(themeQtNoListboxesUserAgentStyleSheet)); #endif #if USE(QT_MOBILE_THEME) - result += String(themeQtMaemo5UserAgentStyleSheet, sizeof(themeQtMaemo5UserAgentStyleSheet)); + result += String(themeQtMobileUserAgentStyleSheet, sizeof(themeQtMobileUserAgentStyleSheet)); #endif return result; } diff --git a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp index 51e25b8..15933e8 100644 --- a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp +++ b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp @@ -87,6 +87,19 @@ bool PluginDatabase::isPreferredPluginDirectory(const String& directory) notImplemented(); return false; } + +void PluginView::privateBrowsingStateChanged(bool) +{ +} + +PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance() +{ + return 0; +} + +void PluginView::setJavaScriptPaused(bool) +{ +} #endif namespace WebCore { diff --git a/WebCore/platform/sql/SQLiteFileSystem.cpp b/WebCore/platform/sql/SQLiteFileSystem.cpp index c9583eb..d487b95 100644 --- a/WebCore/platform/sql/SQLiteFileSystem.cpp +++ b/WebCore/platform/sql/SQLiteFileSystem.cpp @@ -28,12 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define __STDC_FORMAT_MACROS #include "config.h" #include "SQLiteFileSystem.h" #include "FileSystem.h" #include "SQLiteDatabase.h" #include "SQLiteStatement.h" +#include <inttypes.h> #include <sqlite3.h> namespace WebCore { @@ -73,10 +75,10 @@ String SQLiteFileSystem::getFileNameForNewDatabase(const String& dbDir, const St String fileName; do { ++seq; - fileName = pathByAppendingComponent(dbDir, String::format("%016llx.db", seq)); + fileName = pathByAppendingComponent(dbDir, String::format("%016"PRIx64".db", seq)); } while (fileExists(fileName)); - return String::format("%016llx.db", seq); + return String::format("%016"PRIx64".db", seq); } String SQLiteFileSystem::appendDatabaseFileNameToPath(const String& path, const String& fileName) diff --git a/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp b/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp index 6549936..1102df5 100644 --- a/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp +++ b/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp @@ -34,23 +34,938 @@ #include "ChromiumBridge.h" #include <sqlite3.h> +#include <errno.h> #include <fcntl.h> #include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/types.h> #include <unistd.h> using namespace WebCore; -// Defined in Chromium's codebase in third_party/sqlite/src/os_unix.c -extern "C" { -void chromium_sqlite3_initialize_unix_sqlite3_file(sqlite3_file* file); -int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* vfs, int fd, int dirfd, sqlite3_file* file, const char* fileName, int noLock); -int chromium_sqlite3_get_reusable_file_handle(sqlite3_file* file, const char* fileName, int flags, int* fd); -void chromium_sqlite3_update_reusable_file_handle(sqlite3_file* file, int fd, int flags); -void chromium_sqlite3_destroy_reusable_file_handle(sqlite3_file* file); +// Chromium's Posix implementation of SQLite VFS. +// This is heavily based on SQLite's os_unix.c, +// without parts we don't need. + +// Identifies a file by its device number and inode. +struct ChromiumFileId { + dev_t dev; // Device number. + ino_t ino; // Inode number. +}; + +// Information about file locks (one per open inode). Note that many open +// file descriptors may refer to the same inode. +struct ChromiumLockInfo { + ChromiumFileId lockKey; // File identifier. + int cnt; // Number of shared locks held. + int locktype; // Type of the lock. + int nRef; // Reference count. + + // Double-linked list pointers. + ChromiumLockInfo* pNext; + ChromiumLockInfo* pPrev; +}; + +// Information about a file descriptor that cannot be closed immediately. +struct ChromiumUnusedFd { + int fd; // File descriptor. + int flags; // Flags this file descriptor was opened with. + ChromiumUnusedFd* pNext; // Next unused file descriptor on the same file. +}; + +// Information about an open inode. When we want to close an inode +// that still has locks, we defer the close until all locks are cleared. +struct ChromiumOpenInfo { + ChromiumFileId fileId; // The lookup key. + int nRef; // Reference count. + int nLock; // Number of outstanding locks. + ChromiumUnusedFd* pUnused; // List of file descriptors to close. + + // Double-linked list pointers. + ChromiumOpenInfo* pNext; + ChromiumOpenInfo* pPrev; +}; + +// Keep track of locks and inodes in double-linked lists. +static struct ChromiumLockInfo* lockList = 0; +static struct ChromiumOpenInfo* openList = 0; + +// Extension of sqlite3_file specific to the chromium VFS. +struct ChromiumFile { + sqlite3_io_methods const* pMethod; // Implementation of sqlite3_file. + ChromiumOpenInfo* pOpen; // Information about all open file descriptors for this file. + ChromiumLockInfo* pLock; // Information about all locks for this file. + int h; // File descriptor. + int dirfd; // File descriptor for the file directory. + unsigned char locktype; // Type of the lock used for this file. + int lastErrno; // Value of errno for last operation on this file. + ChromiumUnusedFd* pUnused; // Information about unused file descriptors for this file. +}; + +// The following constants specify the range of bytes used for locking. +// SQLiteSharedSize is the number of bytes available in the pool from which +// a random byte is selected for a shared lock. The pool of bytes for +// shared locks begins at SQLiteSharedFirstByte. +// The values are the same as used by SQLite for compatibility. +static const off_t SQLitePendingByte = 0x40000000; +static const off_t SQLiteReservedByte = SQLitePendingByte + 1; +static const off_t SQLiteSharedFirstByte = SQLitePendingByte + 2; +static const off_t SQLiteSharedSize = 510; + +// Maps a POSIX error code to an SQLite error code. +static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) +{ + switch (posixError) { + case 0: + return SQLITE_OK; + case EAGAIN: + case ETIMEDOUT: + case EBUSY: + case EINTR: + case ENOLCK: + return SQLITE_BUSY; + case EACCES: + // EACCES is like EAGAIN during locking operations. + if ((sqliteIOErr == SQLITE_IOERR_LOCK) || + (sqliteIOErr == SQLITE_IOERR_UNLOCK) || + (sqliteIOErr == SQLITE_IOERR_RDLOCK) || + (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK)) + return SQLITE_BUSY; + return SQLITE_PERM; + case EPERM: + return SQLITE_PERM; + case EDEADLK: + return SQLITE_IOERR_BLOCKED; + default: + return sqliteIOErr; + } +} + +// Releases a ChromiumLockInfo structure previously allocated by findLockInfo(). +static void releaseLockInfo(ChromiumLockInfo* pLock) +{ + if (!pLock) + return; + + pLock->nRef--; + if (pLock->nRef > 0) + return; + + if (pLock->pPrev) { + ASSERT(pLock->pPrev->pNext == pLock); + pLock->pPrev->pNext = pLock->pNext; + } else { + ASSERT(lockList == pLock); + lockList = pLock->pNext; + } + if (pLock->pNext) { + ASSERT(pLock->pNext->pPrev == pLock); + pLock->pNext->pPrev = pLock->pPrev; + } + + sqlite3_free(pLock); +} + +// Releases a ChromiumOpenInfo structure previously allocated by findLockInfo(). +static void releaseOpenInfo(ChromiumOpenInfo* pOpen) +{ + if (!pOpen) + return; + + pOpen->nRef--; + if (pOpen->nRef > 0) + return; + + if (pOpen->pPrev) { + ASSERT(pOpen->pPrev->pNext == pOpen); + pOpen->pPrev->pNext = pOpen->pNext; + } else { + ASSERT(openList == pOpen); + openList = pOpen->pNext; + } + if (pOpen->pNext) { + ASSERT(pOpen->pNext->pPrev == pOpen); + pOpen->pNext->pPrev = pOpen->pPrev; + } + + ASSERT(!pOpen->pUnused); // Make sure we're not leaking memory and file descriptors. + + sqlite3_free(pOpen); +} + +// Locates ChromiumLockInfo and ChromiumOpenInfo for given file descriptor (creating new ones if needed). +// Returns a SQLite error code. +static int findLockInfo(ChromiumFile* pFile, ChromiumLockInfo** ppLock, ChromiumOpenInfo** ppOpen) +{ + int fd = pFile->h; + struct stat statbuf; + int rc = fstat(fd, &statbuf); + if (rc) { + pFile->lastErrno = errno; +#ifdef EOVERFLOW + if (pFile->lastErrno == EOVERFLOW) + return SQLITE_NOLFS; +#endif + return SQLITE_IOERR; + } + +#if OS(DARWIN) + // On OS X on an msdos/fat filesystems, the inode number is reported + // incorrectly for zero-size files. See http://www.sqlite.org/cvstrac/tktview?tn=3260. + // To work around this problem we always increase the file size to 1 by writing a single byte + // prior to accessing the inode number. The one byte written is an ASCII 'S' character which + // also happens to be the first byte in the header of every SQLite database. In this way, + // if there is a race condition such that another thread has already populated the first page + // of the database, no damage is done. + if (!statbuf.st_size) { + rc = write(fd, "S", 1); + if (rc != 1) + return SQLITE_IOERR; + rc = fstat(fd, &statbuf); + if (rc) { + pFile->lastErrno = errno; + return SQLITE_IOERR; + } + } +#endif + + ChromiumFileId fileId; + memset(&fileId, 0, sizeof(fileId)); + fileId.dev = statbuf.st_dev; + fileId.ino = statbuf.st_ino; + + ChromiumLockInfo* pLock = 0; + + if (ppLock) { + pLock = lockList; + while (pLock && memcmp(&fileId, &pLock->lockKey, sizeof(fileId))) + pLock = pLock->pNext; + if (pLock) + pLock->nRef++; + else { + pLock = static_cast<ChromiumLockInfo*>(sqlite3_malloc(sizeof(*pLock))); + if (!pLock) + return SQLITE_NOMEM; + pLock->lockKey = fileId; + pLock->nRef = 1; + pLock->cnt = 0; + pLock->locktype = 0; + pLock->pNext = lockList; + pLock->pPrev = 0; + if (lockList) + lockList->pPrev = pLock; + lockList = pLock; + } + *ppLock = pLock; + } + + if (ppOpen) { + ChromiumOpenInfo* pOpen = openList; + while (pOpen && memcmp(&fileId, &pOpen->fileId, sizeof(fileId))) + pOpen = pOpen->pNext; + if (pOpen) + pOpen->nRef++; + else { + pOpen = static_cast<ChromiumOpenInfo*>(sqlite3_malloc(sizeof(*pOpen))); + if (!pOpen) { + releaseLockInfo(pLock); + return SQLITE_NOMEM; + } + memset(pOpen, 0, sizeof(*pOpen)); + pOpen->fileId = fileId; + pOpen->nRef = 1; + pOpen->pNext = openList; + if (openList) + openList->pPrev = pOpen; + openList = pOpen; + } + *ppOpen = pOpen; + } + + return rc; +} + +// Checks if there is a RESERVED lock held on the specified file by this or any other process. +// If the lock is held, sets pResOut to a non-zero value. Returns a SQLite error code. +static int chromiumCheckReservedLock(sqlite3_file* id, int* pResOut) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + // Look for locks held by this process. + int reserved = 0; + if (pFile->pLock->locktype > SQLITE_LOCK_SHARED) + reserved = 1; + + // Look for locks held by other processes. + int rc = SQLITE_OK; + if (!reserved) { + struct flock lock; + lock.l_whence = SEEK_SET; + lock.l_start = SQLiteReservedByte; + lock.l_len = 1; + lock.l_type = F_WRLCK; + if (-1 == fcntl(pFile->h, F_GETLK, &lock)) { + int tErrno = errno; + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_CHECKRESERVEDLOCK); + pFile->lastErrno = tErrno; + } else if (lock.l_type != F_UNLCK) + reserved = 1; + } + + *pResOut = reserved; + return rc; +} + +// Performs a file locking operation on a range of bytes in a file. +// The |op| parameter should be one of F_RFLCK, F_WRLCK or F_UNLCK. +// Returns a Unix error code, and also writes it to pErrcode. +static int rangeLock(ChromiumFile* pFile, int op, int* pErrcode) +{ + struct flock lock; + lock.l_type = op; + lock.l_start = SQLiteSharedFirstByte; + lock.l_whence = SEEK_SET; + lock.l_len = SQLiteSharedSize; + int rc = fcntl(pFile->h, F_SETLK, &lock); + *pErrcode = errno; + return rc; +} + +// Locks the file with the lock specified by parameter locktype - one +// of the following: +// +// (1) SQLITE_LOCK_SHARED +// (2) SQLITE_LOCK_RESERVED +// (3) SQLITE_LOCK_PENDING +// (4) SQLITE_LOCK_EXCLUSIVE +// +// Sometimes when requesting one lock state, additional lock states +// are inserted in between. The locking might fail on one of the later +// transitions leaving the lock state different from what it started but +// still short of its goal. The following chart shows the allowed +// transitions and the inserted intermediate states: +// +// UNLOCKED -> SHARED +// SHARED -> RESERVED +// SHARED -> (PENDING) -> EXCLUSIVE +// RESERVED -> (PENDING) -> EXCLUSIVE +// PENDING -> EXCLUSIVE +static int chromiumLock(sqlite3_file* id, int locktype) +{ + // To obtain a SHARED lock, a read-lock is obtained on the 'pending + // byte'. If this is successful, a random byte from the 'shared byte + // range' is read-locked and the lock on the 'pending byte' released. + // + // A process may only obtain a RESERVED lock after it has a SHARED lock. + // A RESERVED lock is implemented by grabbing a write-lock on the + // 'reserved byte'. + // + // A process may only obtain a PENDING lock after it has obtained a + // SHARED lock. A PENDING lock is implemented by obtaining a write-lock + // on the 'pending byte'. This ensures that no new SHARED locks can be + // obtained, but existing SHARED locks are allowed to persist. A process + // does not have to obtain a RESERVED lock on the way to a PENDING lock. + // This property is used by the algorithm for rolling back a journal file + // after a crash. + // + // An EXCLUSIVE lock, obtained after a PENDING lock is held, is + // implemented by obtaining a write-lock on the entire 'shared byte + // range'. Since all other locks require a read-lock on one of the bytes + // within this range, this ensures that no other locks are held on the + // database. + + int rc = SQLITE_OK; + struct flock lock; + int s = 0; + int tErrno; + + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + ChromiumLockInfo* pLock = pFile->pLock; + + // If there is already a lock of this type or more restrictive, do nothing. + if (pFile->locktype >= locktype) + return SQLITE_OK; + + // Make sure we never move from unlocked to anything higher than shared lock. + ASSERT(pFile->locktype != SQLITE_LOCK_NONE || locktype == SQLITE_LOCK_SHARED); + + // Make sure we never request a pending lock. + ASSERT(locktype != SQLITE_LOCK_PENDING); + + // Make sure a shared lock is always held when a RESERVED lock is requested. + ASSERT(locktype != SQLITE_LOCK_RESERVED || pFile->locktype == SQLITE_LOCK_SHARED); + + // If some thread using this PID has a lock via a different ChromiumFile + // handle that precludes the requested lock, return BUSY. + if (pFile->locktype != pLock->locktype && + (pLock->locktype >= SQLITE_LOCK_PENDING || locktype > SQLITE_LOCK_SHARED)) + return SQLITE_BUSY; + + // If a SHARED lock is requested, and some thread using this PID already + // has a SHARED or RESERVED lock, then just increment reference counts. + if (locktype == SQLITE_LOCK_SHARED && + (pLock->locktype == SQLITE_LOCK_SHARED || pLock->locktype == SQLITE_LOCK_RESERVED)) { + ASSERT(!pFile->locktype); + ASSERT(pLock->cnt > 0); + pFile->locktype = SQLITE_LOCK_SHARED; + pLock->cnt++; + pFile->pOpen->nLock++; + return SQLITE_OK; + } + + // A PENDING lock is needed before acquiring a SHARED lock and before + // acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will + // be released. + lock.l_len = 1; + lock.l_whence = SEEK_SET; + if (locktype == SQLITE_LOCK_SHARED || + (locktype == SQLITE_LOCK_EXCLUSIVE && pFile->locktype < SQLITE_LOCK_PENDING)) { + lock.l_type = (locktype == SQLITE_LOCK_SHARED ? F_RDLCK : F_WRLCK); + lock.l_start = SQLitePendingByte; + s = fcntl(pFile->h, F_SETLK, &lock); + if (s == -1) { + tErrno = errno; + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + return rc; + } + } + + if (locktype == SQLITE_LOCK_SHARED) { + ASSERT(!pLock->cnt); + ASSERT(!pLock->locktype); + + s = rangeLock(pFile, F_RDLCK, &tErrno); + + // Drop the temporary PENDING lock. + lock.l_start = SQLitePendingByte; + lock.l_len = 1; + lock.l_type = F_UNLCK; + if (fcntl(pFile->h, F_SETLK, &lock)) { + if (s != -1) { + tErrno = errno; + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + return rc; + } + } + if (s == -1) { + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + } else { + pFile->locktype = SQLITE_LOCK_SHARED; + pFile->pOpen->nLock++; + pLock->cnt = 1; + } + } else if (locktype == SQLITE_LOCK_EXCLUSIVE && pLock->cnt > 1) { + // We are trying for an exclusive lock but another thread in the + // same process is still holding a shared lock. + rc = SQLITE_BUSY; + } else { + // The request was for a RESERVED or EXCLUSIVE lock. It is + // assumed that there is a SHARED or greater lock on the file + // already. + ASSERT(pFile->locktype); + lock.l_type = F_WRLCK; + switch (locktype) { + case SQLITE_LOCK_RESERVED: + lock.l_start = SQLiteReservedByte; + s = fcntl(pFile->h, F_SETLK, &lock); + tErrno = errno; + break; + case SQLITE_LOCK_EXCLUSIVE: + s = rangeLock(pFile, F_WRLCK, &tErrno); + break; + default: + ASSERT_NOT_REACHED(); + } + if (s == -1) { + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + } + } + + if (rc == SQLITE_OK) { + pFile->locktype = locktype; + pLock->locktype = locktype; + } else if (locktype == SQLITE_LOCK_EXCLUSIVE) { + pFile->locktype = SQLITE_LOCK_PENDING; + pLock->locktype = SQLITE_LOCK_PENDING; + } + + return rc; +} + +// Closes all file descriptors for given ChromiumFile for which the close has been deferred. +// Returns a SQLite error code. +static int closePendingFds(ChromiumFile* pFile) +{ + int rc = SQLITE_OK; + ChromiumOpenInfo* pOpen = pFile->pOpen; + ChromiumUnusedFd* pError = 0; + ChromiumUnusedFd* pNext; + for (ChromiumUnusedFd* p = pOpen->pUnused; p; p = pNext) { + pNext = p->pNext; + if (close(p->fd)) { + pFile->lastErrno = errno; + rc = SQLITE_IOERR_CLOSE; + p->pNext = pError; + pError = p; + } else + sqlite3_free(p); + } + pOpen->pUnused = pError; + return rc; +} + +// Lowers the locking level on file descriptor. +// locktype must be either SQLITE_LOCK_NONE or SQLITE_LOCK_SHARED. +static int chromiumUnlock(sqlite3_file* id, int locktype) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + ASSERT(locktype <= SQLITE_LOCK_SHARED); + + if (pFile->locktype <= locktype) + return SQLITE_OK; + + ChromiumLockInfo* pLock = pFile->pLock; + ASSERT(pLock->cnt); + + struct flock lock; + int rc = SQLITE_OK; + int h = pFile->h; + int tErrno; + + if (pFile->locktype > SQLITE_LOCK_SHARED) { + ASSERT(pLock->locktype == pFile->locktype); + + if (locktype == SQLITE_LOCK_SHARED && rangeLock(pFile, F_RDLCK, &tErrno) == -1) { + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + if (rc == SQLITE_OK) + pFile->locktype = locktype; + return rc; + } + lock.l_type = F_UNLCK; + lock.l_whence = SEEK_SET; + lock.l_start = SQLitePendingByte; + lock.l_len = 2; + if (fcntl(h, F_SETLK, &lock) != -1) + pLock->locktype = SQLITE_LOCK_SHARED; + else { + tErrno = errno; + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + if (rc == SQLITE_OK) + pFile->locktype = locktype; + return rc; + } + } + if (locktype == SQLITE_LOCK_NONE) { + struct ChromiumOpenInfo *pOpen; + + pLock->cnt--; + + // Release the lock using an OS call only when all threads in this same process have released the lock. + if (!pLock->cnt) { + lock.l_type = F_UNLCK; + lock.l_whence = SEEK_SET; + lock.l_start = lock.l_len = 0L; + if (fcntl(h, F_SETLK, &lock) != -1) + pLock->locktype = SQLITE_LOCK_NONE; + else { + tErrno = errno; + rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); + if ((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) + pFile->lastErrno = tErrno; + pLock->locktype = SQLITE_LOCK_NONE; + pFile->locktype = SQLITE_LOCK_NONE; + } + } + + pOpen = pFile->pOpen; + pOpen->nLock--; + ASSERT(pOpen->nLock >= 0); + if (!pOpen->nLock) { + int rc2 = closePendingFds(pFile); + if (rc == SQLITE_OK) + rc = rc2; + } + } + + if (rc == SQLITE_OK) + pFile->locktype = locktype; + return rc; } -// Chromium's Posix implementation of SQLite VFS -namespace { +// Closes all file handles for given ChromiumFile and sets all its fields to 0. +// Returns a SQLite error code. +static int chromiumCloseNoLock(sqlite3_file* id) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + if (!pFile) + return SQLITE_OK; + if (pFile->dirfd >= 0) { + if (close(pFile->dirfd)) { + pFile->lastErrno = errno; + return SQLITE_IOERR_DIR_CLOSE; + } + pFile->dirfd = -1; + } + if (pFile->h >= 0 && close(pFile->h)) { + pFile->lastErrno = errno; + return SQLITE_IOERR_CLOSE; + } + sqlite3_free(pFile->pUnused); + memset(pFile, 0, sizeof(ChromiumFile)); + return SQLITE_OK; +} + +// Closes a ChromiumFile, including locking operations. Returns a SQLite error code. +static int chromiumClose(sqlite3_file* id) +{ + if (!id) + return SQLITE_OK; + + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + chromiumUnlock(id, SQLITE_LOCK_NONE); + if (pFile->pOpen && pFile->pOpen->nLock) { + // If there are outstanding locks, do not actually close the file just + // yet because that would clear those locks. + ChromiumOpenInfo* pOpen = pFile->pOpen; + ChromiumUnusedFd* p = pFile->pUnused; + p->pNext = pOpen->pUnused; + pOpen->pUnused = p; + pFile->h = -1; + pFile->pUnused = 0; + } + releaseLockInfo(pFile->pLock); + releaseOpenInfo(pFile->pOpen); + return chromiumCloseNoLock(id); +} + +static int chromiumCheckReservedLockNoop(sqlite3_file*, int* pResOut) +{ + *pResOut = 0; + return SQLITE_OK; +} + +static int chromiumLockNoop(sqlite3_file*, int) +{ + return SQLITE_OK; +} + +static int chromiumUnlockNoop(sqlite3_file*, int) +{ + return SQLITE_OK; +} + +// Seeks to the requested offset and reads up to |cnt| bytes into |pBuf|. Returns number of bytes actually read. +static int seekAndRead(ChromiumFile* id, sqlite3_int64 offset, void* pBuf, int cnt) +{ + sqlite_int64 newOffset = lseek(id->h, offset, SEEK_SET); + if (newOffset != offset) { + id->lastErrno = (newOffset == -1) ? errno : 0; + return -1; + } + int got = read(id->h, pBuf, cnt); + if (got < 0) + id->lastErrno = errno; + return got; +} + +// Reads data from file into a buffer. Returns a SQLite error code. +static int chromiumRead(sqlite3_file* id, void* pBuf, int amt, sqlite3_int64 offset) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + // The bytes in the locking range should never be read. + ASSERT(!pFile->pUnused || offset >= SQLitePendingByte + 512 || offset + amt <= SQLitePendingByte); + + int got = seekAndRead(pFile, offset, pBuf, amt); + if (got == amt) + return SQLITE_OK; + + if (got < 0) + return SQLITE_IOERR_READ; + + // Unread parts of the buffer must be zero-filled. + memset(&(reinterpret_cast<char*>(pBuf))[got], 0, amt - got); + pFile->lastErrno = 0; + return SQLITE_IOERR_SHORT_READ; +} + +// Seeks to the requested offset and writes up to |cnt| bytes. Returns number of bytes actually written. +static int seekAndWrite(ChromiumFile* id, sqlite_int64 offset, const void* pBuf, int cnt) +{ + sqlite_int64 newOffset = lseek(id->h, offset, SEEK_SET); + if (newOffset != offset) { + id->lastErrno = (newOffset == -1) ? errno : 0; + return -1; + } + int got = write(id->h, pBuf, cnt); + if (got < 0) + id->lastErrno = errno; + return got; +} + +// Writes data from buffer into a file. Returns a SQLite error code. +static int chromiumWrite(sqlite3_file* id, const void* pBuf, int amt, sqlite3_int64 offset) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + ASSERT(amt > 0); + + // The bytes in the locking range should never be written. + ASSERT(!pFile->pUnused || offset >= SQLitePendingByte + 512 || offset + amt <= SQLitePendingByte); + + int wrote = 0; + while (amt > 0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt)) > 0) { + amt -= wrote; + offset += wrote; + pBuf = &(reinterpret_cast<const char*>(pBuf))[wrote]; + } + if (amt > 0) { + if (wrote < 0) + return SQLITE_IOERR_WRITE; + pFile->lastErrno = 0; + return SQLITE_FULL; + } + return SQLITE_OK; +} + +static bool syncWrapper(int fd, bool fullSync) +{ +#if OS(DARWIN) + bool success = false; + if (fullSync) + success = !fcntl(fd, F_FULLFSYNC, 0); + if (!success) + success = !fsync(fd); + return success; +#else + return !fdatasync(fd); +#endif +} + +// Makes sure all writes to a particular file are committed to disk. Returns a SQLite error code. +static int chromiumSync(sqlite3_file* id, int flags) +{ + ASSERT((flags & 0x0F) == SQLITE_SYNC_NORMAL || (flags & 0x0F) == SQLITE_SYNC_FULL); + + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + bool isFullSync = ((flags & 0x0F) == SQLITE_SYNC_FULL); + + if (!syncWrapper(pFile->h, isFullSync)) { + pFile->lastErrno = errno; + return SQLITE_IOERR_FSYNC; + } + + if (pFile->dirfd >= 0) { +#if !OS(DARWIN) + if (!isFullSync) { + // Ignore directory sync failures, see http://www.sqlite.org/cvstrac/tktview?tn=1657. + syncWrapper(pFile->dirfd, false); + } +#endif + if (!close(pFile->dirfd)) + pFile->dirfd = -1; + else { + pFile->lastErrno = errno; + return SQLITE_IOERR_DIR_CLOSE; + } + } + + return SQLITE_OK; +} + +// Truncates an open file to the specified size. Returns a SQLite error code. +static int chromiumTruncate(sqlite3_file* id, sqlite_int64 nByte) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + if (ftruncate(pFile->h, nByte)) { + pFile->lastErrno = errno; + return SQLITE_IOERR_TRUNCATE; + } + + return SQLITE_OK; +} + +// Determines the size of a file in bytes. Returns a SQLite error code. +static int chromiumFileSize(sqlite3_file* id, sqlite_int64* pSize) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + struct stat buf; + if (fstat(pFile->h, &buf)) { + pFile->lastErrno = errno; + return SQLITE_IOERR_FSTAT; + } + *pSize = buf.st_size; + + // When opening a zero-size database, findLockInfo writes a single byte into that file + // in order to work around a bug in the OS X msdos filesystem. In order to avoid problems + // with upper layers, we need to report this file size as zero even though it is really 1. + // See http://www.sqlite.org/cvstrac/tktview?tn=3260. + if (*pSize == 1) + *pSize = 0; + + return SQLITE_OK; +} + +static int chromiumFileControl(sqlite3_file* id, int op, void* pArg) +{ + ChromiumFile* pFile = reinterpret_cast<ChromiumFile*>(id); + ASSERT(pFile); + + switch (op) { + case SQLITE_FCNTL_LOCKSTATE: + *reinterpret_cast<int*>(pArg) = pFile->locktype; + return SQLITE_OK; + case SQLITE_LAST_ERRNO: + *reinterpret_cast<int*>(pArg) = pFile->lastErrno; + return SQLITE_OK; + } + return SQLITE_ERROR; +} + +// Same as SQLITE_DEFAULT_SECTOR_SIZE from sqlite's os.h. +static const int SQLiteDefaultSectorSize = 512; + +static int chromiumSectorSize(sqlite3_file*) +{ + return SQLiteDefaultSectorSize; +} + +static int chromiumDeviceCharacteristics(sqlite3_file*) +{ + return 0; +} + +static const sqlite3_io_methods posixIoMethods = { + 1, + chromiumClose, + chromiumRead, + chromiumWrite, + chromiumTruncate, + chromiumSync, + chromiumFileSize, + chromiumLock, + chromiumUnlock, + chromiumCheckReservedLock, + chromiumFileControl, + chromiumSectorSize, + chromiumDeviceCharacteristics +}; + +static const sqlite3_io_methods nolockIoMethods = { + 1, + chromiumCloseNoLock, + chromiumRead, + chromiumWrite, + chromiumTruncate, + chromiumSync, + chromiumFileSize, + chromiumLockNoop, + chromiumUnlockNoop, + chromiumCheckReservedLockNoop, + chromiumFileControl, + chromiumSectorSize, + chromiumDeviceCharacteristics +}; + +// Initializes a ChromiumFile. Returns a SQLite error code. +static int fillInChromiumFile(sqlite3_vfs* pVfs, int h, int dirfd, sqlite3_file* pId, const char* zFilename, int noLock) +{ + ChromiumFile* pNew = reinterpret_cast<ChromiumFile*>(pId); + + ASSERT(!pNew->pLock); + ASSERT(!pNew->pOpen); + + pNew->h = h; + pNew->dirfd = dirfd; + + int rc = SQLITE_OK; + const sqlite3_io_methods* pLockingStyle; + if (noLock) + pLockingStyle = &nolockIoMethods; + else { + pLockingStyle = &posixIoMethods; + rc = findLockInfo(pNew, &pNew->pLock, &pNew->pOpen); + if (rc != SQLITE_OK) { + // If an error occured in findLockInfo(), close the file descriptor + // immediately. This can happen in two scenarios: + // + // (a) A call to fstat() failed. + // (b) A malloc failed. + // + // Scenario (b) may only occur if the process is holding no other + // file descriptors open on the same file. If there were other file + // descriptors on this file, then no malloc would be required by + // findLockInfo(). If this is the case, it is quite safe to close + // handle h - as it is guaranteed that no posix locks will be released + // by doing so. + // + // If scenario (a) caused the error then things are not so safe. The + // implicit assumption here is that if fstat() fails, things are in + // such bad shape that dropping a lock or two doesn't matter much. + close(h); + h = -1; + } + } + + pNew->lastErrno = 0; + if (rc != SQLITE_OK) { + if (dirfd >= 0) + close(dirfd); + if (h >= 0) + close(h); + } else + pNew->pMethod = pLockingStyle; + return rc; +} + +// Searches for an unused file descriptor that was opened on the database +// file identified by zPath with matching flags. Returns 0 if not found. +static ChromiumUnusedFd* findReusableFd(const char* zPath, int flags) +{ + ChromiumUnusedFd* pUnused = 0; + + struct stat sStat; + if (!stat(zPath, &sStat)) { + ChromiumFileId id; + id.dev = sStat.st_dev; + id.ino = sStat.st_ino; + + ChromiumOpenInfo* pO = 0; + for (pO = openList; pO && memcmp(&id, &pO->fileId, sizeof(id)); pO = pO->pNext) { } + if (pO) { + ChromiumUnusedFd** pp; + for (pp = &pO->pUnused; *pp && (*pp)->flags != flags; pp = &((*pp)->pNext)) { } + pUnused = *pp; + if (pUnused) + *pp = pUnused->pNext; + } + } + return pUnused; +} // Opens a file. // @@ -59,14 +974,26 @@ namespace { // id - the structure that will manipulate the newly opened file. // desiredFlags - the desired open mode flags. // usedFlags - the actual open mode flags that were used. -int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, - sqlite3_file* id, int desiredFlags, int* usedFlags) +static int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, + sqlite3_file* id, int desiredFlags, int* usedFlags) { - chromium_sqlite3_initialize_unix_sqlite3_file(id); + // The mask 0x00007F00 gives us the 7 bits that determine the type of the file SQLite is trying to open. + int fileType = desiredFlags & 0x00007F00; + + memset(id, 0, sizeof(ChromiumFile)); + ChromiumFile* chromiumFile = reinterpret_cast<ChromiumFile*>(id); int fd = -1; - int result = chromium_sqlite3_get_reusable_file_handle(id, fileName, desiredFlags, &fd); - if (result != SQLITE_OK) - return result; + if (fileType == SQLITE_OPEN_MAIN_DB) { + ChromiumUnusedFd* unusedFd = findReusableFd(fileName, desiredFlags); + if (unusedFd) + fd = unusedFd->fd; + else { + unusedFd = static_cast<ChromiumUnusedFd*>(sqlite3_malloc(sizeof(*unusedFd))); + if (!unusedFd) + return SQLITE_NOMEM; + } + chromiumFile->pUnused = unusedFd; + } if (fd < 0) { fd = ChromiumBridge::databaseOpenFile(fileName, desiredFlags); @@ -76,23 +1003,24 @@ int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, } } if (fd < 0) { - chromium_sqlite3_destroy_reusable_file_handle(id); + sqlite3_free(chromiumFile->pUnused); return SQLITE_CANTOPEN; } if (usedFlags) *usedFlags = desiredFlags; - chromium_sqlite3_update_reusable_file_handle(id, fd, desiredFlags); + if (chromiumFile->pUnused) { + chromiumFile->pUnused->fd = fd; + chromiumFile->pUnused->flags = desiredFlags; + } fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); - // The mask 0x00007F00 gives us the 7 bits that determine the type of the file SQLite is trying to open. - int fileType = desiredFlags & 0x00007F00; int noLock = (fileType != SQLITE_OPEN_MAIN_DB); - result = chromium_sqlite3_fill_in_unix_sqlite3_file(vfs, fd, -1, id, fileName, noLock); - if (result != SQLITE_OK) - chromium_sqlite3_destroy_reusable_file_handle(id); - return result; + int rc = fillInChromiumFile(vfs, fd, -1, id, fileName, noLock); + if (rc != SQLITE_OK) + sqlite3_free(chromiumFile->pUnused); + return rc; } // Deletes the given file. @@ -101,7 +1029,7 @@ int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, // fileName - the name of the file. // syncDir - determines if the directory to which this file belongs // should be synched after the file is deleted. -int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) +static int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) { return ChromiumBridge::databaseDeleteFile(fileName, syncDir); } @@ -112,7 +1040,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) // fileName - the name of the file. // flag - the type of test to make on this file. // res - the result. -int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) +static int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { int attr = static_cast<int>(ChromiumBridge::databaseGetFileAttributes(fileName)); if (attr < 0) { @@ -122,7 +1050,7 @@ int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) switch (flag) { case SQLITE_ACCESS_EXISTS: - *res = 1; // if the file doesn't exist, attr < 0 + *res = 1; // if the file doesn't exist, attr < 0 break; case SQLITE_ACCESS_READWRITE: *res = (attr & W_OK) && (attr & R_OK); @@ -143,8 +1071,8 @@ int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) // relativePath - the relative path. // bufSize - the size of the output buffer in bytes. // absolutePath - the output buffer where the absolute path will be stored. -int chromiumFullPathname(sqlite3_vfs* vfs, const char* relativePath, - int, char* absolutePath) +static int chromiumFullPathname(sqlite3_vfs* vfs, const char* relativePath, + int, char* absolutePath) { // The renderer process doesn't need to know the absolute path of the file sqlite3_snprintf(vfs->mxPathname, absolutePath, "%s", relativePath); @@ -152,44 +1080,107 @@ int chromiumFullPathname(sqlite3_vfs* vfs, const char* relativePath, } #ifndef SQLITE_OMIT_LOAD_EXTENSION -// Returns NULL, thus disallowing loading libraries in the renderer process. -// -// vfs - pointer to the sqlite3_vfs object. -// fileName - the name of the shared library file. -void* chromiumDlOpen(sqlite3_vfs*, const char*) +// We disallow loading DSOs inside the renderer process, so the following procedures are no-op. +static void* chromiumDlOpen(sqlite3_vfs*, const char*) +{ + return 0; +} + +static void chromiumDlError(sqlite3_vfs*, int, char*) +{ +} + +static void (*chromiumDlSym(sqlite3_vfs*, void*, const char*))() { return 0; } + +static void chromiumDlClose(sqlite3_vfs*, void*) +{ +} #else #define chromiumDlOpen 0 +#define chromiumDlError 0 +#define chromiumDlSym 0 +#define chromiumDlClose 0 #endif // SQLITE_OMIT_LOAD_EXTENSION -} // namespace +// Generates a seed for SQLite's PRNG. +static int chromiumRandomness(sqlite3_vfs*, int nBuf, char *zBuf) +{ + ASSERT(static_cast<size_t>(nBuf) >= (sizeof(time_t) + sizeof(int))); + + memset(zBuf, 0, nBuf); + int fd = open("/dev/urandom", O_RDONLY); + if (fd < 0) { + time_t t; + time(&t); + memcpy(zBuf, &t, sizeof(t)); + int pid = getpid(); + memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); + return sizeof(t) + sizeof(pid); + } + nBuf = read(fd, zBuf, nBuf); + close(fd); + return nBuf; +} + +// Sleeps for at least |microseconds|, and returns the actual +// amount of time spent sleeping (in microseconds). +static int chromiumSleep(sqlite3_vfs*, int microseconds) +{ +#if OS(DARWIN) + usleep(microseconds); + return microseconds; +#else + // Round to the nearest second. + int seconds = (microseconds + 999999) / 1000000; + sleep(seconds); + return seconds * 1000000; +#endif +} + +// Retrieves the current system time (UTC). +static int chromiumCurrentTime(sqlite3_vfs*, double* now) +{ + struct timeval timeval; + gettimeofday(&timeval, 0); + *now = 2440587.5 + timeval.tv_sec / 86400.0 + timeval.tv_usec / 86400000000.0; + return 0; +} + +// This is not yet implemented in SQLite core. +static int chromiumGetLastError(sqlite3_vfs*, int, char*) +{ + return 0; +} + +// Same as MAX_PATHNAME from sqlite's os_unix.c. +static const int chromiumMaxPathname = 512; namespace WebCore { void SQLiteFileSystem::registerSQLiteVFS() { - sqlite3_vfs* unix_vfs = sqlite3_vfs_find("unix"); static sqlite3_vfs chromium_vfs = { 1, - unix_vfs->szOsFile, - unix_vfs->mxPathname, + sizeof(ChromiumFile), + chromiumMaxPathname, 0, "chromium_vfs", - unix_vfs->pAppData, + 0, chromiumOpen, chromiumDelete, chromiumAccess, chromiumFullPathname, chromiumDlOpen, - unix_vfs->xDlError, - unix_vfs->xDlSym, - unix_vfs->xDlClose, - unix_vfs->xRandomness, - unix_vfs->xSleep, - unix_vfs->xCurrentTime, - unix_vfs->xGetLastError + chromiumDlError, + chromiumDlSym, + chromiumDlClose, + chromiumRandomness, + chromiumSleep, + chromiumCurrentTime, + chromiumGetLastError }; sqlite3_vfs_register(&chromium_vfs, 0); } diff --git a/WebCore/platform/text/cf/HyphenationCF.cpp b/WebCore/platform/text/cf/HyphenationCF.cpp index 8be537d..b265c56 100644 --- a/WebCore/platform/text/cf/HyphenationCF.cpp +++ b/WebCore/platform/text/cf/HyphenationCF.cpp @@ -48,20 +48,27 @@ RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::creat { RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.createCFString()); RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get())); - return locale; + + return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0; +} + +static AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >& cfLocaleCache() +{ + DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >, cache, ()); + return cache; } -bool canHyphenate(const AtomicString& /* localeIdentifer */) +bool canHyphenate(const AtomicString& localeIdentifier) { - return true; + return cfLocaleCache().get(localeIdentifier); } size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier) { RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull)); - DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >, cfLocaleCache, ()); - RetainPtr<CFLocaleRef> locale = cfLocaleCache.get(localeIdentifier); + RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier); + ASSERT(locale); CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0); return result == kCFNotFound ? 0 : result; diff --git a/WebCore/platform/text/qt/TextCodecQt.cpp b/WebCore/platform/text/qt/TextCodecQt.cpp index 94a2b7b..1e95d87 100644 --- a/WebCore/platform/text/qt/TextCodecQt.cpp +++ b/WebCore/platform/text/qt/TextCodecQt.cpp @@ -29,7 +29,6 @@ #include "PlatformString.h" #include <wtf/text/CString.h> #include <qset.h> -// #include <QDebug> namespace WebCore { @@ -125,14 +124,41 @@ String TextCodecQt::decode(const char* bytes, size_t length, bool flush, bool /* return unicode; } -CString TextCodecQt::encode(const UChar* characters, size_t length, UnencodableHandling) +CString TextCodecQt::encode(const UChar* characters, size_t length, UnencodableHandling handling) { + QTextCodec::ConverterState state; + state.flags = QTextCodec::ConversionFlags(QTextCodec::ConvertInvalidToNull | QTextCodec::IgnoreHeader); + if (!length) return ""; - // FIXME: do something sensible with UnencodableHandling + QByteArray ba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), length, &state); + + // If some <b> characters </b> are unencodable, escape them as specified by <b> handling </b> + // We append one valid encoded chunk to a QByteArray at a time. When we encounter an unencodable chunk we + // escape it with getUnencodableReplacement, append it, then move to the next chunk. + if (state.invalidChars) { + state.invalidChars = 0; + state.remainingChars = 0; + int len = 0; + ba.clear(); + for (size_t pos = 0; pos < length; ++pos) { + QByteArray tba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), ++len, &state); + if (state.remainingChars) + continue; + if (state.invalidChars) { + UnencodableReplacementArray replacement; + getUnencodableReplacement(characters[0], handling, replacement); + tba.replace('\0', replacement); + state.invalidChars = 0; + } + ba.append(tba); + characters += len; + len = 0; + state.remainingChars = 0; + } + } - QByteArray ba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), length, 0); return CString(ba.constData(), ba.length()); } diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp index b13473a..529963f 100644 --- a/WebCore/platform/win/ClipboardWin.cpp +++ b/WebCore/platform/win/ClipboardWin.cpp @@ -397,19 +397,19 @@ exit: PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame) { - return ClipboardWin::create(true, dragData->platformData(), policy, frame); + return ClipboardWin::create(DragAndDrop, dragData->platformData(), policy, frame); } -ClipboardWin::ClipboardWin(bool isForDragging, IDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) - : Clipboard(policy, isForDragging) +ClipboardWin::ClipboardWin(ClipboardType clipboardType, IDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) + : Clipboard(policy, clipboardType) , m_dataObject(dataObject) , m_writableDataObject(0) , m_frame(frame) { } -ClipboardWin::ClipboardWin(bool isForDragging, WCDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) - : Clipboard(policy, isForDragging) +ClipboardWin::ClipboardWin(ClipboardType clipboardType, WCDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) + : Clipboard(policy, clipboardType) , m_dataObject(dataObject) , m_writableDataObject(dataObject) , m_frame(frame) @@ -467,7 +467,7 @@ static bool writeURL(WCDataObject *data, const KURL& url, String title, bool wit void ClipboardWin::clearData(const String& type) { // FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); if (policy() != ClipboardWritable || !m_writableDataObject) return; @@ -487,7 +487,7 @@ void ClipboardWin::clearData(const String& type) void ClipboardWin::clearAllData() { // FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); if (policy() != ClipboardWritable) return; @@ -520,7 +520,7 @@ String ClipboardWin::getData(const String& type, bool& success) const bool ClipboardWin::setData(const String& type, const String& data) { // FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); if (policy() != ClipboardWritable || !m_writableDataObject) return false; @@ -831,7 +831,7 @@ bool ClipboardWin::hasData() void ClipboardWin::setExternalDataObject(IDataObject *dataObject) { - ASSERT(isForDragging()); + ASSERT(isForDragAndDrop()); m_writableDataObject = 0; m_dataObject = dataObject; diff --git a/WebCore/platform/win/ClipboardWin.h b/WebCore/platform/win/ClipboardWin.h index 6a08087..ce64b85 100644 --- a/WebCore/platform/win/ClipboardWin.h +++ b/WebCore/platform/win/ClipboardWin.h @@ -42,13 +42,13 @@ class WCDataObject; // State available during IE's events for drag and drop and copy/paste class ClipboardWin : public Clipboard, public CachedResourceClient { public: - static PassRefPtr<ClipboardWin> create(bool isForDragging, IDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) + static PassRefPtr<ClipboardWin> create(ClipboardType clipboardType, IDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) { - return adoptRef(new ClipboardWin(isForDragging, dataObject, policy, frame)); + return adoptRef(new ClipboardWin(clipboardType, dataObject, policy, frame)); } - static PassRefPtr<ClipboardWin> create(bool isForDragging, WCDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) + static PassRefPtr<ClipboardWin> create(ClipboardType clipboardType, WCDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) { - return adoptRef(new ClipboardWin(isForDragging, dataObject, policy, frame)); + return adoptRef(new ClipboardWin(clipboardType, dataObject, policy, frame)); } ~ClipboardWin(); @@ -77,8 +77,8 @@ public: void setExternalDataObject(IDataObject *dataObject); private: - ClipboardWin(bool isForDragging, IDataObject*, ClipboardAccessPolicy, Frame*); - ClipboardWin(bool isForDragging, WCDataObject*, ClipboardAccessPolicy, Frame*); + ClipboardWin(ClipboardType, IDataObject*, ClipboardAccessPolicy, Frame*); + ClipboardWin(ClipboardType, WCDataObject*, ClipboardAccessPolicy, Frame*); void resetFromClipboard(); void setDragImage(CachedImage*, Node*, const IntPoint&); diff --git a/WebCore/platform/win/EditorWin.cpp b/WebCore/platform/win/EditorWin.cpp index 075827d..4965c97 100644 --- a/WebCore/platform/win/EditorWin.cpp +++ b/WebCore/platform/win/EditorWin.cpp @@ -45,7 +45,7 @@ PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, if (!SUCCEEDED(OleGetClipboard(&clipboardData))) clipboardData = 0; - return ClipboardWin::create(false, clipboardData.get(), policy, frame); + return ClipboardWin::create(Clipboard::CopyAndPaste, clipboardData.get(), policy, frame); } } // namespace WebCore diff --git a/WebCore/platform/wx/ClipboardWx.cpp b/WebCore/platform/wx/ClipboardWx.cpp index 2ef943f..32216a6 100644 --- a/WebCore/platform/wx/ClipboardWx.cpp +++ b/WebCore/platform/wx/ClipboardWx.cpp @@ -42,8 +42,8 @@ PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame* return 0; } -ClipboardWx::ClipboardWx(ClipboardAccessPolicy policy, bool forDragging) - : Clipboard(policy, forDragging) +ClipboardWx::ClipboardWx(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(policy, clipboardType) { } diff --git a/WebCore/platform/wx/ClipboardWx.h b/WebCore/platform/wx/ClipboardWx.h index 45d1cf3..138635a 100644 --- a/WebCore/platform/wx/ClipboardWx.h +++ b/WebCore/platform/wx/ClipboardWx.h @@ -35,9 +35,9 @@ namespace WebCore { // State available during IE's events for drag and drop and copy/paste class ClipboardWx : public Clipboard { public: - static PassRefPtr<ClipboardWx> create(ClipboardAccessPolicy policy, bool forDragging) + static PassRefPtr<ClipboardWx> create(ClipboardAccessPolicy policy, ClipboardType clipboardType) { - return adoptRef(new ClipboardWx(policy, forDragging)); + return adoptRef(new ClipboardWx(policy, clipboardType)); } void clearData(const String& type); @@ -65,7 +65,7 @@ namespace WebCore { virtual bool hasData(); private: - ClipboardWx(ClipboardAccessPolicy, bool forDragging); + ClipboardWx(ClipboardAccessPolicy, ClipboardType); }; } diff --git a/WebCore/platform/wx/LocalizedStringsWx.cpp b/WebCore/platform/wx/LocalizedStringsWx.cpp index 4112f64..10ea435 100644 --- a/WebCore/platform/wx/LocalizedStringsWx.cpp +++ b/WebCore/platform/wx/LocalizedStringsWx.cpp @@ -97,6 +97,56 @@ String contextMenuItemTagCopyImageToClipboard() return String("Copy Image to Clipboard"); } +String contextMenuItemTagOpenVideoInNewWindow() +{ + return String("Open Video in New Window"); +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return String("Open Audio in New Window"); +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return String("Copy Video Link Location"); +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return String("Copy Audio Link Location"); +} + +String contextMenuItemTagToggleMediaControls() +{ + return String("Toggle Media Controls"); +} + +String contextMenuItemTagToggleMediaLoop() +{ + return String("Toggle Media Loop Playback"); +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return String("Switch Video to Fullscreen"); +} + +String contextMenuItemTagMediaPlay() +{ + return String("Play"); +} + +String contextMenuItemTagMediaPause() +{ + return String("Pause"); +} + +String contextMenuItemTagMediaMute() +{ + return String("Mute"); +} + String contextMenuItemTagOpenFrameInNewWindow() { return String("Open Frame in New Window"); diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp index e88d1e5..b850ef5 100644 --- a/WebCore/platform/wx/PopupMenuWx.cpp +++ b/WebCore/platform/wx/PopupMenuWx.cpp @@ -38,14 +38,34 @@ static int s_menuStartId = wxNewId(); +namespace WebCore { + +class PopupMenuEventHandler : public wxEvtHandler +{ +public: + PopupMenuEventHandler(PopupMenuClient* client) : + m_client(client) + {} + + void OnMenuItemSelected(wxCommandEvent& event) + { + if (m_client) { + m_client->valueChanged(event.GetId() - s_menuStartId); + m_client->popupDidHide(); + } + // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still? + } +private: + PopupMenuClient* m_client; -namespace WebCore { +}; PopupMenuWx::PopupMenuWx(PopupMenuClient* client) : m_popupClient(client) - , m_menu(NULL) + , m_menu(0) { + PopupMenuEventHandler m_popupHandler(client); } PopupMenuWx::~PopupMenuWx() @@ -69,6 +89,7 @@ void PopupMenuWx::show(const IntRect& r, FrameView* v, int index) if (nativeWin) { // construct the menu m_menu = new wxMenu(); + int size = client()->listSize(); for (int i = 0; i < size; i++) { int id = s_menuStartId + i; @@ -84,19 +105,10 @@ void PopupMenuWx::show(const IntRect& r, FrameView* v, int index) m_menu->Append(s_menuStartId + i, client()->itemText(i)); } } - nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); + nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuEventHandler::OnMenuItemSelected), 0, m_popupHandler); nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY()); - nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); - } -} - -void PopupMenuWx::OnMenuItemSelected(wxCommandEvent& event) -{ - if (client()) { - client()->valueChanged(event.GetId() - s_menuStartId); - client()->popupDidHide(); + nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuEventHandler::OnMenuItemSelected), 0, m_popupHandler); } - // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still? } void PopupMenuWx::hide() diff --git a/WebCore/platform/wx/PopupMenuWx.h b/WebCore/platform/wx/PopupMenuWx.h index c2573fc..ad947a7 100644 --- a/WebCore/platform/wx/PopupMenuWx.h +++ b/WebCore/platform/wx/PopupMenuWx.h @@ -37,9 +37,10 @@ class wxMenu; namespace WebCore { class FrameView; +class PopupMenuEventHandler; class Scrollbar; -class PopupMenuWx : public PopupMenu, public wxEvtHandler { +class PopupMenuWx : public PopupMenu { public: PopupMenuWx(PopupMenuClient*); ~PopupMenuWx(); @@ -55,6 +56,7 @@ private: PopupMenuClient* m_popupClient; wxMenu* m_menu; + PopupMenuEventHandler* m_popupHandler; }; } diff --git a/WebCore/plugins/PluginData.cpp b/WebCore/plugins/PluginData.cpp index ff90747..d24d234 100644 --- a/WebCore/plugins/PluginData.cpp +++ b/WebCore/plugins/PluginData.cpp @@ -75,7 +75,7 @@ void PluginData::initPlugins() { ASSERT(m_plugins.isEmpty()); - platformStrategies()->pluginStrategy()->getPluginInfo(m_plugins); + platformStrategies()->pluginStrategy()->getPluginInfo(m_page, m_plugins); } #endif diff --git a/WebCore/plugins/PluginPackage.cpp b/WebCore/plugins/PluginPackage.cpp index 660d8f0..1d41dc6 100644 --- a/WebCore/plugins/PluginPackage.cpp +++ b/WebCore/plugins/PluginPackage.cpp @@ -210,12 +210,13 @@ void PluginPackage::determineQuirks(const String& mimeType) } else { // Flash 9 and older requests windowless plugins if we return a mozilla user agent m_quirks.add(PluginQuirkWantsMozillaUserAgent); -#if PLATFORM(QT) - // Flash 9 and older would crash on repeated calls to SetWindow in windowed mode - m_quirks.add(PluginQuirkDontCallSetWindowMoreThanOnce); -#endif } +#if PLATFORM(QT) && CPU(X86) + // 32-bit Flash will crash on repeated calls to SetWindow in windowed mode + m_quirks.add(PluginQuirkDontCallSetWindowMoreThanOnce); +#endif + m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); m_quirks.add(PluginQuirkThrottleInvalidate); m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages); diff --git a/WebCore/plugins/PluginStrategy.h b/WebCore/plugins/PluginStrategy.h index 7e92196..9d8a7b5 100644 --- a/WebCore/plugins/PluginStrategy.h +++ b/WebCore/plugins/PluginStrategy.h @@ -32,10 +32,12 @@ namespace WebCore { +class Page; + class PluginStrategy { public: virtual void refreshPlugins() = 0; - virtual void getPluginInfo(Vector<PluginInfo>&) = 0; + virtual void getPluginInfo(const Page*, Vector<PluginInfo>&) = 0; protected: virtual ~PluginStrategy() { } diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index ca358b7..2522e0f 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -713,7 +713,7 @@ NPError PluginView::setValue(NPPVariable variable, void* value) } #endif // defined(XP_MACOSX) -#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) case NPPVpluginWindowlessLocalBool: m_renderToImage = true; return NPERR_NO_ERROR; @@ -943,7 +943,7 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p , m_colormap(0) , m_pluginDisplay(0) #endif -#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) , m_renderToImage(false) #endif , m_loadManually(loadManually) diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index 8587c37..3d4e13e 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -65,7 +65,7 @@ typedef PlatformWidget PlatformPluginWidget; #include <QPixmap> #endif #endif -#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) #include <QImage> class QPainter; #endif @@ -448,7 +448,7 @@ private: void initXEvent(XEvent* event); #endif -#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) QImage m_image; bool m_renderToImage; void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect); diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp index de7d12d..b7e1268 100644 --- a/WebCore/plugins/qt/PluginViewQt.cpp +++ b/WebCore/plugins/qt/PluginViewQt.cpp @@ -115,7 +115,7 @@ void PluginView::updatePluginWidget() return; if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) { -#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) // On Maemo5, Flash always renders to 16-bit buffer if (m_renderToImage) m_image = QImage(m_windowRect.width(), m_windowRect.height(), QImage::Format_RGB16); @@ -172,7 +172,7 @@ void PluginView::hide() Widget::hide(); } -#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect) { NPImageExpose imageExpose; @@ -253,7 +253,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) return; if (!m_drawable -#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) && m_image.isNull() #endif ) @@ -264,7 +264,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) exposedRect.intersect(frameRect()); exposedRect.move(-frameRect().x(), -frameRect().y()); -#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) if (!m_image.isNull()) { paintUsingImageSurfaceExtension(painter, exposedRect); return; @@ -697,7 +697,7 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr *result = NPERR_NO_ERROR; return true; -#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) case NPNVSupportsWindowlessLocal: *static_cast<NPBool*>(value) = true; *result = NPERR_NO_ERROR; diff --git a/WebCore/rendering/AutoTableLayout.cpp b/WebCore/rendering/AutoTableLayout.cpp index d9233a2..bf1bcd9 100644 --- a/WebCore/rendering/AutoTableLayout.cpp +++ b/WebCore/rendering/AutoTableLayout.cpp @@ -60,7 +60,7 @@ void AutoTableLayout::recalcColumn(int effCol) while (child) { if (child->isTableCol()) - toRenderTableCol(child)->calcPrefWidths(); + toRenderTableCol(child)->computePreferredLogicalWidths(); else if (child->isTableSection()) { RenderTableSection* section = toRenderTableSection(child); int numRows = section->numRows(); @@ -79,11 +79,11 @@ void AutoTableLayout::recalcColumn(int effCol) // a min/max width of at least 1px for this column now. l.minWidth = max(l.minWidth, cellHasContent ? 1 : 0); l.maxWidth = max(l.maxWidth, 1); - if (cell->prefWidthsDirty()) - cell->calcPrefWidths(); - l.minWidth = max(cell->minPrefWidth(), l.minWidth); - if (cell->maxPrefWidth() > l.maxWidth) { - l.maxWidth = cell->maxPrefWidth(); + if (cell->preferredLogicalWidthsDirty()) + cell->computePreferredLogicalWidths(); + l.minWidth = max(cell->minPreferredLogicalWidth(), l.minWidth); + if (cell->maxPreferredLogicalWidth() > l.maxWidth) { + l.maxWidth = cell->maxPreferredLogicalWidth(); maxContributor = cell; } @@ -97,7 +97,7 @@ void AutoTableLayout::recalcColumn(int effCol) case Fixed: // ignore width=0 if (w.value() > 0 && (int)l.width.type() != Percent) { - int wval = cell->calcBorderBoxWidth(w.value()); + int wval = cell->computeBorderBoxLogicalWidth(w.value()); if (l.width.isFixed()) { // Nav/IE weirdness if ((wval > l.width.value()) || @@ -239,7 +239,7 @@ static bool shouldScaleColumns(RenderTable* table) return scale; } -void AutoTableLayout::calcPrefWidths(int& minWidth, int& maxWidth) +void AutoTableLayout::computePreferredLogicalWidths(int& minWidth, int& maxWidth) { fullRecalc(); @@ -317,8 +317,8 @@ int AutoTableLayout::calcEffectiveWidth() int col = m_table->colToEffCol(cell->col()); unsigned int lastCol = col; - int cMinWidth = cell->minPrefWidth() + hspacing; - float cMaxWidth = cell->maxPrefWidth() + hspacing; + int cMinWidth = cell->minPreferredLogicalWidth() + hspacing; + float cMaxWidth = cell->maxPreferredLogicalWidth() + hspacing; int totalPercent = 0; int minWidth = 0; float maxWidth = 0; diff --git a/WebCore/rendering/AutoTableLayout.h b/WebCore/rendering/AutoTableLayout.h index f1ef768..5726ba6 100644 --- a/WebCore/rendering/AutoTableLayout.h +++ b/WebCore/rendering/AutoTableLayout.h @@ -35,7 +35,7 @@ public: AutoTableLayout(RenderTable*); ~AutoTableLayout(); - virtual void calcPrefWidths(int& minWidth, int& maxWidth); + virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth); virtual void layout(); protected: diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp index 61cd524..1d71d35 100644 --- a/WebCore/rendering/EllipsisBox.cpp +++ b/WebCore/rendering/EllipsisBox.cpp @@ -62,7 +62,7 @@ void EllipsisBox::paint(PaintInfo& paintInfo, int tx, int ty) if (m_markupBox) { // Paint the markup box - tx += m_x + m_width - m_markupBox->x(); + tx += m_x + m_logicalWidth - m_markupBox->x(); ty += m_y + style->font().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(m_firstLine)->font().ascent()); m_markupBox->paint(paintInfo, tx, ty); } @@ -91,7 +91,7 @@ void EllipsisBox::paintSelection(GraphicsContext* context, int tx, int ty, Rende context->save(); int y = root()->selectionTop(); int h = root()->selectionHeight(); - context->clip(IntRect(m_x + tx, y + ty, m_width, h)); + context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h)); context->drawHighlightForText(font, TextRun(m_str.characters(), m_str.length(), false, 0, 0, false, style->visuallyOrdered()), IntPoint(m_x + tx, m_y + ty + y), h, c, style->colorSpace()); context->restore(); @@ -105,7 +105,7 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Hit test the markup box. if (m_markupBox) { RenderStyle* style = m_renderer->style(m_firstLine); - int mtx = tx + m_width - m_markupBox->x(); + int mtx = tx + m_logicalWidth - m_markupBox->x(); int mty = ty + style->font().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(m_firstLine)->font().ascent()); if (m_markupBox->nodeAtPoint(request, result, x, y, mtx, mty)) { renderer()->updateHitTestResult(result, IntPoint(x - mtx, y - mty)); @@ -113,7 +113,7 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } - IntRect boundsRect = IntRect(tx, ty, m_width, m_height); + IntRect boundsRect = IntRect(tx, ty, m_logicalWidth, m_height); if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, boundsRect)) diff --git a/WebCore/rendering/EllipsisBox.h b/WebCore/rendering/EllipsisBox.h index 476331c..ec1b00b 100644 --- a/WebCore/rendering/EllipsisBox.h +++ b/WebCore/rendering/EllipsisBox.h @@ -30,8 +30,8 @@ class HitTestResult; class EllipsisBox : public InlineBox { public: EllipsisBox(RenderObject* obj, const AtomicString& ellipsisStr, InlineFlowBox* parent, - int width, int height, int y, bool firstLine, InlineBox* markupBox) - : InlineBox(obj, 0, y, width, firstLine, true, false, false, 0, 0, parent) + int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox) + : InlineBox(obj, 0, y, width, firstLine, true, false, false, isVertical, 0, 0, parent) , m_height(height) , m_str(ellipsisStr) , m_markupBox(markupBox) diff --git a/WebCore/rendering/FixedTableLayout.cpp b/WebCore/rendering/FixedTableLayout.cpp index b5ff971..ba99336 100644 --- a/WebCore/rendering/FixedTableLayout.cpp +++ b/WebCore/rendering/FixedTableLayout.cpp @@ -126,7 +126,7 @@ int FixedTableLayout::calcWidthArray(int) currentEffectiveColumn++; } } - toRenderTableCol(child)->calcPrefWidths(); + toRenderTableCol(child)->computePreferredLogicalWidths(); } else break; @@ -155,8 +155,8 @@ int FixedTableLayout::calcWidthArray(int) while (child) { if (child->isTableCell()) { RenderTableCell* cell = toRenderTableCell(child); - if (cell->prefWidthsDirty()) - cell->calcPrefWidths(); + if (cell->preferredLogicalWidthsDirty()) + cell->computePreferredLogicalWidths(); Length w = cell->styleOrColWidth(); int span = cell->colSpan(); @@ -190,7 +190,7 @@ int FixedTableLayout::calcWidthArray(int) // Keep this in synch with BLOCK_MAX_WIDTH in RenderBlock.cpp #define TABLE_MAX_WIDTH 15000 -void FixedTableLayout::calcPrefWidths(int& minWidth, int& maxWidth) +void FixedTableLayout::computePreferredLogicalWidths(int& minWidth, int& maxWidth) { // FIXME: This entire calculation is incorrect for both minwidth and maxwidth. diff --git a/WebCore/rendering/FixedTableLayout.h b/WebCore/rendering/FixedTableLayout.h index 758ddbb..bf26d1b 100644 --- a/WebCore/rendering/FixedTableLayout.h +++ b/WebCore/rendering/FixedTableLayout.h @@ -33,7 +33,7 @@ class FixedTableLayout : public TableLayout { public: FixedTableLayout(RenderTable*); - virtual void calcPrefWidths(int& minWidth, int& maxWidth); + virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth); virtual void layout(); protected: diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index 496c4ba..35a6d23 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -24,6 +24,7 @@ #include "Frame.h" #include "FrameTree.h" #include "HTMLAnchorElement.h" +#include "HTMLVideoElement.h" #include "HTMLImageElement.h" #include "HTMLInputElement.h" #include "HTMLMediaElement.h" @@ -50,17 +51,27 @@ HitTestResult::HitTestResult(const IntPoint& point) : m_point(point) , m_isOverWidget(false) , m_isRectBased(false) + , m_topPadding(0) + , m_rightPadding(0) + , m_bottomPadding(0) + , m_leftPadding(0) { } -HitTestResult::HitTestResult(const IntPoint& centerPoint, const IntSize& padding) +HitTestResult::HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) : m_point(centerPoint) , m_isOverWidget(false) + , m_topPadding(topPadding) + , m_rightPadding(rightPadding) + , m_bottomPadding(bottomPadding) + , m_leftPadding(leftPadding) { - // If a zero padding is passed in or either width or height is negative, then it - // is not a valid padding and hence not a rect based hit test. - m_isRectBased = !(padding.isZero() || (padding.width() < 0 || padding.height() < 0)); - m_padding = m_isRectBased ? padding : IntSize(); + // If all padding values passed in are zero then it is not a rect based hit test. + m_isRectBased = topPadding || rightPadding || bottomPadding || leftPadding; + + // Make sure all padding values are clamped to zero if it is not a rect hit test. + if (!m_isRectBased) + m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0; } HitTestResult::HitTestResult(const HitTestResult& other) @@ -75,9 +86,13 @@ HitTestResult::HitTestResult(const HitTestResult& other) // Only copy the padding and ListHashSet in case of rect hit test. // Copying the later is rather expensive. if ((m_isRectBased = other.isRectBasedTest())) { - m_padding = other.padding(); + m_topPadding = other.m_topPadding; + m_rightPadding = other.m_rightPadding; + m_bottomPadding = other.m_bottomPadding; + m_leftPadding = other.m_leftPadding; m_rectBasedTestResult = other.rectBasedTestResult(); - } + } else + m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0; } HitTestResult::~HitTestResult() @@ -96,9 +111,13 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) // Only copy the padding and ListHashSet in case of rect hit test. // Copying the later is rather expensive. if ((m_isRectBased = other.isRectBasedTest())) { - m_padding = other.padding(); + m_topPadding = other.m_topPadding; + m_rightPadding = other.m_rightPadding; + m_bottomPadding = other.m_bottomPadding; + m_leftPadding = other.m_leftPadding; m_rectBasedTestResult = other.rectBasedTestResult(); - } + } else + m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0; return *this; } @@ -292,22 +311,134 @@ KURL HitTestResult::absoluteImageURL() const KURL HitTestResult::absoluteMediaURL() const { #if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return m_innerNonSharedNode->document()->completeURL(deprecatedParseURL(mediaElt->currentSrc())); + return KURL(); +#else + return KURL(); +#endif +} + +bool HitTestResult::mediaSupportsFullscreen() const +{ +#if ENABLE(VIDEO) + HTMLMediaElement* mediaElt(mediaElement()); + return (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag) && mediaElt->supportsFullscreen()); +#else + return false; +#endif +} + +#if ENABLE(VIDEO) +HTMLMediaElement* HitTestResult::mediaElement() const +{ if (!(m_innerNonSharedNode && m_innerNonSharedNode->document())) - return KURL(); + return 0; if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()->isMedia())) - return KURL(); + return 0; - AtomicString urlString; - if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag)) { - HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get()); - urlString = mediaElement->currentSrc(); - } else - return KURL(); + if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag)) + return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get()); + return 0; +} +#endif - return m_innerNonSharedNode->document()->completeURL(deprecatedParseURL(urlString)); -#else - return KURL(); +void HitTestResult::toggleMediaControlsDisplay() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + mediaElt->setControls(!mediaElt->controls()); +#endif +} + +void HitTestResult::toggleMediaLoopPlayback() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + mediaElt->setLoop(!mediaElt->loop()); +#endif +} + +void HitTestResult::enterFullscreenForVideo() const +{ +#if ENABLE(VIDEO) + HTMLMediaElement* mediaElt(mediaElement()); + if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) { + HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt); + if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen()) + videoElt->enterFullscreen(); + } +#endif +} + +bool HitTestResult::mediaControlsEnabled() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return mediaElt->controls(); +#endif + return false; +} + +bool HitTestResult::mediaLoopEnabled() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return mediaElt->loop(); +#endif + return false; +} + +bool HitTestResult::mediaPlaying() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return !mediaElt->paused(); +#endif + return false; +} + +void HitTestResult::toggleMediaPlayState() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + mediaElt->togglePlayState(); +#endif +} + +bool HitTestResult::mediaHasAudio() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return mediaElt->hasAudio(); +#endif + return false; +} + +bool HitTestResult::mediaIsVideo() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return mediaElt->hasTagName(HTMLNames::videoTag); +#endif + return false; +} + +bool HitTestResult::mediaMuted() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + return mediaElt->muted(); +#endif + return false; +} + +void HitTestResult::toggleMediaMuteState() const +{ +#if ENABLE(VIDEO) + if (HTMLMediaElement* mediaElt = mediaElement()) + mediaElt->setMuted(!mediaElt->muted()); #endif } @@ -421,4 +552,16 @@ void HitTestResult::append(const HitTestResult& other) m_rectBasedTestResult.add(it->get()); } +IntRect HitTestResult::rectFromPoint(const IntPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) +{ + IntPoint actualPoint(point); + actualPoint -= IntSize(leftPadding, topPadding); + + IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding); + // As IntRect is left inclusive and right exclusive (seeing IntRect::contains(x, y)), adding "1". + actualPadding += IntSize(1, 1); + + return IntRect(actualPoint, actualPadding); +} + } // namespace WebCore diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h index 3a42719..1304e22 100644 --- a/WebCore/rendering/HitTestResult.h +++ b/WebCore/rendering/HitTestResult.h @@ -32,6 +32,9 @@ namespace WebCore { class Element; class Frame; +#if ENABLE(VIDEO) +class HTMLMediaElement; +#endif class Image; class IntRect; class KURL; @@ -41,8 +44,8 @@ class Scrollbar; class HitTestResult { public: HitTestResult(const IntPoint&); - // Pass a non-negative IntSize value as padding to perform a rect-based hit test. - HitTestResult(const IntPoint& centerPoint, const IntSize& padding); + // Pass non-negative padding values to perform a rect-based hit test. + HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); HitTestResult(const HitTestResult&); ~HitTestResult(); HitTestResult& operator=(const HitTestResult&); @@ -80,14 +83,29 @@ public: String textContent() const; bool isLiveLink() const; bool isContentEditable() const; + void toggleMediaControlsDisplay() const; + void toggleMediaLoopPlayback() const; + void enterFullscreenForVideo() const; + bool mediaControlsEnabled() const; + bool mediaLoopEnabled() const; + bool mediaPlaying() const; + bool mediaSupportsFullscreen() const; + void toggleMediaPlayState() const; + bool mediaHasAudio() const; + bool mediaIsVideo() const; + bool mediaMuted() const; + void toggleMediaMuteState() const; // Rect-based hit test related methods. bool isRectBasedTest() const { return m_isRectBased; } IntRect rectFromPoint(int x, int y) const; IntRect rectFromPoint(const IntPoint&) const; - IntSize padding() const { return m_padding; } - int paddingWidth() const { return m_padding.width(); } - int paddingHeight() const { return m_padding.height(); } + static IntRect rectFromPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); + int topPadding() const { return m_topPadding; } + int rightPadding() const { return m_rightPadding; } + int bottomPadding() const { return m_bottomPadding; } + int leftPadding() const { return m_leftPadding; } + // Returns true if it is rect-based hit test and needs to continue until the rect is fully // enclosed by the boundaries of a node. bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& rect = IntRect()); @@ -96,6 +114,10 @@ public: private: +#if ENABLE(VIDEO) + HTMLMediaElement* mediaElement() const; +#endif + RefPtr<Node> m_innerNode; RefPtr<Node> m_innerNonSharedNode; IntPoint m_point; @@ -105,34 +127,26 @@ private: RefPtr<Scrollbar> m_scrollbar; bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example). bool m_isRectBased; - IntSize m_padding; + int m_topPadding; + int m_rightPadding; + int m_bottomPadding; + int m_leftPadding; ListHashSet<RefPtr<Node> > m_rectBasedTestResult; }; inline IntRect HitTestResult::rectFromPoint(int x, int y) const { - return rectFromPoint(IntPoint(x, y)); + return rectFromPoint(IntPoint(x, y), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding); } // Formula: -// x = p.x() - padding.width() -// y = p.y() - padding.height() -// width = 2 * padding.width() + 1 -// height = 2 * m_padding.height() + 1 +// x = p.x() - rightPadding +// y = p.y() - topPadding +// width = leftPadding + rightPadding + 1 +// height = topPadding + bottomPadding + 1 inline IntRect HitTestResult::rectFromPoint(const IntPoint& point) const { - IntPoint realPoint(point); - IntSize realPadding(m_padding); - - // Real IntPoint for the rect. - realPadding.clampNegativeToZero(); - realPoint -= realPadding; - - // Real IntSize for the rect. - realPadding.scale(2); - realPadding += IntSize(1, 1); - - return IntRect(realPoint, realPadding); + return rectFromPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding); } String displayString(const String&, const Node*); diff --git a/WebCore/rendering/InlineBox.cpp b/WebCore/rendering/InlineBox.cpp index 5475187..91cbaff 100644 --- a/WebCore/rendering/InlineBox.cpp +++ b/WebCore/rendering/InlineBox.cpp @@ -85,11 +85,11 @@ void InlineBox::showTreeForThis() const } #endif -int InlineBox::height() const +int InlineBox::logicalHeight() const { #if ENABLE(SVG) - if (hasVirtualHeight()) - return virtualHeight(); + if (hasVirtualLogicalHeight()) + return virtualLogicalHeight(); #endif if (renderer()->isText()) @@ -268,7 +268,7 @@ bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidt if (!m_renderer || !m_renderer->isReplaced()) return true; - IntRect boxRect(m_x, 0, m_width, 10); + IntRect boxRect(m_x, 0, m_logicalWidth, 10); IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, ellipsisWidth, 10); return !(boxRect.intersects(ellipsisRect)); } diff --git a/WebCore/rendering/InlineBox.h b/WebCore/rendering/InlineBox.h index ab0167c..1cd88ff 100644 --- a/WebCore/rendering/InlineBox.h +++ b/WebCore/rendering/InlineBox.h @@ -30,7 +30,6 @@ class HitTestRequest; class HitTestResult; class RootInlineBox; - // InlineBox represents a rectangle that occurs on a line. It corresponds to // some RenderObject (i.e., it represents a portion of that RenderObject). class InlineBox { @@ -42,15 +41,16 @@ public: , m_renderer(obj) , m_x(0) , m_y(0) - , m_width(0) + , m_logicalWidth(0) , m_firstLine(false) , m_constructed(false) , m_bidiEmbeddingLevel(0) , m_dirty(false) , m_extracted(false) #if ENABLE(SVG) - , m_hasVirtualHeight(false) + , m_hasVirtualLogicalHeight(false) #endif + , m_isVertical(false) , m_endsWithBreak(false) , m_hasSelectedChildren(false) , m_hasEllipsisBoxOrHyphen(false) @@ -67,23 +67,24 @@ public: { } - InlineBox(RenderObject* obj, int x, int y, int width, bool firstLine, bool constructed, - bool dirty, bool extracted, InlineBox* next, InlineBox* prev, InlineFlowBox* parent) + InlineBox(RenderObject* obj, int x, int y, int logicalWidth, bool firstLine, bool constructed, + bool dirty, bool extracted, bool isVertical, InlineBox* next, InlineBox* prev, InlineFlowBox* parent) : m_next(next) , m_prev(prev) , m_parent(parent) , m_renderer(obj) , m_x(x) , m_y(y) - , m_width(width) + , m_logicalWidth(logicalWidth) , m_firstLine(firstLine) , m_constructed(constructed) , m_bidiEmbeddingLevel(0) , m_dirty(dirty) , m_extracted(extracted) #if ENABLE(SVG) - , m_hasVirtualHeight(false) + , m_hasVirtualLogicalHeight(false) #endif + , m_isVertical(isVertical) , m_endsWithBreak(false) , m_hasSelectedChildren(false) , m_hasEllipsisBoxOrHyphen(false) @@ -139,15 +140,18 @@ public: #if ENABLE(SVG) virtual bool isSVGInlineTextBox() const { return false; } virtual bool isSVGRootInlineBox() const { return false; } +#endif - bool hasVirtualHeight() const { return m_hasVirtualHeight; } - void setHasVirtualHeight() { m_hasVirtualHeight = true; } - virtual int virtualHeight() const + bool hasVirtualLogicalHeight() const { return m_hasVirtualLogicalHeight; } + void setHasVirtualLogicalHeight() { m_hasVirtualLogicalHeight = true; } + virtual int virtualLogicalHeight() const { ASSERT_NOT_REACHED(); return 0; } -#endif + + bool isVertical() const { return m_isVertical; } + void setIsVertical(bool v) { m_isVertical = v; } virtual IntRect calculateBoundaries() const { @@ -202,18 +206,40 @@ public: const RootInlineBox* root() const; RootInlineBox* root(); - void setWidth(int w) { m_width = w; } - int width() const { return m_width; } - - // x() is the left side of the box in the parent's coordinate system. + // x() is the left side of the box in the containing block's coordinate system. void setX(int x) { m_x = x; } int x() const { return m_x; } - // y() is the top of the box in the parent's coordinate system. + // y() is the top side of the box in the containing block's coordinate system. void setY(int y) { m_y = y; } int y() const { return m_y; } - int height() const; + // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line. + int logicalLeft() const { return !m_isVertical ? m_x : m_y; } + void setLogicalLeft(int left) + { + if (!m_isVertical) + m_x = left; + else + m_y = left; + } + + // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line. + int logicalTop() const { return !m_isVertical ? m_y : m_x; } + void setLogicalTop(int top) + { + if (!m_isVertical) + m_y = top; + else + m_x = top; + } + + // The logical width is our extent in the line's overall inline direction, i.e., width for horizontal text and height for vertical text. + void setLogicalWidth(int w) { m_logicalWidth = w; } + int logicalWidth() const { return m_logicalWidth; } + + // The logical height is our extent in the block flow direction, i.e., height for horizontal text and width for vertical text. + int logicalHeight() const; inline int baselinePosition(bool isRootLineBox) const { return renderer()->baselinePosition(m_firstLine, isRootLineBox); } inline int lineHeight(bool isRootLineBox) const { return renderer()->lineHeight(m_firstLine, isRootLineBox); } @@ -266,7 +292,7 @@ public: int m_x; int m_y; - int m_width; + int m_logicalWidth; // Some of these bits are actually for subclasses and moved here to compact the structures. @@ -279,7 +305,9 @@ private: protected: bool m_dirty : 1; bool m_extracted : 1; - bool m_hasVirtualHeight : 1; + bool m_hasVirtualLogicalHeight : 1; + + bool m_isVertical : 1; // for RootInlineBox bool m_endsWithBreak : 1; // Whether the line ends with a <br>. @@ -295,7 +323,7 @@ protected: mutable bool m_determinedIfPrevOnLineExists : 1; mutable bool m_nextOnLineExists : 1; mutable bool m_prevOnLineExists : 1; - int m_toAdd : 12; // for justified text + int m_toAdd : 11; // for justified text #ifndef NDEBUG private: diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index a71b796..588d054 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -53,12 +53,12 @@ InlineFlowBox::~InlineFlowBox() #endif -int InlineFlowBox::getFlowSpacingWidth() +int InlineFlowBox::getFlowSpacingLogicalWidth() { - int totWidth = marginBorderPaddingLeft() + marginBorderPaddingRight(); + int totWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight(); for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { if (curr->isInlineFlowBox()) - totWidth += static_cast<InlineFlowBox*>(curr)->getFlowSpacingWidth(); + totWidth += static_cast<InlineFlowBox*>(curr)->getFlowSpacingLogicalWidth(); } return totWidth; } @@ -80,6 +80,7 @@ void InlineFlowBox::addToLine(InlineBox* child) m_lastChild = child; } child->setFirstLineStyleBit(m_firstLine); + child->setIsVertical(m_isVertical); if (child->isText()) m_hasTextChildren = true; if (child->renderer()->selectionState() != RenderObject::SelectionNone) @@ -252,7 +253,7 @@ void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, RenderObject* en } } -int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) +int InlineFlowBox::placeBoxesInInlineDirection(int xPos, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { // Set our x position. setX(xPos); @@ -269,7 +270,7 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp leftVisualOverflow = min(xPos + boxShadowLeft, leftVisualOverflow); int startX = xPos; - xPos += borderLeft() + paddingLeft(); + xPos += borderLogicalLeft() + paddingLogicalLeft(); for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { if (curr->renderer()->isText()) { @@ -287,7 +288,7 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp // If letter-spacing is negative, we should factor that into right layout overflow. (Even in RTL, letter-spacing is // applied to the right, so this is not an issue with left overflow. int letterSpacing = min(0, (int)rt->style(m_firstLine)->font().letterSpacing()); - rightLayoutOverflow = max(xPos + text->width() - letterSpacing, rightLayoutOverflow); + rightLayoutOverflow = max(xPos + text->logicalWidth() - letterSpacing, rightLayoutOverflow); GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(static_cast<InlineTextBox*>(curr)); GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->second.second; @@ -303,9 +304,9 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp } leftVisualOverflow = min(xPos + childOverflowLeft, leftVisualOverflow); - rightVisualOverflow = max(xPos + text->width() + childOverflowRight, rightVisualOverflow); + rightVisualOverflow = max(xPos + text->logicalWidth() + childOverflowRight, rightVisualOverflow); - xPos += text->width(); + xPos += text->logicalWidth(); } else { if (curr->renderer()->isPositioned()) { if (curr->renderer()->parent()->style()->direction() == LTR) @@ -319,9 +320,9 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp } if (curr->renderer()->isRenderInline()) { InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr); - xPos += flow->marginLeft(); - xPos = flow->placeBoxesHorizontally(xPos, needsWordSpacing, textBoxDataMap); - xPos += flow->marginRight(); + xPos += flow->marginLogicalLeft(); + xPos = flow->placeBoxesInInlineDirection(xPos, needsWordSpacing, textBoxDataMap); + xPos += flow->marginLogicalRight(); leftLayoutOverflow = min(leftLayoutOverflow, flow->leftLayoutOverflow()); rightLayoutOverflow = max(rightLayoutOverflow, flow->rightLayoutOverflow()); leftVisualOverflow = min(leftVisualOverflow, flow->leftVisualOverflow()); @@ -332,7 +333,7 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp RenderBox* box = toRenderBox(curr->renderer()); int childLeftOverflow = box->hasOverflowClip() ? 0 : box->leftLayoutOverflow(); - int childRightOverflow = box->hasOverflowClip() ? curr->width() : box->rightLayoutOverflow(); + int childRightOverflow = box->hasOverflowClip() ? curr->logicalWidth() : box->rightLayoutOverflow(); leftLayoutOverflow = min(xPos + childLeftOverflow, leftLayoutOverflow); rightLayoutOverflow = max(xPos + childRightOverflow, rightLayoutOverflow); @@ -340,17 +341,17 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp leftVisualOverflow = min(xPos + box->leftVisualOverflow(), leftVisualOverflow); rightVisualOverflow = max(xPos + box->rightVisualOverflow(), rightVisualOverflow); - xPos += curr->width() + curr->boxModelObject()->marginRight(); + xPos += curr->logicalWidth() + curr->boxModelObject()->marginRight(); } } } - xPos += borderRight() + paddingRight(); - setWidth(xPos - startX); - rightVisualOverflow = max(x() + width() + boxShadowRight, rightVisualOverflow); - rightLayoutOverflow = max(x() + width(), rightLayoutOverflow); + xPos += borderLogicalRight() + paddingLogicalRight(); + setLogicalWidth(xPos - startX); + rightVisualOverflow = max(x() + logicalWidth() + boxShadowRight, rightVisualOverflow); + rightLayoutOverflow = max(x() + logicalWidth(), rightLayoutOverflow); - setHorizontalOverflowPositions(leftLayoutOverflow, rightLayoutOverflow, leftVisualOverflow, rightVisualOverflow); + setInlineDirectionOverflowPositions(leftLayoutOverflow, rightLayoutOverflow, leftVisualOverflow, rightVisualOverflow); return xPos; } @@ -475,7 +476,7 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi } } -void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent, bool strictMode, int& selectionTop, int& selectionBottom) +void InlineFlowBox::placeBoxesInBlockDirection(int yPos, int maxHeight, int maxAscent, bool strictMode, int& selectionTop, int& selectionBottom) { if (isRootInlineBox()) setY(yPos + maxAscent - baselinePosition(true)); // Place our root box. @@ -488,7 +489,7 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent, // line-height). bool isInlineFlow = curr->isInlineFlowBox(); if (isInlineFlow) - static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(yPos, maxHeight, maxAscent, strictMode, selectionTop, selectionBottom); + static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(yPos, maxHeight, maxAscent, strictMode, selectionTop, selectionBottom); bool childAffectsTopBottomPos = true; if (curr->y() == PositionTop) @@ -516,7 +517,7 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent, curr->setY(newY); if (childAffectsTopBottomPos) { - int boxHeight = curr->height(); + int boxHeight = curr->logicalHeight(); selectionTop = min(selectionTop, newY); selectionBottom = max(selectionBottom, newY + boxHeight); } @@ -527,14 +528,14 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent, setY(y() + baselinePosition(true) - font.ascent()); if (hasTextChildren() || strictMode) { selectionTop = min(selectionTop, y()); - selectionBottom = max(selectionBottom, y() + height()); + selectionBottom = max(selectionBottom, y() + logicalHeight()); } } } -void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) +void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { - int boxHeight = height(); + int boxHeight = logicalHeight(); // Any spillage outside of the line top and bottom is not considered overflow. We just ignore this, since it only happens // from the "your ascent/descent don't affect the line" quirk. @@ -583,10 +584,10 @@ void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool st } topVisualOverflow = min(curr->y() + childOverflowTop, topVisualOverflow); - bottomVisualOverflow = max(curr->y() + text->height() + childOverflowBottom, bottomVisualOverflow); + bottomVisualOverflow = max(curr->y() + text->logicalHeight() + childOverflowBottom, bottomVisualOverflow); } else if (curr->renderer()->isRenderInline()) { InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr); - flow->computeVerticalOverflow(lineTop, lineBottom, strictMode, textBoxDataMap); + flow->computeBlockDirectionOverflow(lineTop, lineBottom, strictMode, textBoxDataMap); topLayoutOverflow = min(topLayoutOverflow, flow->topLayoutOverflow()); bottomLayoutOverflow = max(bottomLayoutOverflow, flow->bottomLayoutOverflow()); topVisualOverflow = min(topVisualOverflow, flow->topVisualOverflow()); @@ -596,7 +597,7 @@ void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool st RenderBox* box = toRenderBox(curr->renderer()); int boxY = curr->y(); int childTopOverflow = box->hasOverflowClip() ? 0 : box->topLayoutOverflow(); - int childBottomOverflow = box->hasOverflowClip() ? curr->height() : box->bottomLayoutOverflow(); + int childBottomOverflow = box->hasOverflowClip() ? curr->logicalHeight() : box->bottomLayoutOverflow(); topLayoutOverflow = min(boxY + childTopOverflow, topLayoutOverflow); bottomLayoutOverflow = max(boxY + childBottomOverflow, bottomLayoutOverflow); topVisualOverflow = min(boxY + box->topVisualOverflow(), topVisualOverflow); @@ -604,7 +605,7 @@ void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool st } } - setVerticalOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow, boxHeight); + setBlockDirectionOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow, boxHeight); } bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty) @@ -623,7 +624,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re } // Now check ourselves. - IntRect rect(tx + m_x, ty + m_y, m_width, height()); + IntRect rect(tx + m_x, ty + m_y, m_logicalWidth, logicalHeight()); if (visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); // Don't add in m_x or m_y here, we want coords in the containing block's space. if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) @@ -727,13 +728,13 @@ void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c // but it isn't even clear how this should work at all. int xOffsetOnLine = 0; for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox()) - xOffsetOnLine += curr->width(); + xOffsetOnLine += curr->logicalWidth(); int startX = tx - xOffsetOnLine; int totalWidth = xOffsetOnLine; for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) - totalWidth += curr->width(); + totalWidth += curr->logicalWidth(); paintInfo.context->save(); - paintInfo.context->clip(IntRect(tx, ty, width(), height())); + paintInfo.context->clip(IntRect(tx, ty, logicalWidth(), logicalHeight())); boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, startX, ty, totalWidth, h, this, op); paintInfo.context->restore(); } @@ -746,7 +747,7 @@ void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, Sha else { // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't // protrude incorrectly at the edges, and we want to possibly include shadows cast from the previous/following lines - boxModelObject()->paintBoxShadow(context, tx, ty, w, h, s, shadowStyle, includeLeftEdge(), includeRightEdge()); + boxModelObject()->paintBoxShadow(context, tx, ty, w, h, s, shadowStyle, includeLogicalLeftEdge(), includeLogicalRightEdge()); } } @@ -757,8 +758,8 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) int x = m_x; int y = m_y; - int w = width(); - int h = height(); + int w = logicalWidth(); + int h = logicalHeight(); // Constrain our background/border painting to the line top and bottom if necessary. bool noQuirksMode = renderer()->document()->inNoQuirksMode(); @@ -800,7 +801,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) // The simple case is where we either have no border image or we are the only box for this object. In those // cases only a single call to draw is required. if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) - boxModelObject()->paintBorder(context, tx, ty, w, h, renderer()->style(), includeLeftEdge(), includeRightEdge()); + boxModelObject()->paintBorder(context, tx, ty, w, h, renderer()->style(), includeLogicalLeftEdge(), includeLogicalRightEdge()); else { // We have a border image that spans multiple lines. // We need to adjust _tx and _ty by the width of all previous lines. @@ -812,11 +813,11 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) // but it isn't even clear how this should work at all. int xOffsetOnLine = 0; for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox()) - xOffsetOnLine += curr->width(); + xOffsetOnLine += curr->logicalWidth(); int startX = tx - xOffsetOnLine; int totalWidth = xOffsetOnLine; for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) - totalWidth += curr->width(); + totalWidth += curr->logicalWidth(); context->save(); context->clip(IntRect(tx, ty, w, h)); boxModelObject()->paintBorder(context, startX, ty, totalWidth, h, renderer()->style()); @@ -833,8 +834,8 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty) int x = m_x; int y = m_y; - int w = width(); - int h = height(); + int w = logicalWidth(); + int h = logicalHeight(); // Constrain our background/border painting to the line top and bottom if necessary. bool noQuirksMode = renderer()->document()->inNoQuirksMode(); @@ -883,11 +884,11 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty) // We need to adjust _tx and _ty by the width of all previous lines. int xOffsetOnLine = 0; for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox()) - xOffsetOnLine += curr->width(); + xOffsetOnLine += curr->logicalWidth(); int startX = tx - xOffsetOnLine; int totalWidth = xOffsetOnLine; for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) - totalWidth += curr->width(); + totalWidth += curr->logicalWidth(); paintInfo.context->save(); paintInfo.context->clip(IntRect(tx, ty, w, h)); boxModelObject()->paintNinePieceImage(paintInfo.context, startX, ty, totalWidth, h, renderer()->style(), maskNinePieceImage, compositeOp); @@ -938,12 +939,12 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b if (deco != TDNONE && ((!paintedChildren && ((deco & UNDERLINE) || (deco & OVERLINE))) || (paintedChildren && (deco & LINE_THROUGH))) && shouldDrawTextDecoration(renderer())) { - int x = m_x + borderLeft() + paddingLeft(); - int w = m_width - (borderLeft() + paddingLeft() + borderRight() + paddingRight()); + int x = m_x + borderLogicalLeft() + paddingLogicalLeft(); + int w = m_logicalWidth - (borderLogicalLeft() + paddingLogicalLeft() + borderLogicalRight() + paddingLogicalRight()); RootInlineBox* rootLine = root(); if (rootLine->ellipsisBox()) { int ellipsisX = m_x + rootLine->ellipsisBox()->x(); - int ellipsisWidth = rootLine->ellipsisBox()->width(); + int ellipsisWidth = rootLine->ellipsisBox()->logicalWidth(); bool ltr = renderer()->style()->direction() == LTR; if (rootLine == this) { // Trim w and x so that the underline isn't drawn underneath the ellipsis. @@ -977,7 +978,7 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b } // We must have child boxes and have decorations defined. - tx += borderLeft() + paddingLeft(); + tx += borderLogicalLeft() + paddingLogicalLeft(); Color underline, overline, linethrough; underline = overline = linethrough = styleToUse->visitedDependentColor(CSSPropertyColor); @@ -995,7 +996,7 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b int baselinePos = renderer()->style(m_firstLine)->font().ascent(); if (!isRootInlineBox()) - baselinePos += borderTop() + paddingTop(); + baselinePos += boxModelObject()->borderTop() + boxModelObject()->paddingTop(); bool setClip = false; int extraOffset = 0; @@ -1104,11 +1105,11 @@ int InlineFlowBox::placeEllipsisBox(bool ltr, int blockLeftEdge, int blockRightE result = currResult; if (ltr) { - visibleLeftEdge += box->width(); + visibleLeftEdge += box->logicalWidth(); box = box->nextOnLine(); } else { - visibleRightEdge -= box->width(); + visibleRightEdge -= box->logicalWidth(); box = box->prevOnLine(); } } diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h index b4ba59f..2d57cca 100644 --- a/WebCore/rendering/InlineFlowBox.h +++ b/WebCore/rendering/InlineFlowBox.h @@ -41,8 +41,8 @@ public: , m_lastChild(0) , m_prevLineBox(0) , m_nextLineBox(0) - , m_includeLeftEdge(false) - , m_includeRightEdge(false) + , m_includeLogicalLeftEdge(false) + , m_includeLogicalRightEdge(false) #ifndef NDEBUG , m_hasBadChildList(false) #endif @@ -102,38 +102,65 @@ public: virtual RenderLineBoxList* rendererLineBoxes() const; - int marginBorderPaddingLeft() const { return marginLeft() + borderLeft() + paddingLeft(); } - int marginBorderPaddingRight() const { return marginRight() + borderRight() + paddingRight(); } - int marginLeft() const { if (includeLeftEdge()) return boxModelObject()->marginLeft(); return 0; } - int marginRight() const { if (includeRightEdge()) return boxModelObject()->marginRight(); return 0; } - int borderLeft() const { if (includeLeftEdge()) return renderer()->style()->borderLeftWidth(); return 0; } - int borderRight() const { if (includeRightEdge()) return renderer()->style()->borderRightWidth(); return 0; } - int borderTop() const { return renderer()->style()->borderTopWidth(); } - int borderBottom() const { return renderer()->style()->borderBottomWidth(); } - int paddingLeft() const { if (includeLeftEdge()) return boxModelObject()->paddingLeft(); return 0; } - int paddingRight() const { if (includeRightEdge()) return boxModelObject()->paddingRight(); return 0; } - int paddingTop() const { return boxModelObject()->paddingTop(); } - int paddingBottom() const { return boxModelObject()->paddingBottom(); } - - bool includeLeftEdge() const { return m_includeLeftEdge; } - bool includeRightEdge() const { return m_includeRightEdge; } + // logicalLeft = left in a horizontal line and top in a vertical line. + int marginBorderPaddingLogicalLeft() const { return marginLogicalLeft() + borderLogicalLeft() + paddingLogicalLeft(); } + int marginBorderPaddingLogicalRight() const { return marginLogicalRight() + borderLogicalRight() + paddingLogicalRight(); } + int marginLogicalLeft() const + { + if (!includeLogicalLeftEdge()) + return 0; + return !isVertical() ? boxModelObject()->marginLeft() : boxModelObject()->marginTop(); + } + int marginLogicalRight() const + { + if (!includeLogicalRightEdge()) + return 0; + return !isVertical() ? boxModelObject()->marginRight() : boxModelObject()->marginBottom(); + } + int borderLogicalLeft() const + { + if (!includeLogicalLeftEdge()) + return 0; + return !isVertical() ? renderer()->style()->borderLeftWidth() : renderer()->style()->borderTopWidth(); + } + int borderLogicalRight() const + { + if (!includeLogicalRightEdge()) + return 0; + return !isVertical() ? renderer()->style()->borderRightWidth() : renderer()->style()->borderBottomWidth(); + } + int paddingLogicalLeft() const + { + if (!includeLogicalLeftEdge()) + return 0; + return !isVertical() ? boxModelObject()->paddingLeft() : boxModelObject()->paddingTop(); + } + int paddingLogicalRight() const + { + if (!includeLogicalRightEdge()) + return 0; + return !isVertical() ? boxModelObject()->paddingRight() : boxModelObject()->paddingBottom(); + } + + bool includeLogicalLeftEdge() const { return m_includeLogicalLeftEdge; } + bool includeLogicalRightEdge() const { return m_includeLogicalRightEdge; } void setEdges(bool includeLeft, bool includeRight) { - m_includeLeftEdge = includeLeft; - m_includeRightEdge = includeRight; + m_includeLogicalLeftEdge = includeLeft; + m_includeLogicalRightEdge = includeRight; } // Helper functions used during line construction and placement. void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject); - int getFlowSpacingWidth(); + int getFlowSpacingLogicalWidth(); bool onEndChain(RenderObject* endObject); - int placeBoxesHorizontally(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); + int placeBoxesInInlineDirection(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom, int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&); void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, int maxPositionTop, int maxPositionBottom); - void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom); - void computeVerticalOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&); + void placeBoxesInBlockDirection(int y, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom); + void computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&); void removeChild(InlineBox* child); @@ -151,22 +178,22 @@ public: int bottomVisibleOverflow() const { return std::max(bottomLayoutOverflow(), bottomVisualOverflow()); } int leftVisibleOverflow() const { return std::min(leftLayoutOverflow(), leftVisualOverflow()); } int rightVisibleOverflow() const { return std::max(rightLayoutOverflow(), rightVisualOverflow()); } - IntRect visibleOverflowRect() const { return m_overflow ? m_overflow->visibleOverflowRect() : IntRect(m_x, m_y, m_width, height()); } + IntRect visibleOverflowRect() const { return m_overflow ? m_overflow->visibleOverflowRect() : IntRect(m_x, m_y, m_logicalWidth, logicalHeight()); } int topLayoutOverflow() const { return m_overflow ? m_overflow->topLayoutOverflow() : m_y; } - int bottomLayoutOverflow() const { return m_overflow ? m_overflow->bottomLayoutOverflow() : m_y + height(); } + int bottomLayoutOverflow() const { return m_overflow ? m_overflow->bottomLayoutOverflow() : m_y + logicalHeight(); } int leftLayoutOverflow() const { return m_overflow ? m_overflow->leftLayoutOverflow() : m_x; } - int rightLayoutOverflow() const { return m_overflow ? m_overflow->rightLayoutOverflow() : m_x + m_width; } - IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : IntRect(m_x, m_y, m_width, height()); } + int rightLayoutOverflow() const { return m_overflow ? m_overflow->rightLayoutOverflow() : m_x + m_logicalWidth; } + IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : IntRect(m_x, m_y, m_logicalWidth, logicalHeight()); } int topVisualOverflow() const { return m_overflow ? m_overflow->topVisualOverflow() : m_y; } - int bottomVisualOverflow() const { return m_overflow ? m_overflow->bottomVisualOverflow() : m_y + height(); } + int bottomVisualOverflow() const { return m_overflow ? m_overflow->bottomVisualOverflow() : m_y + logicalHeight(); } int leftVisualOverflow() const { return m_overflow ? m_overflow->leftVisualOverflow() : m_x; } - int rightVisualOverflow() const { return m_overflow ? m_overflow->rightVisualOverflow() : m_x + m_width; } - IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : IntRect(m_x, m_y, m_width, height()); } + int rightVisualOverflow() const { return m_overflow ? m_overflow->rightVisualOverflow() : m_x + m_logicalWidth; } + IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : IntRect(m_x, m_y, m_logicalWidth, logicalHeight()); } - void setHorizontalOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow); - void setVerticalOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight); + void setInlineDirectionOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow); + void setBlockDirectionOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight); protected: OwnPtr<RenderOverflow> m_overflow; @@ -179,8 +206,8 @@ protected: InlineFlowBox* m_prevLineBox; // The previous box that also uses our RenderObject InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObject - bool m_includeLeftEdge : 1; - bool m_includeRightEdge : 1; + bool m_includeLogicalLeftEdge : 1; + bool m_includeLogicalRightEdge : 1; bool m_hasTextChildren : 1; #ifndef NDEBUG @@ -188,12 +215,12 @@ protected: #endif }; -inline void InlineFlowBox::setHorizontalOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow) +inline void InlineFlowBox::setInlineDirectionOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow) { if (!m_overflow) { - if (leftLayoutOverflow == m_x && rightLayoutOverflow == m_x + m_width && leftVisualOverflow == m_x && rightVisualOverflow == m_x + m_width) + if (leftLayoutOverflow == m_x && rightLayoutOverflow == m_x + m_logicalWidth && leftVisualOverflow == m_x && rightVisualOverflow == m_x + m_logicalWidth) return; - m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_width, m_renderer->style(m_firstLine)->font().height()))); + m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_logicalWidth, m_renderer->style(m_firstLine)->font().height()))); } m_overflow->setLeftLayoutOverflow(leftLayoutOverflow); @@ -202,12 +229,12 @@ inline void InlineFlowBox::setHorizontalOverflowPositions(int leftLayoutOverflow m_overflow->setRightVisualOverflow(rightVisualOverflow); } -inline void InlineFlowBox::setVerticalOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight) +inline void InlineFlowBox::setBlockDirectionOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight) { if (!m_overflow) { if (topLayoutOverflow == m_y && bottomLayoutOverflow == m_y + boxHeight && topVisualOverflow == m_y && bottomVisualOverflow == m_y + boxHeight) return; - m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_width, boxHeight))); + m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_logicalWidth, boxHeight))); } m_overflow->setTopLayoutOverflow(topLayoutOverflow); diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index eb5947c..68bff3c 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -139,10 +139,10 @@ IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos) IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride), IntPoint(tx + m_x, ty + selTop), selHeight, sPos, ePos)); - if (r.x() > tx + m_x + m_width) + if (r.x() > tx + m_x + m_logicalWidth) r.setWidth(0); - else if (r.right() - 1 > tx + m_x + m_width) - r.setWidth(tx + m_x + m_width - r.x()); + else if (r.right() - 1 > tx + m_x + m_logicalWidth) + r.setWidth(tx + m_x + m_logicalWidth - r.x()); return r; } @@ -182,7 +182,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis // LTR: the left edge of the ellipsis is to the left of our text run. // RTL: the right edge of the ellipsis is to the right of our text run. bool ltrFullTruncation = flowIsLTR && ellipsisX <= m_x; - bool rtlFullTruncation = !flowIsLTR && ellipsisX >= (m_x + m_width); + bool rtlFullTruncation = !flowIsLTR && ellipsisX >= (m_x + m_logicalWidth); if (ltrFullTruncation || rtlFullTruncation) { // Too far. Just set full truncation, but return -1 and let the ellipsis just be placed at the edge of the box. m_truncation = cFullTruncation; @@ -190,7 +190,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis return -1; } - bool ltrEllipsisWithinBox = flowIsLTR && (ellipsisX < m_x + m_width); + bool ltrEllipsisWithinBox = flowIsLTR && (ellipsisX < m_x + m_logicalWidth); bool rtlEllipsisWithinBox = !flowIsLTR && (ellipsisX > m_x); if (ltrEllipsisWithinBox || rtlEllipsisWithinBox) { foundBox = true; @@ -202,7 +202,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis if (ltr != flowIsLTR) { // Width in pixels of the visible portion of the box, excluding the ellipsis. int visibleBoxWidth = visibleRightEdge - visibleLeftEdge - ellipsisWidth; - ellipsisX = ltr ? m_x + visibleBoxWidth : m_x + m_width - visibleBoxWidth; + ellipsisX = ltr ? m_x + visibleBoxWidth : m_x + m_logicalWidth - visibleBoxWidth; } int offset = offsetForPosition(ellipsisX, false); @@ -228,7 +228,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis if (flowIsLTR) return m_x + widthOfVisibleText; else - return (m_x + m_width) - widthOfVisibleText - ellipsisWidth; + return (m_x + m_logicalWidth) - widthOfVisibleText - ellipsisWidth; } return -1; } @@ -286,7 +286,7 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in if (isLineBreak()) return false; - IntRect rect(tx + m_x, ty + m_y, m_width, height()); + IntRect rect(tx + m_x, ty + m_y, m_logicalWidth, logicalHeight()); if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) @@ -367,9 +367,9 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) // FIXME: Technically we're potentially incorporating other visual overflow that had nothing to do with us. // Would it be simpler to just check our own shadow and stroke overflow by hand here? int leftOverflow = parent()->x() - parent()->leftVisualOverflow(); - int rightOverflow = parent()->rightVisualOverflow() - (parent()->x() + parent()->width()); + int rightOverflow = parent()->rightVisualOverflow() - (parent()->x() + parent()->logicalWidth()); int xPos = tx + m_x - leftOverflow; - int w = width() + leftOverflow + rightOverflow; + int w = logicalWidth() + leftOverflow + rightOverflow; if (xPos >= paintInfo.rect.right() || xPos + w <= paintInfo.rect.x()) return; @@ -393,7 +393,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) // NOTE: WebKit's behavior differs from that of IE which appears to just overlay the ellipsis on top of the // truncated string i.e. |Hello|CBA| -> |...lo|CBA| int widthOfVisibleText = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine); - int widthOfHiddenText = m_width - widthOfVisibleText; + int widthOfHiddenText = m_logicalWidth - widthOfVisibleText; // FIXME: The hit testing logic also needs to take this translation int account. tx += direction() == LTR ? widthOfHiddenText : -widthOfHiddenText; } @@ -526,9 +526,9 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); if (!paintSelectedTextSeparately || ePos <= sPos) { // FIXME: Truncate right-to-left text correctly. - paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, m_x + tx, m_y + ty, width(), height(), textShadow, textStrokeWidth > 0); + paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), textShadow, textStrokeWidth > 0); } else - paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, m_x + tx, m_y + ty, width(), height(), textShadow, textStrokeWidth > 0); + paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), textShadow, textStrokeWidth > 0); if (textStrokeWidth > 0) context->restore(); @@ -540,7 +540,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) context->save(); updateGraphicsContext(context, selectionFillColor, selectionStrokeColor, selectionStrokeWidth, styleToUse->colorSpace()); - paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, m_x + tx, m_y + ty, width(), height(), selectionShadow, selectionStrokeWidth > 0); + paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), selectionShadow, selectionStrokeWidth > 0); if (selectionStrokeWidth > 0) context->restore(); @@ -633,7 +633,7 @@ void InlineTextBox::paintSelection(GraphicsContext* context, int tx, int ty, Ren ePos = length; } - context->clip(IntRect(m_x + tx, y + ty, m_width, h)); + context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h)); context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || style->visuallyOrdered()), IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos); @@ -675,8 +675,8 @@ void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& typ return; RootInlineBox* r = root(); - FloatRect rootRect(tx + r->x(), ty + selectionTop(), r->width(), selectionHeight()); - FloatRect textRect(tx + x(), rootRect.y(), width(), rootRect.height()); + FloatRect rootRect(tx + r->x(), ty + selectionTop(), r->logicalWidth(), selectionHeight()); + FloatRect textRect(tx + x(), rootRect.y(), logicalWidth(), rootRect.height()); page->chrome()->client()->paintCustomHighlight(renderer()->node(), type, textRect, rootRect, true, false); } @@ -691,11 +691,11 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, int tx, int ty, in if (m_truncation == cFullTruncation) return; - int width = m_width; + int width = m_logicalWidth; if (m_truncation != cNoTruncation) { width = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine); if (direction() == RTL) - tx += (m_width - width); + tx += (m_logicalWidth - width); } // Get the text decoration colors. @@ -775,7 +775,7 @@ static GraphicsContext::TextCheckingLineStyle textCheckingLineStyleForMarkerType return GraphicsContext::TextCheckingSpellingLineStyle; case DocumentMarker::Grammar: return GraphicsContext::TextCheckingGrammarLineStyle; - case DocumentMarker::Replacement: + case DocumentMarker::CorrectionIndicator: return GraphicsContext::TextCheckingReplacementLineStyle; default: ASSERT_NOT_REACHED(); @@ -793,7 +793,7 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, in return; int start = 0; // start of line to draw, relative to tx - int width = m_width; // how much line to draw + int width = m_logicalWidth; // how much line to draw // Determine whether we need to measure text bool markerSpansWholeBox = true; @@ -837,11 +837,11 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, in // we pin to two pixels under the baseline. int lineThickness = cMisspellingLineThickness; int baseline = renderer()->style(m_firstLine)->font().ascent(); - int descent = height() - baseline; + int descent = logicalHeight() - baseline; int underlineOffset; if (descent <= (2 + lineThickness)) { // Place the underline at the very bottom of the text in small/medium fonts. - underlineOffset = height() - lineThickness; + underlineOffset = logicalHeight() - lineThickness; } else { // In larger fonts, though, place the underline up near the baseline to prevent a big gap. underlineOffset = baseline + 2; @@ -872,7 +872,7 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, co renderer()->theme()->platformInactiveTextSearchHighlightColor(); pt->save(); updateGraphicsContext(pt, color, color, 0, style->colorSpace()); // Don't draw text at all! - pt->clip(IntRect(tx + m_x, ty + y, m_width, h)); + pt->clip(IntRect(tx + m_x, ty + y, m_logicalWidth, h)); pt->drawHighlightForText(font, run, IntPoint(m_x + tx, y + ty), h, color, style->colorSpace(), sPos, ePos); pt->restore(); } @@ -913,6 +913,7 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, Re case DocumentMarker::Grammar: case DocumentMarker::Spelling: case DocumentMarker::Replacement: + case DocumentMarker::CorrectionIndicator: case DocumentMarker::RejectedCorrection: if (background) continue; @@ -946,10 +947,11 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, Re case DocumentMarker::TextMatch: paintTextMatchMarker(pt, tx, ty, marker, style, font); break; - case DocumentMarker::Replacement: + case DocumentMarker::CorrectionIndicator: computeRectForReplacementMarker(tx, ty, marker, style, font); paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false); break; + case DocumentMarker::Replacement: case DocumentMarker::RejectedCorrection: break; default: @@ -969,7 +971,7 @@ void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int return; int start = 0; // start of line to draw, relative to tx - int width = m_width; // how much line to draw + int width = m_logicalWidth; // how much line to draw bool useWholeWidth = true; unsigned paintStart = m_start; unsigned paintEnd = end() + 1; // end points at the last char, not past it @@ -995,7 +997,7 @@ void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int // If there's not enough space the underline will touch or overlap characters. int lineThickness = 1; int baseline = renderer()->style(m_firstLine)->font().ascent(); - if (underline.thick && height() - baseline >= 2) + if (underline.thick && logicalHeight() - baseline >= 2) lineThickness = 2; // We need to have some space between underlines of subsequent clauses, because some input methods do not use different underline styles for those. @@ -1005,7 +1007,7 @@ void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int ctx->setStrokeColor(underline.color, renderer()->style()->colorSpace()); ctx->setStrokeThickness(lineThickness); - ctx->drawLineForText(IntPoint(tx + start, ty + height() - lineThickness), width, textRenderer()->document()->printing()); + ctx->drawLineForText(IntPoint(tx + start, ty + logicalHeight() - lineThickness), width, textRenderer()->document()->printing()); } int InlineTextBox::caretMinOffset() const diff --git a/WebCore/rendering/InlineTextBox.h b/WebCore/rendering/InlineTextBox.h index 7d828f3..2bf099b 100644 --- a/WebCore/rendering/InlineTextBox.h +++ b/WebCore/rendering/InlineTextBox.h @@ -74,7 +74,7 @@ private: virtual int selectionHeight(); public: - virtual IntRect calculateBoundaries() const { return IntRect(x(), y(), width(), height()); } + virtual IntRect calculateBoundaries() const { return IntRect(x(), y(), logicalWidth(), logicalHeight()); } virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos); bool isSelected(int startPos, int endPos) const; @@ -102,7 +102,7 @@ private: public: virtual bool isLineBreak() const; - void setSpaceAdd(int add) { m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd; } + void setSpaceAdd(int add) { m_logicalWidth -= m_toAdd; m_toAdd = add; m_logicalWidth += m_toAdd; } private: virtual bool isInlineTextBox() const { return true; } diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 5533326..adaac03 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -345,12 +345,11 @@ bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo, const String& type) +MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo) : HTMLInputElement(inputTag, mediaElement->document()) , m_mediaElement(mediaElement) , m_pseudoStyleId(pseudo) { - setType(type); setInDocument(); switch (pseudo) { @@ -484,13 +483,15 @@ void MediaControlInputElement::setDisplayType(MediaControlElementType displayTyp // ---------------------------- inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, ButtonLocation location) - : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON, "button") + : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON) { } PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement, ButtonLocation location) { - return adoptRef(new MediaControlMuteButtonElement(mediaElement, location)); + RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, location)); + button->setType("button"); + return button.release(); } void MediaControlMuteButtonElement::defaultEventHandler(Event* event) @@ -510,13 +511,15 @@ void MediaControlMuteButtonElement::updateDisplayType() // ---------------------------- inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(HTMLMediaElement* mediaElement) - : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON, "button") + : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON) { } PassRefPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlPlayButtonElement(mediaElement)); + RefPtr<MediaControlPlayButtonElement> button = adoptRef(new MediaControlPlayButtonElement(mediaElement)); + button->setType("button"); + return button.release(); } void MediaControlPlayButtonElement::defaultEventHandler(Event* event) @@ -536,7 +539,7 @@ void MediaControlPlayButtonElement::updateDisplayType() // ---------------------------- inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, PseudoId pseudoId) - : MediaControlInputElement(mediaElement, pseudoId, "button") + : MediaControlInputElement(mediaElement, pseudoId) , m_seeking(false) , m_capturing(false) , m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired) @@ -545,7 +548,9 @@ inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaEle PassRefPtr<MediaControlSeekButtonElement> MediaControlSeekButtonElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId) { - return adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId)); + RefPtr<MediaControlSeekButtonElement> button = adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId)); + button->setType("button"); + return button.release(); } inline bool MediaControlSeekButtonElement::isForwardButton() const @@ -603,13 +608,15 @@ void MediaControlSeekButtonElement::detach() // ---------------------------- inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(HTMLMediaElement* element) - : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON, "button") + : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON) { } PassRefPtr<MediaControlRewindButtonElement> MediaControlRewindButtonElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlRewindButtonElement(mediaElement)); + RefPtr<MediaControlRewindButtonElement> button = adoptRef(new MediaControlRewindButtonElement(mediaElement)); + button->setType("button"); + return button.release(); } void MediaControlRewindButtonElement::defaultEventHandler(Event* event) @@ -621,17 +628,18 @@ void MediaControlRewindButtonElement::defaultEventHandler(Event* event) HTMLInputElement::defaultEventHandler(event); } - // ---------------------------- inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(HTMLMediaElement* mediaElement) - : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button") + : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON) { } PassRefPtr<MediaControlReturnToRealtimeButtonElement> MediaControlReturnToRealtimeButtonElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlReturnToRealtimeButtonElement(mediaElement)); + RefPtr<MediaControlReturnToRealtimeButtonElement> button = adoptRef(new MediaControlReturnToRealtimeButtonElement(mediaElement)); + button->setType("button"); + return button.release(); } void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event) @@ -647,13 +655,15 @@ void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event // ---------------------------- inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement* mediaElement) - : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON, "button") + : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON) { } PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> MediaControlToggleClosedCaptionsButtonElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlToggleClosedCaptionsButtonElement(mediaElement)); + RefPtr<MediaControlToggleClosedCaptionsButtonElement> button = adoptRef(new MediaControlToggleClosedCaptionsButtonElement(mediaElement)); + button->setType("button"); + return button.release(); } void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* event) @@ -674,13 +684,15 @@ void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() // ---------------------------- MediaControlTimelineElement::MediaControlTimelineElement(HTMLMediaElement* mediaElement) - : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE, "range") + : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE) { } PassRefPtr<MediaControlTimelineElement> MediaControlTimelineElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlTimelineElement(mediaElement)); + RefPtr<MediaControlTimelineElement> timeline = adoptRef(new MediaControlTimelineElement(mediaElement)); + timeline->setType("range"); + return timeline.release(); } void MediaControlTimelineElement::defaultEventHandler(Event* event) @@ -727,13 +739,15 @@ void MediaControlTimelineElement::update(bool updateDuration) // ---------------------------- inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(HTMLMediaElement* mediaElement) - : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER, "range") + : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER) { } PassRefPtr<MediaControlVolumeSliderElement> MediaControlVolumeSliderElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlVolumeSliderElement(mediaElement)); + RefPtr<MediaControlVolumeSliderElement> slider = adoptRef(new MediaControlVolumeSliderElement(mediaElement)); + slider->setType("range"); + return slider.release(); } void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) @@ -769,13 +783,15 @@ void MediaControlVolumeSliderElement::update() // ---------------------------- inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(HTMLMediaElement* mediaElement) - : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button") + : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON) { } PassRefPtr<MediaControlFullscreenButtonElement> MediaControlFullscreenButtonElement::create(HTMLMediaElement* mediaElement) { - return adoptRef(new MediaControlFullscreenButtonElement(mediaElement)); + RefPtr<MediaControlFullscreenButtonElement> button = adoptRef(new MediaControlFullscreenButtonElement(mediaElement)); + button->setType("button"); + return button.release(); } void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) diff --git a/WebCore/rendering/MediaControlElements.h b/WebCore/rendering/MediaControlElements.h index 1dcf6be..a9ffb0b 100644 --- a/WebCore/rendering/MediaControlElements.h +++ b/WebCore/rendering/MediaControlElements.h @@ -178,7 +178,7 @@ public: HTMLMediaElement* mediaElement() const { return m_mediaElement; } protected: - MediaControlInputElement(HTMLMediaElement*, PseudoId, const String& type); + MediaControlInputElement(HTMLMediaElement*, PseudoId); void setDisplayType(MediaControlElementType); diff --git a/WebCore/rendering/RenderApplet.cpp b/WebCore/rendering/RenderApplet.cpp index 12eb4fb..63a18a0 100644 --- a/WebCore/rendering/RenderApplet.cpp +++ b/WebCore/rendering/RenderApplet.cpp @@ -79,8 +79,8 @@ void RenderApplet::layout() { ASSERT(needsLayout()); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); // The applet's widget gets created lazily upon first layout. createWidgetIfNecessary(); diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 0e44b32..1e378d8 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -82,33 +82,34 @@ static int gDelayUpdateScrollInfo = 0; static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; // Our MarginInfo state used when laying out block children. -RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int top, int bottom) +RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding, int afterBorderPadding) + : m_atBeforeSideOfBlock(true) + , m_atAfterSideOfBlock(false) + , m_marginBeforeQuirk(false) + , m_marginAfterQuirk(false) + , m_determinedMarginBeforeQuirk(false) { // Whether or not we can collapse our own margins with our children. We don't do this // if we had any border/padding (obviously), if we're the root or HTML elements, or if // we're positioned, floating, a table cell. - m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() && - !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable(); + m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() + && !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable() + && !block->isBlockFlowRoot(); - m_canCollapseTopWithChildren = m_canCollapseWithChildren && (top == 0) && block->style()->marginTopCollapse() != MSEPARATE; + m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && (beforeBorderPadding == 0) && block->style()->marginBeforeCollapse() != MSEPARATE; // If any height other than auto is specified in CSS, then we don't collapse our bottom // margins with our children's margins. To do otherwise would be to risk odd visual // effects when the children overflow out of the parent block and yet still collapse // with it. We also don't collapse if we have any bottom border/padding. - m_canCollapseBottomWithChildren = m_canCollapseWithChildren && (bottom == 0) && - (block->style()->height().isAuto() && block->style()->height().value() == 0) && block->style()->marginBottomCollapse() != MSEPARATE; + m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && (afterBorderPadding == 0) && + (block->style()->logicalHeight().isAuto() && block->style()->logicalHeight().value() == 0) && block->style()->marginAfterCollapse() != MSEPARATE; - m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginTopCollapse() == MDISCARD || - block->style()->marginBottomCollapse() == MDISCARD; + m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginBeforeCollapse() == MDISCARD || + block->style()->marginAfterCollapse() == MDISCARD; - m_atTopOfBlock = true; - m_atBottomOfBlock = false; - - m_posMargin = m_canCollapseTopWithChildren ? block->maxTopMargin(true) : 0; - m_negMargin = m_canCollapseTopWithChildren ? block->maxTopMargin(false) : 0; - - m_topQuirk = m_bottomQuirk = m_determinedTopQuirk = false; + m_posMargin = m_canCollapseMarginBeforeWithChildren ? block->maxMarginBefore(RenderBox::PositiveMargin) : 0; + m_negMargin = m_canCollapseMarginBeforeWithChildren ? block->maxMarginBefore(RenderBox::NegativeMargin) : 0; } // ------------------------------------------------------------------------------------------------------- @@ -337,7 +338,7 @@ void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render ASSERT(!continuation()); // We don't yet support column spans that aren't immediate children of the multi-column block. // The goal is to locate a suitable box in which to place our child. - RenderBlock* beforeChildParent = toRenderBlock(beforeChild ? beforeChild->parent() : lastChild()); + RenderBlock* beforeChildParent = toRenderBlock(beforeChild && beforeChild->parent()->isRenderBlock() ? beforeChild->parent() : lastChild()); // If the new child is floating or positioned it can just go in that block. if (newChild->isFloatingOrPositioned()) @@ -614,7 +615,7 @@ RenderBlock* RenderBlock::columnsBlockForSpanningElement(RenderObject* newChild) && !newChild->isInline() && !isAnonymousColumnSpanBlock()) { if (style()->specifiesColumns()) columnsBlockAncestor = this; - else + else if (parent() && parent()->isRenderBlock()) columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlock(false); } return columnsBlockAncestor; @@ -1011,9 +1012,6 @@ void RenderBlock::removeChild(RenderObject* oldChild) // If this was our last child be sure to clear out our line boxes. if (childrenInline()) lineBoxes()->deleteLineBoxes(renderArena()); - // If we're now an empty anonymous columns or column span block, then go ahead and delete ourselves. - else if ((isAnonymousColumnsBlock() || isAnonymousColumnSpanBlock()) && parent() && parent()->isRenderBlock() && !continuation()) - destroy(); } } @@ -1028,7 +1026,7 @@ bool RenderBlock::isSelfCollapsingBlock() const if (height() > 0 || isTable() || borderAndPaddingHeight() || style()->minHeight().isPositive() - || style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE) + || style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterCollapse() == MSEPARATE) return false; bool hasAutoHeight = style()->height().isAuto(); @@ -1130,12 +1128,12 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight) int oldWidth = width(); int oldColumnWidth = desiredColumnWidth(); - calcWidth(); + computeLogicalWidth(); calcColumnWidth(); m_overflow.clear(); - if (oldWidth != width() || oldColumnWidth != desiredColumnWidth()) + if (oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth()) relayoutChildren = true; #ifdef ANDROID_LAYOUT @@ -1144,21 +1142,21 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight) clearFloats(); - int previousHeight = height(); - setHeight(0); + int previousHeight = logicalHeight(); + setLogicalHeight(0); bool hasSpecifiedPageHeight = false; ColumnInfo* colInfo = columnInfo(); if (hasColumns()) { if (!pageHeight) { // We need to go ahead and set our explicit page height if one exists, so that we can // avoid doing two layout passes. - calcHeight(); - int columnHeight = contentHeight(); + computeLogicalHeight(); + int columnHeight = contentLogicalHeight(); if (columnHeight > 0) { pageHeight = columnHeight; hasSpecifiedPageHeight = true; } - setHeight(0); + setLogicalHeight(0); } if (colInfo->columnHeight() != pageHeight && m_everHadLayout) { colInfo->setColumnHeight(pageHeight); @@ -1185,14 +1183,14 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight) if (!isCell) { initMaxMarginValues(); - setTopMarginQuirk(style()->marginTop().quirk()); - setBottomMarginQuirk(style()->marginBottom().quirk()); + setMarginBeforeQuirk(style()->marginBefore().quirk()); + setMarginAfterQuirk(style()->marginAfter().quirk()); Node* n = node(); if (n && n->hasTagName(formTag) && static_cast<HTMLFormElement*>(n)->isMalformed()) { // See if this form is malformed (i.e., unclosed). If so, don't give the form // a bottom margin. - setMaxBottomMargins(0, 0); + setMaxMarginAfterValues(0, 0); } setPaginationStrut(0); @@ -1217,30 +1215,31 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight) layoutBlockChildren(relayoutChildren, maxFloatBottom); // Expand our intrinsic height to encompass floats. - int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight(); - if (floatBottom() > (height() - toAdd) && expandsToEncloseOverhangingFloats()) - setHeight(floatBottom() + toAdd); + int toAdd = borderAfter() + paddingAfter() + horizontalScrollbarHeight(); // FIXME: https://bugs.webkit.org/show_bug.cgi?id=46645, overflow and block-flow. + if (floatBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats()) + setLogicalHeight(floatBottom() + toAdd); if (layoutColumns(hasSpecifiedPageHeight, pageHeight, statePusher)) return; // Calculate our new height. - int oldHeight = height(); - calcHeight(); - if (oldHeight != height()) { - if (oldHeight > height() && maxFloatBottom > height() && !childrenInline()) { + int oldHeight = logicalHeight(); + computeLogicalHeight(); + int newHeight = logicalHeight(); + if (oldHeight != newHeight) { + if (oldHeight > newHeight && maxFloatBottom > newHeight && !childrenInline()) { // One of our children's floats may have become an overhanging float for us. We need to look for it. for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isBlockFlow() && !child->isFloatingOrPositioned()) { RenderBlock* block = toRenderBlock(child); - if (block->floatBottom() + block->y() > height()) + if (block->floatBottom() + block->logicalTop() > newHeight) addOverhangingFloats(block, -block->x(), -block->y(), false); } } } } - if (previousHeight != height()) + if (previousHeight != newHeight) relayoutChildren = true; // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). @@ -1326,7 +1325,8 @@ void RenderBlock::addOverflowFromFloats() bool RenderBlock::expandsToEncloseOverhangingFloats() const { - return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) || hasColumns() || isTableCell() || isFieldset(); + return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) + || hasColumns() || isTableCell() || isFieldset() || isBlockFlowRoot(); } void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo) @@ -1340,8 +1340,8 @@ void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marg if (child->style()->hasStaticY()) { int y = height(); - if (!marginInfo.canCollapseWithTop()) { - child->calcVerticalMargins(); + if (!marginInfo.canCollapseWithMarginBefore()) { + child->computeBlockDirectionMargins(this); int marginTop = child->marginTop(); int collapsedTopPos = marginInfo.posMargin(); int collapsedTopNeg = marginInfo.negMargin(); @@ -1374,13 +1374,13 @@ void RenderBlock::adjustFloatingBlock(const MarginInfo& marginInfo) // Note also that the previous flow may collapse its margin into the top of // our block. If this is the case, then we do not add the margin in to our // height when computing the position of the float. This condition can be tested - // for by simply calling canCollapseWithTop. See + // for by simply calling canCollapseWithMarginBefore. See // http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for // an example of this scenario. - int marginOffset = marginInfo.canCollapseWithTop() ? 0 : marginInfo.margin(); - setHeight(height() + marginOffset); + int marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin(); + setLogicalHeight(height() + marginOffset); positionNewFloats(); - setHeight(height() - marginOffset); + setLogicalHeight(height() - marginOffset); } bool RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& marginInfo) @@ -1462,7 +1462,8 @@ bool RenderBlock::handleRunInChild(RenderBox* child) if (runInNode) runInNode->setRenderer(inlineRunIn); - // Destroy the block run-in. + // Destroy the block run-in, which includes deleting its line box tree. + blockRunIn->deleteLineBoxTree(); blockRunIn->destroy(); // The block acts like an inline, so just null out its @@ -1474,47 +1475,47 @@ bool RenderBlock::handleRunInChild(RenderBox* child) int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) { // Get our max pos and neg top margins. - int posTop = child->maxTopMargin(true); - int negTop = child->maxTopMargin(false); + int posTop = child->maxMarginBefore(PositiveMargin); + int negTop = child->maxMarginBefore(NegativeMargin); // For self-collapsing blocks, collapse our bottom margins into our // top to get new posTop and negTop values. if (child->isSelfCollapsingBlock()) { - posTop = max(posTop, child->maxBottomMargin(true)); - negTop = max(negTop, child->maxBottomMargin(false)); + posTop = max(posTop, child->maxMarginAfter(PositiveMargin)); + negTop = max(negTop, child->maxMarginAfter(NegativeMargin)); } // See if the top margin is quirky. We only care if this child has // margins that will collapse with us. - bool topQuirk = child->isTopMarginQuirk() || style()->marginTopCollapse() == MDISCARD; + bool topQuirk = child->isMarginBeforeQuirk() || style()->marginBeforeCollapse() == MDISCARD; - if (marginInfo.canCollapseWithTop()) { + if (marginInfo.canCollapseWithMarginBefore()) { // This child is collapsing with the top of the // block. If it has larger margin values, then we need to update // our own maximal values. if (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !topQuirk) - setMaxTopMargins(max(posTop, maxTopPosMargin()), max(negTop, maxTopNegMargin())); + setMaxMarginBeforeValues(max(posTop, maxPosMarginBefore()), max(negTop, maxNegMarginBefore())); // The minute any of the margins involved isn't a quirk, don't // collapse it away, even if the margin is smaller (www.webreference.com // has an example of this, a <dt> with 0.8em author-specified inside // a <dl> inside a <td>. - if (!marginInfo.determinedTopQuirk() && !topQuirk && (posTop-negTop)) { - setTopMarginQuirk(false); - marginInfo.setDeterminedTopQuirk(true); + if (!marginInfo.determinedMarginBeforeQuirk() && !topQuirk && (posTop-negTop)) { + setMarginBeforeQuirk(false); + marginInfo.setDeterminedMarginBeforeQuirk(true); } - if (!marginInfo.determinedTopQuirk() && topQuirk && marginTop() == 0) + if (!marginInfo.determinedMarginBeforeQuirk() && topQuirk && marginTop() == 0) // We have no top margin and our top child has a quirky margin. // We will pick up this quirky margin and pass it through. // This deals with the <td><div><p> case. // Don't do this for a block that split two inlines though. You do // still apply margins in this case. - setTopMarginQuirk(true); + setMarginBeforeQuirk(true); } - if (marginInfo.quirkContainer() && marginInfo.atTopOfBlock() && (posTop - negTop)) - marginInfo.setTopQuirk(topQuirk); + if (marginInfo.quirkContainer() && marginInfo.atBeforeSideOfBlock() && (posTop - negTop)) + marginInfo.setMarginBeforeQuirk(topQuirk); int beforeCollapseY = height(); int ypos = beforeCollapseY; @@ -1522,16 +1523,16 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) // This child has no height. We need to compute our // position before we collapse the child's margins together, // so that we can get an accurate position for the zero-height block. - int collapsedTopPos = max(marginInfo.posMargin(), child->maxTopMargin(true)); - int collapsedTopNeg = max(marginInfo.negMargin(), child->maxTopMargin(false)); + int collapsedTopPos = max(marginInfo.posMargin(), child->maxMarginBefore(PositiveMargin)); + int collapsedTopNeg = max(marginInfo.negMargin(), child->maxMarginBefore(NegativeMargin)); marginInfo.setMargin(collapsedTopPos, collapsedTopNeg); // Now collapse the child's margins together, which means examining our // bottom margin values as well. - marginInfo.setPosMarginIfLarger(child->maxBottomMargin(true)); - marginInfo.setNegMarginIfLarger(child->maxBottomMargin(false)); + marginInfo.setPosMarginIfLarger(child->maxMarginAfter(PositiveMargin)); + marginInfo.setNegMarginIfLarger(child->maxMarginAfter(NegativeMargin)); - if (!marginInfo.canCollapseWithTop()) + if (!marginInfo.canCollapseWithMarginBefore()) // We need to make sure that the position of the self-collapsing block // is correct, since it could have overflowing content // that needs to be positioned correctly (e.g., a block that @@ -1539,24 +1540,24 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) ypos = height() + collapsedTopPos - collapsedTopNeg; } else { - if (child->style()->marginTopCollapse() == MSEPARATE) { - setHeight(height() + marginInfo.margin() + child->marginTop()); + if (child->style()->marginBeforeCollapse() == MSEPARATE) { + setLogicalHeight(height() + marginInfo.margin() + child->marginTop()); ypos = height(); } - else if (!marginInfo.atTopOfBlock() || - (!marginInfo.canCollapseTopWithChildren() - && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.topQuirk()))) { + else if (!marginInfo.atBeforeSideOfBlock() || + (!marginInfo.canCollapseMarginBeforeWithChildren() + && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.marginBeforeQuirk()))) { // We're collapsing with a previous sibling's margins and not // with the top of the block. - setHeight(height() + max(marginInfo.posMargin(), posTop) - max(marginInfo.negMargin(), negTop)); + setLogicalHeight(height() + max(marginInfo.posMargin(), posTop) - max(marginInfo.negMargin(), negTop)); ypos = height(); } - marginInfo.setPosMargin(child->maxBottomMargin(true)); - marginInfo.setNegMargin(child->maxBottomMargin(false)); + marginInfo.setPosMargin(child->maxMarginAfter(PositiveMargin)); + marginInfo.setNegMargin(child->maxMarginAfter(NegativeMargin)); if (marginInfo.margin()) - marginInfo.setBottomQuirk(child->isBottomMarginQuirk() || style()->marginBottomCollapse() == MDISCARD); + marginInfo.setMarginAfterQuirk(child->isMarginAfterQuirk() || style()->marginAfterCollapse() == MDISCARD); } // If margins would pull us past the top of the next page, then we need to pull back and pretend like the margins @@ -1565,7 +1566,7 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) if (paginated && ypos > beforeCollapseY) { int oldY = ypos; ypos = min(ypos, nextPageTop(beforeCollapseY)); - setHeight(height() + (ypos - oldY)); + setLogicalHeight(height() + (ypos - oldY)); } return ypos; } @@ -1590,28 +1591,28 @@ int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, i atBottomOfBlock = false; } if (atBottomOfBlock) { - marginInfo.setPosMargin(child->maxBottomMargin(true)); - marginInfo.setNegMargin(child->maxBottomMargin(false)); + marginInfo.setPosMargin(child->maxMarginAfter(PositiveMargin)); + marginInfo.setNegMargin(child->maxMarginAfter(NegativeMargin)); } else { - marginInfo.setPosMargin(max(child->maxTopMargin(true), child->maxBottomMargin(true))); - marginInfo.setNegMargin(max(child->maxTopMargin(false), child->maxBottomMargin(false))); + marginInfo.setPosMargin(max(child->maxMarginBefore(PositiveMargin), child->maxMarginAfter(PositiveMargin))); + marginInfo.setNegMargin(max(child->maxMarginBefore(NegativeMargin), child->maxMarginAfter(NegativeMargin))); } // Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom // of the parent block). - setHeight(child->y() - max(0, marginInfo.margin())); + setLogicalHeight(child->y() - max(0, marginInfo.margin())); } else // Increase our height by the amount we had to clear. - setHeight(height() + heightIncrease); + setLogicalHeight(height() + heightIncrease); - if (marginInfo.canCollapseWithTop()) { + if (marginInfo.canCollapseWithMarginBefore()) { // We can no longer collapse with the top of the block since a clear // occurred. The empty blocks collapse into the cleared block. // FIXME: This isn't quite correct. Need clarification for what to do // if the height the cleared block is offset by is smaller than the // margins involved. - setMaxTopMargins(oldTopPosMargin, oldTopNegMargin); - marginInfo.setAtTopOfBlock(false); + setMaxMarginBeforeValues(oldTopPosMargin, oldTopNegMargin); + marginInfo.setAtBeforeSideOfBlock(false); } return yPos + heightIncrease; @@ -1622,8 +1623,8 @@ int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& ma // FIXME: We need to eliminate the estimation of vertical position, because when it's wrong we sometimes trigger a pathological // relayout if there are intruding floats. int yPosEstimate = height(); - if (!marginInfo.canCollapseWithTop()) { - int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginTop(); + if (!marginInfo.canCollapseWithMarginBefore()) { + int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginBefore(); yPosEstimate += max(marginInfo.margin(), childMarginTop); } @@ -1660,7 +1661,7 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child) // Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats. They need // to shift over as necessary to dodge any floats that might get in the way. if (child->avoidsFloats()) { - int leftOff = leftOffset(height(), false); + int leftOff = logicalLeftOffsetForLine(height(), false); if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginLeft().type() != Auto) { if (child->marginLeft() < 0) leftOff += child->marginLeft(); @@ -1670,19 +1671,19 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child) // The object is shifting right. The object might be centered, so we need to // recalculate our horizontal margins. Note that the containing block content // width computation will take into account the delta between |leftOff| and |xPos| - // so that we can just pass the content width in directly to the |calcHorizontalMargins| + // so that we can just pass the content width in directly to the |computeMarginsInContainingBlockInlineDirection| // function. - child->calcHorizontalMargins(child->style()->marginLeft(), child->style()->marginRight(), lineWidth(child->y(), false)); + child->computeInlineDirectionMargins(this, availableLogicalWidthForLine(child->y(), false), child->width()); chPos = leftOff + child->marginLeft(); } } view()->addLayoutDelta(IntSize(child->x() - chPos, 0)); child->setLocation(chPos, child->y()); } else { - xPos += availableWidth(); + xPos += availableLogicalWidth(); int chPos = xPos - (child->width() + child->marginRight()); if (child->avoidsFloats()) { - int rightOff = rightOffset(height(), false); + int rightOff = logicalRightOffsetForLine(height(), false); if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginRight().type() != Auto) { if (child->marginRight() < 0) rightOff -= child->marginRight(); @@ -1691,9 +1692,9 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child) // The object is shifting left. The object might be centered, so we need to // recalculate our horizontal margins. Note that the containing block content // width computation will take into account the delta between |rightOff| and |xPos| - // so that we can just pass the content width in directly to the |calcHorizontalMargins| + // so that we can just pass the content width in directly to the |computeInlineDirectionMargins| // function. - child->calcHorizontalMargins(child->style()->marginLeft(), child->style()->marginRight(), lineWidth(child->y(), false)); + child->computeInlineDirectionMargins(this, availableLogicalWidthForLine(child->y(), false), child->width()); chPos = rightOff - child->marginRight() - child->width(); } } @@ -1704,37 +1705,37 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child) void RenderBlock::setCollapsedBottomMargin(const MarginInfo& marginInfo) { - if (marginInfo.canCollapseWithBottom() && !marginInfo.canCollapseWithTop()) { + if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore()) { // Update our max pos/neg bottom margins, since we collapsed our bottom margins // with our children. - setMaxBottomMargins(max(maxBottomPosMargin(), marginInfo.posMargin()), max(maxBottomNegMargin(), marginInfo.negMargin())); + setMaxMarginAfterValues(max(maxPosMarginAfter(), marginInfo.posMargin()), max(maxNegMarginAfter(), marginInfo.negMargin())); - if (!marginInfo.bottomQuirk()) - setBottomMarginQuirk(false); + if (!marginInfo.marginAfterQuirk()) + setMarginAfterQuirk(false); - if (marginInfo.bottomQuirk() && marginBottom() == 0) + if (marginInfo.marginAfterQuirk() && marginBottom() == 0) // We have no bottom margin and our last child has a quirky margin. // We will pick up this quirky margin and pass it through. // This deals with the <td><div><p> case. - setBottomMarginQuirk(true); + setMarginAfterQuirk(true); } } void RenderBlock::handleBottomOfBlock(int top, int bottom, MarginInfo& marginInfo) { - marginInfo.setAtBottomOfBlock(true); + marginInfo.setAtAfterSideOfBlock(true); // If we can't collapse with children then go ahead and add in the bottom margin. - if (!marginInfo.canCollapseWithBottom() && !marginInfo.canCollapseWithTop() - && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.bottomQuirk())) - setHeight(height() + marginInfo.margin()); + if (!marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore() + && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.marginAfterQuirk())) + setLogicalHeight(height() + marginInfo.margin()); // Now add in our bottom border/padding. - setHeight(height() + bottom); + setLogicalHeight(height() + bottom); // Negative margins can cause our height to shrink below our minimal height (border/padding). // If this happens, ensure that the computed height is increased to the minimal height. - setHeight(max(height(), top + bottom)); + setLogicalHeight(max(height(), top + bottom)); // Update our bottom collapsed margin info. setCollapsedBottomMargin(marginInfo); @@ -1763,7 +1764,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom int top = borderTop() + paddingTop(); int bottom = borderBottom() + paddingBottom() + horizontalScrollbarHeight(); - setHeight(top); + setLogicalHeight(top); // The margin struct caches all our current margin collapsing state. The compact struct caches state when we encounter compacts, MarginInfo marginInfo(this, top, bottom); @@ -1792,7 +1793,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom // If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths. if (relayoutChildren && (child->style()->paddingLeft().isPercent() || child->style()->paddingRight().isPercent())) - child->setPrefWidthsDirty(true, false); + child->setPreferredLogicalWidthsDirty(true, false); // Handle the four types of special elements first. These include positioned content, floating content, compacts and // run-ins. When we encounter these four types of objects, we don't actually lay them out as normal flow blocks. @@ -1810,15 +1811,15 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatBottom, int& maxFloatBottom) { - int oldTopPosMargin = maxTopPosMargin(); - int oldTopNegMargin = maxTopNegMargin(); + int oldTopPosMargin = maxPosMarginBefore(); + int oldTopNegMargin = maxNegMarginBefore(); // The child is a normal flow object. Compute its vertical margins now. - child->calcVerticalMargins(); + child->computeBlockDirectionMargins(this); // Do not allow a collapse if the margin top collapse style is set to SEPARATE. - if (child->style()->marginTopCollapse() == MSEPARATE) { - marginInfo.setAtTopOfBlock(false); + if (child->style()->marginBeforeCollapse() == MSEPARATE) { + marginInfo.setAtBeforeSideOfBlock(false); marginInfo.clearMargin(); } @@ -1864,7 +1865,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int child->layout(); // Cache if we are at the top of the block right now. - bool atTopOfBlock = marginInfo.atTopOfBlock(); + bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); // Now determine the correct ypos based off examination of collapsing margin // values. @@ -1893,7 +1894,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int if (paginationStrut) { // We are willing to propagate out to our parent block as long as we were at the top of the block prior // to collapsing our margins, and as long as we didn't clear or move as a result of other pagination. - if (atTopOfBlock && oldY == yBeforeClear && !isPositioned() && !isTableCell()) { + if (atBeforeSideOfBlock && oldY == yBeforeClear && !isPositioned() && !isTableCell()) { // FIXME: Should really check if we're exceeding the page height before propagating the strut, but we don't // have all the information to do so (the strut only has the remaining amount to push). Gecko gets this wrong too // and pushes to the next page anyway, so not too concerned about it. @@ -1905,7 +1906,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int } // Similar to how we apply clearance. Go ahead and boost height() to be the place where we're going to position the child. - setHeight(height() + (yAfterClear - oldY)); + setLogicalHeight(height() + (yAfterClear - oldY)); } view()->addLayoutDelta(IntSize(0, yPosEstimate - yAfterClear)); @@ -1933,16 +1934,16 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int // We are no longer at the top of the block if we encounter a non-empty child. // This has to be done after checking for clear, so that margins can be reset if a clear occurred. - if (marginInfo.atTopOfBlock() && !child->isSelfCollapsingBlock()) - marginInfo.setAtTopOfBlock(false); + if (marginInfo.atBeforeSideOfBlock() && !child->isSelfCollapsingBlock()) + marginInfo.setAtBeforeSideOfBlock(false); // Now place the child in the correct horizontal position determineHorizontalPosition(child); // Update our height now that the child has been placed in the correct position. - setHeight(height() + child->height()); - if (child->style()->marginBottomCollapse() == MSEPARATE) { - setHeight(height() + child->marginBottom()); + setLogicalHeight(height() + child->height()); + if (child->style()->marginAfterCollapse() == MSEPARATE) { + setLogicalHeight(height() + child->marginBottom()); marginInfo.clearMargin(); } // If the child has overhanging floats that intrude into following siblings (or possibly out @@ -1970,7 +1971,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int // Check for an after page/column break. int newHeight = applyAfterBreak(child, height(), marginInfo); if (newHeight != height()) - setHeight(newHeight); + setLogicalHeight(newHeight); } ASSERT(oldLayoutDelta == view()->layoutDelta()); @@ -2028,7 +2029,7 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren) // If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths. //if (relayoutChildren && (r->style()->paddingLeft().isPercent() || r->style()->paddingRight().isPercent())) - r->setPrefWidthsDirty(true, false); + r->setPreferredLogicalWidthsDirty(true, false); if (!r->needsLayout() && paginated && view()->layoutState()->m_pageHeight) { RenderBlock* childRenderBlock = r->isRenderBlock() ? toRenderBlock(r) : 0; @@ -2266,7 +2267,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) if (checkAfterAlways && (ty + child->y() + child->height()) > paintInfo.rect.y() && (ty + child->y() + child->height()) < paintInfo.rect.bottom()) { - view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true); + view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginAfter()), this, true); return; } } @@ -2418,7 +2419,7 @@ void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty) // We can check the first box and last box and avoid painting if we don't // intersect. int yPos = ty + firstLineBox()->y(); - int h = lastLineBox()->y() + lastLineBox()->height() - firstLineBox()->y(); + int h = lastLineBox()->y() + lastLineBox()->logicalHeight() - firstLineBox()->y(); if (yPos >= paintInfo.rect.bottom() || yPos + h <= paintInfo.rect.y()) return; @@ -2427,7 +2428,7 @@ void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty) // based off positions of our first line box or our last line box. for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { yPos = ty + curr->y(); - h = curr->height(); + h = curr->logicalHeight(); if (curr->ellipsisBox() && yPos < paintInfo.rect.bottom() && yPos + h > paintInfo.rect.y()) curr->paintEllipsisBox(paintInfo, tx, ty); } @@ -2825,7 +2826,7 @@ void RenderBlock::getHorizontalSelectionGapInfo(SelectionState state, bool& left int RenderBlock::leftSelectionOffset(RenderBlock* rootBlock, int yPos) { - int left = leftOffset(yPos, false); + int left = logicalLeftOffsetForLine(yPos, false); if (left == borderLeft() + paddingLeft()) { if (rootBlock != this) // The border can potentially be further extended by our containingBlock(). @@ -2845,7 +2846,7 @@ int RenderBlock::leftSelectionOffset(RenderBlock* rootBlock, int yPos) int RenderBlock::rightSelectionOffset(RenderBlock* rootBlock, int yPos) { - int right = rightOffset(yPos, false); + int right = logicalRightOffsetForLine(yPos, false); if (right == (contentWidth() + (borderLeft() + paddingLeft()))) { if (rootBlock != this) // The border can potentially be further extended by our containingBlock(). @@ -2942,8 +2943,8 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o) if (!affectedByPagination) o->layoutIfNeeded(); else { - o->calcWidth(); - o->calcVerticalMargins(); + o->computeLogicalWidth(); + o->computeBlockDirectionMargins(this); } newObj->m_width = o->width() + o->marginLeft() + o->marginRight(); @@ -3026,8 +3027,8 @@ bool RenderBlock::positionNewFloats() RenderBox* o = f->m_renderer; - int ro = rightOffset(); // Constant part of right offset. - int lo = leftOffset(); // Constant part of left offset. + int ro = logicalRightOffsetForContent(); // Constant part of right offset. + int lo = logicalLeftOffsetForContent(); // Constant part of left offset. int fwidth = f->m_width; // The width we look for. if (ro - lo < fwidth) fwidth = ro - lo; // Never look for more than what will be available. @@ -3042,10 +3043,10 @@ bool RenderBlock::positionNewFloats() if (o->style()->floating() == FLEFT) { int heightRemainingLeft = 1; int heightRemainingRight = 1; - int fx = leftRelOffset(y, lo, false, &heightRemainingLeft); - while (rightRelOffset(y, ro, false, &heightRemainingRight)-fx < fwidth) { + int fx = logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft); + while (logicalRightOffsetForLine(y, ro, false, &heightRemainingRight)-fx < fwidth) { y += min(heightRemainingLeft, heightRemainingRight); - fx = leftRelOffset(y, lo, false, &heightRemainingLeft); + fx = logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft); } fx = max(0, fx); f->m_left = fx; @@ -3053,10 +3054,10 @@ bool RenderBlock::positionNewFloats() } else { int heightRemainingLeft = 1; int heightRemainingRight = 1; - int fx = rightRelOffset(y, ro, false, &heightRemainingRight); - while (fx - leftRelOffset(y, lo, false, &heightRemainingLeft) < fwidth) { + int fx = logicalRightOffsetForLine(y, ro, false, &heightRemainingRight); + while (fx - logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft) < fwidth) { y += min(heightRemainingLeft, heightRemainingRight); - fx = rightRelOffset(y, ro, false, &heightRemainingRight); + fx = logicalRightOffsetForLine(y, ro, false, &heightRemainingRight); } f->m_left = fx - f->m_width; o->setLocation(fx - o->marginRight() - o->width(), y + o->marginTop()); @@ -3132,7 +3133,7 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec } } - setHeight(height() + paginationStrut); + setLogicalHeight(height() + paginationStrut); return didPosition; } @@ -3156,7 +3157,7 @@ void RenderBlock::newLine(EClear clear) break; } if (height() < newY) - setHeight(newY); + setLogicalHeight(newY); } void RenderBlock::addPercentHeightDescendant(RenderBox* descendant) @@ -3219,12 +3220,12 @@ HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this) : 0; } -int RenderBlock::leftOffset() const +int RenderBlock::logicalLeftOffsetForContent() const { return borderLeft() + paddingLeft(); } -int RenderBlock::leftRelOffset(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const +int RenderBlock::logicalLeftOffsetForLine(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const { int left = fixedOffset; if (m_floatingObjects) { @@ -3245,19 +3246,19 @@ int RenderBlock::leftRelOffset(int y, int fixedOffset, bool applyTextIndent, int if (applyTextIndent && style()->direction() == LTR) { int cw = 0; if (style()->textIndent().isPercent()) - cw = containingBlock()->availableWidth(); + cw = containingBlock()->availableLogicalWidth(); left += style()->textIndent().calcMinValue(cw); } return left; } -int RenderBlock::rightOffset() const +int RenderBlock::logicalRightOffsetForContent() const { - return borderLeft() + paddingLeft() + availableWidth(); + return borderLeft() + paddingLeft() + availableLogicalWidth(); } -int RenderBlock::rightRelOffset(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const +int RenderBlock::logicalRightOffsetForLine(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const { int right = fixedOffset; @@ -3279,7 +3280,7 @@ int RenderBlock::rightRelOffset(int y, int fixedOffset, bool applyTextIndent, in if (applyTextIndent && style()->direction() == RTL) { int cw = 0; if (style()->textIndent().isPercent()) - cw = containingBlock()->availableWidth(); + cw = containingBlock()->availableLogicalWidth(); right -= style()->textIndent().calcMinValue(cw); } @@ -3287,9 +3288,9 @@ int RenderBlock::rightRelOffset(int y, int fixedOffset, bool applyTextIndent, in } int -RenderBlock::lineWidth(int y, bool firstLine) const +RenderBlock::availableLogicalWidthForLine(int position, bool firstLine) const { - int result = rightOffset(y, firstLine) - leftOffset(y, firstLine); + int result = logicalRightOffsetForLine(position, firstLine) - logicalLeftOffsetForLine(position, firstLine); return (result < 0) ? 0 : result; } @@ -3407,7 +3408,7 @@ int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf) while (currBox && currBox->isFloatingOrPositioned()) currBox = currBox->previousSiblingBox(); if (currBox) { - int childBottomEdge = currBox->y() + currBox->height() + currBox->collapsedMarginBottom(); + int childBottomEdge = currBox->y() + currBox->height() + currBox->collapsedMarginAfter(); // FIXME: "after" is wrong here for lowestPosition. bottom = max(bottom, childBottomEdge + paddingBottom() + relativeOffset); } } @@ -3495,7 +3496,7 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel right = max(right, borderLeft() + paddingLeft() + paddingRight() + relativeOffset); if (childrenInline()) { for (InlineFlowBox* currBox = firstLineBox(); currBox; currBox = currBox->nextLineBox()) { - int childRightEdge = currBox->x() + currBox->width(); + int childRightEdge = currBox->x() + currBox->logicalWidth(); // If this node is a root editable element, then the rightmostPosition should account for a caret at the end. // FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to. @@ -3748,7 +3749,7 @@ void RenderBlock::clearFloats() int RenderBlock::addOverhangingFloats(RenderBlock* child, int xoff, int yoff, bool makeChildPaintOtherFloats) { // Prevent floats from being added to the canvas by the root element, e.g., <html>. - if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns()) + if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns() || child->isBlockFlowRoot()) return 0; int lowestFloatBottom = 0; @@ -3950,20 +3951,20 @@ int RenderBlock::getClearDelta(RenderBox* child, int yPos) // We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default). int result = clearSet ? max(0, bottom - yPos) : 0; if (!result && child->avoidsFloats()) { - int availableWidth = this->availableWidth(); - if (child->minPrefWidth() > availableWidth) + int availableWidth = availableLogicalWidth(); + if (child->minPreferredLogicalWidth() > availableWidth) return 0; int y = yPos; while (true) { - int widthAtY = lineWidth(y, false); + int widthAtY = availableLogicalWidthForLine(y, false); if (widthAtY == availableWidth) return y - yPos; int oldChildY = child->y(); int oldChildWidth = child->width(); child->setY(y); - child->calcWidth(); + child->computeLogicalWidth(); int childWidthAtY = child->width(); child->setY(oldChildY); child->setWidth(oldChildWidth); @@ -4315,14 +4316,6 @@ void RenderBlock::offsetForContents(int& tx, int& ty) const ty = contentsPoint.y(); } -int RenderBlock::availableWidth() const -{ - // If we have multiple columns, then the available width is reduced to our column width. - if (hasColumns()) - return desiredColumnWidth(); - return RenderBox::availableWidth(); -} - int RenderBlock::availableLogicalWidth() const { // If we have multiple columns, then the available logical width is reduced to our column width. @@ -4496,7 +4489,7 @@ bool RenderBlock::layoutColumns(bool hasSpecifiedPageHeight, int pageHeight, Lay int overflowRight = style()->direction() == LTR ? max(width(), lastRect.x() + lastRect.width()) : 0; int overflowHeight = borderTop() + paddingTop() + colInfo->columnHeight(); - setHeight(overflowHeight + borderBottom() + paddingBottom() + horizontalScrollbarHeight()); + setLogicalHeight(overflowHeight + borderBottom() + paddingBottom() + horizontalScrollbarHeight()); m_overflow.clear(); addLayoutOverflow(IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight)); @@ -4608,48 +4601,48 @@ void RenderBlock::adjustForColumns(IntSize& offset, const IntPoint& point) const } } -void RenderBlock::calcPrefWidths() +void RenderBlock::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); updateFirstLetter(); if (!isTableCell() && style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else { - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (childrenInline()) - calcInlinePrefWidths(); + computeInlinePreferredLogicalWidths(); else - calcBlockPrefWidths(); + computeBlockPreferredLogicalWidths(); - m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); if (!style()->autoWrap() && childrenInline()) { - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; // A horizontal marquee with inline children has no minimum width. if (layer() && layer()->marquee() && layer()->marquee()->isHorizontal()) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; } if (isTableCell()) { Length w = toRenderTableCell(this)->styleOrColWidth(); if (w.isFixed() && w.value() > 0) - m_maxPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(w.value())); + m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(w.value())); } } if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = 0; @@ -4658,10 +4651,10 @@ void RenderBlock::calcPrefWidths() if (hasOverflowClip() && style()->overflowY() == OSCROLL) toAdd += verticalScrollbarWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } struct InlineMinMaxIterator { @@ -4765,7 +4758,7 @@ static inline void stripTrailingSpace(int& inlineMax, int& inlineMin, } } -void RenderBlock::calcInlinePrefWidths() +void RenderBlock::computeInlinePreferredLogicalWidths() { int inlineMax = 0; int inlineMin = 0; @@ -4844,7 +4837,7 @@ void RenderBlock::calcInlinePrefWidths() inlineMin += childMin; inlineMax += childMax; - child->setPrefWidthsDirty(false); + child->setPreferredLogicalWidthsDirty(false); } else { // Inline replaced elts add in their margins to their min/max values. int margins = 0; @@ -4863,8 +4856,8 @@ void RenderBlock::calcInlinePrefWidths() // Case (2). Inline replaced elements and floats. // Go ahead and terminate the current line as far as // minwidth is concerned. - childMin += child->minPrefWidth(); - childMax += child->maxPrefWidth(); + childMin += child->minPreferredLogicalWidth(); + childMax += child->maxPreferredLogicalWidth(); bool clearPreviousFloat; if (child->isFloating()) { @@ -4877,13 +4870,13 @@ void RenderBlock::calcInlinePrefWidths() bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak; if ((canBreakReplacedElement && (autoWrap || oldAutoWrap)) || clearPreviousFloat) { - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); inlineMin = 0; } // If we're supposed to clear the previous float, then terminate maxwidth as well. if (clearPreviousFloat) { - m_maxPrefWidth = max(inlineMax, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth); inlineMax = 0; } @@ -4901,12 +4894,12 @@ void RenderBlock::calcInlinePrefWidths() if (!autoWrap || !canBreakReplacedElement) { if (child->isFloating()) - m_minPrefWidth = max(childMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(childMin, m_minPreferredLogicalWidth); else inlineMin += childMin; } else { // Now check our line. - m_minPrefWidth = max(childMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(childMin, m_minPreferredLogicalWidth); // Now start a new line. inlineMin = 0; @@ -4923,7 +4916,7 @@ void RenderBlock::calcInlinePrefWidths() RenderText* t = toRenderText(child); if (t->isWordBreak()) { - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); inlineMin = 0; continue; } @@ -4944,7 +4937,7 @@ void RenderBlock::calcInlinePrefWidths() // This text object will not be rendered, but it may still provide a breaking opportunity. if (!hasBreak && childMax == 0) { if (autoWrap && (beginWS || endWS)) { - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); inlineMin = 0; } continue; @@ -4974,10 +4967,10 @@ void RenderBlock::calcInlinePrefWidths() // we start and end with whitespace. if (beginWS) // Go ahead and end the current line. - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); else { inlineMin += beginMin; - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); childMin -= ti; } @@ -4986,18 +4979,18 @@ void RenderBlock::calcInlinePrefWidths() if (endWS) { // We end in whitespace, which means we can go ahead // and end our current line. - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); inlineMin = 0; } else { - m_minPrefWidth = max(inlineMin, m_minPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); inlineMin = endMin; } } if (hasBreak) { inlineMax += beginMax; - m_maxPrefWidth = max(inlineMax, m_maxPrefWidth); - m_maxPrefWidth = max(childMax, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth); + m_maxPreferredLogicalWidth = max(childMax, m_maxPreferredLogicalWidth); inlineMax = endMax; } else inlineMax += childMax; @@ -5007,8 +5000,8 @@ void RenderBlock::calcInlinePrefWidths() if (child->isListMarker()) stripFrontSpaces = true; } else { - m_minPrefWidth = max(inlineMin, m_minPrefWidth); - m_maxPrefWidth = max(inlineMax, m_maxPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); + m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth); inlineMin = inlineMax = 0; stripFrontSpaces = true; trailingSpaceChild = 0; @@ -5020,14 +5013,14 @@ void RenderBlock::calcInlinePrefWidths() if (style()->collapseWhiteSpace()) stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild); - m_minPrefWidth = max(inlineMin, m_minPrefWidth); - m_maxPrefWidth = max(inlineMax, m_maxPrefWidth); + m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth); + m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth); } // Use a very large value (in effect infinite). #define BLOCK_MAX_WIDTH 15000 -void RenderBlock::calcBlockPrefWidths() +void RenderBlock::computeBlockPreferredLogicalWidths() { bool nowrap = style()->whiteSpace() == NOWRAP; @@ -5043,11 +5036,11 @@ void RenderBlock::calcBlockPrefWidths() if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) { int floatTotalWidth = floatLeftWidth + floatRightWidth; if (child->style()->clear() & CLEFT) { - m_maxPrefWidth = max(floatTotalWidth, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth); floatLeftWidth = 0; } if (child->style()->clear() & CRIGHT) { - m_maxPrefWidth = max(floatTotalWidth, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth); floatRightWidth = 0; } } @@ -5064,14 +5057,14 @@ void RenderBlock::calcBlockPrefWidths() marginRight += mr.value(); margin = marginLeft + marginRight; - int w = child->minPrefWidth() + margin; - m_minPrefWidth = max(w, m_minPrefWidth); + int w = child->minPreferredLogicalWidth() + margin; + m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth); // IE ignores tables for calculation of nowrap. Makes some sense. if (nowrap && !child->isTable()) - m_maxPrefWidth = max(w, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth); - w = child->maxPrefWidth() + margin; + w = child->maxPreferredLogicalWidth() + margin; if (!child->isFloating()) { if (child->isBox() && toRenderBox(child)->avoidsFloats()) { @@ -5080,11 +5073,11 @@ void RenderBlock::calcBlockPrefWidths() // is smaller than the float width. int maxLeft = marginLeft > 0 ? max(floatLeftWidth, marginLeft) : floatLeftWidth + marginLeft; int maxRight = marginRight > 0 ? max(floatRightWidth, marginRight) : floatRightWidth + marginRight; - w = child->maxPrefWidth() + maxLeft + maxRight; + w = child->maxPreferredLogicalWidth() + maxLeft + maxRight; w = max(w, floatLeftWidth + floatRightWidth); } else - m_maxPrefWidth = max(floatLeftWidth + floatRightWidth, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(floatLeftWidth + floatRightWidth, m_maxPreferredLogicalWidth); floatLeftWidth = floatRightWidth = 0; } @@ -5094,7 +5087,7 @@ void RenderBlock::calcBlockPrefWidths() else floatRightWidth += w; } else - m_maxPrefWidth = max(w, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth); // A very specific WinIE quirk. // Example: @@ -5110,22 +5103,22 @@ void RenderBlock::calcBlockPrefWidths() // We can achieve this effect by making the maxwidth of blocks that contain tables // with percentage widths be infinite (as long as they are not inside a table cell). if (document()->inQuirksMode() && child->style()->width().isPercent() && - !isTableCell() && child->isTable() && m_maxPrefWidth < BLOCK_MAX_WIDTH) { + !isTableCell() && child->isTable() && m_maxPreferredLogicalWidth < BLOCK_MAX_WIDTH) { RenderBlock* cb = containingBlock(); while (!cb->isRenderView() && !cb->isTableCell()) cb = cb->containingBlock(); if (!cb->isTableCell()) - m_maxPrefWidth = BLOCK_MAX_WIDTH; + m_maxPreferredLogicalWidth = BLOCK_MAX_WIDTH; } child = child->nextSibling(); } // Always make sure these values are non-negative. - m_minPrefWidth = max(0, m_minPrefWidth); - m_maxPrefWidth = max(0, m_maxPrefWidth); + m_minPreferredLogicalWidth = max(0, m_minPreferredLogicalWidth); + m_maxPreferredLogicalWidth = max(0, m_maxPreferredLogicalWidth); - m_maxPrefWidth = max(floatLeftWidth + floatRightWidth, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(floatLeftWidth + floatRightWidth, m_maxPreferredLogicalWidth); } bool RenderBlock::hasLineIfEmpty() const @@ -5537,7 +5530,7 @@ void RenderBlock::adjustForBorderFit(int x, int& left, int& right) const if (box->firstChild()) left = min(left, x + box->firstChild()->x()); if (box->lastChild()) - right = max(right, x + box->lastChild()->x() + box->lastChild()->width()); + right = max(right, x + box->lastChild()->x() + box->lastChild()->logicalWidth()); } } else { @@ -5609,26 +5602,26 @@ void RenderBlock::clearTruncation() } } -void RenderBlock::setMaxTopMargins(int pos, int neg) +void RenderBlock::setMaxMarginBeforeValues(int pos, int neg) { if (!m_rareData) { - if (pos == RenderBlockRareData::topPosDefault(this) && neg == RenderBlockRareData::topNegDefault(this)) + if (pos == RenderBlockRareData::beforePosDefault(this) && neg == RenderBlockRareData::beforeNegDefault(this)) return; m_rareData = new RenderBlockRareData(this); } - m_rareData->m_topPos = pos; - m_rareData->m_topNeg = neg; + m_rareData->m_beforePos = pos; + m_rareData->m_beforeNeg = neg; } -void RenderBlock::setMaxBottomMargins(int pos, int neg) +void RenderBlock::setMaxMarginAfterValues(int pos, int neg) { if (!m_rareData) { - if (pos == RenderBlockRareData::bottomPosDefault(this) && neg == RenderBlockRareData::bottomNegDefault(this)) + if (pos == RenderBlockRareData::afterPosDefault(this) && neg == RenderBlockRareData::afterNegDefault(this)) return; m_rareData = new RenderBlockRareData(this); } - m_rareData->m_bottomPos = pos; - m_rareData->m_bottomNeg = neg; + m_rareData->m_afterPos = pos; + m_rareData->m_afterNeg = neg; } void RenderBlock::setPaginationStrut(int strut) @@ -5657,8 +5650,10 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty) // inline boxes above and below us (thus getting merged with them to form a single irregular // shape). if (isAnonymousBlockContinuation()) { - rects.append(IntRect(tx, ty - collapsedMarginTop(), - width(), height() + collapsedMarginTop() + collapsedMarginBottom())); + // FIXME: This is wrong for block-flows that are horizontal. + // https://bugs.webkit.org/show_bug.cgi?id=46781 + rects.append(IntRect(tx, ty - collapsedMarginBefore(), + width(), height() + collapsedMarginBefore() + collapsedMarginAfter())); continuation()->absoluteRects(rects, tx - x() + inlineElementContinuation()->containingBlock()->x(), ty - y() + inlineElementContinuation()->containingBlock()->y()); @@ -5672,8 +5667,10 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads) // inline boxes above and below us (thus getting merged with them to form a single irregular // shape). if (isAnonymousBlockContinuation()) { - FloatRect localRect(0, -collapsedMarginTop(), - width(), height() + collapsedMarginTop() + collapsedMarginBottom()); + // FIXME: This is wrong for block-flows that are horizontal. + // https://bugs.webkit.org/show_bug.cgi?id=46781 + FloatRect localRect(0, -collapsedMarginBefore(), + width(), height() + collapsedMarginBefore() + collapsedMarginAfter()); quads.append(localToAbsoluteQuad(localRect)); continuation()->absoluteQuads(quads); } else @@ -5684,7 +5681,7 @@ IntRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintCont { IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth)); if (isAnonymousBlockContinuation()) - r.inflateY(collapsedMarginTop()); + r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-flows that are horizontal. return r; } @@ -5799,7 +5796,7 @@ IntRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, int* // FIXME: why call localToAbsoluteForContent() twice here, too? FloatPoint absRightPoint = localToAbsolute(FloatPoint(myRight, 0)); - int containerRight = containingBlock()->x() + containingBlockWidthForContent(); + int containerRight = containingBlock()->x() + containingBlockLogicalWidthForContent(); FloatPoint absContainerPoint = localToAbsolute(FloatPoint(containerRight, 0)); *extraWidthToEndOfLine = absContainerPoint.x() - absRightPoint.x(); @@ -5820,9 +5817,11 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) // FIXME: This check really isn't accurate. bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); // FIXME: This is wrong. The principal renderer may not be the continuation preceding this block. + // FIXME: This is wrong for block-flows that are horizontal. + // https://bugs.webkit.org/show_bug.cgi?id=46781 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox(); - int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0; - int bottomMargin = nextInlineHasLineBox ? collapsedMarginBottom() : 0; + int topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : 0; + int bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : 0; IntRect rect(tx, ty - topMargin, width(), height() + topMargin + bottomMargin); if (!rect.isEmpty()) rects.append(rect); @@ -5832,8 +5831,8 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) if (!hasOverflowClip() && !hasControlClip()) { for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { int top = max(curr->lineTop(), curr->y()); - int bottom = min(curr->lineBottom(), curr->y() + curr->height()); - IntRect rect(tx + curr->x(), ty + top, curr->width(), bottom - top); + int bottom = min(curr->lineBottom(), curr->y() + curr->logicalHeight()); + IntRect rect(tx + curr->x(), ty + top, curr->logicalWidth(), bottom - top); if (!rect.isEmpty()) rects.append(rect); } @@ -5956,7 +5955,7 @@ int RenderBlock::applyAfterBreak(RenderBox* child, int yPos, MarginInfo& marginI bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageHeight; // FIXME: Once columns can print we have to check this. bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS); if (checkAfterAlways && inNormalFlow(child)) { - marginInfo.setBottomQuirk(true); // Cause margins to be discarded for any following content. + marginInfo.setMarginAfterQuirk(true); // Cause margins to be discarded for any following content. if (checkColumnBreaks) view()->layoutState()->addForcedColumnBreak(yPos); return nextPageTop(yPos); diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index b26c28c..0682039 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -102,19 +102,17 @@ public: bool containsFloats() { return m_floatingObjects && !m_floatingObjects->isEmpty(); } bool containsFloat(RenderObject*); - int lineWidth(int y, bool firstLine) const; + int availableLogicalWidthForLine(int position, bool firstLine) const; + int logicalRightOffsetForLine(int position, bool firstLine) const { return logicalRightOffsetForLine(position, logicalRightOffsetForContent(), firstLine); } + int logicalLeftOffsetForLine(int position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), firstLine); } virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const; virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const; virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const; - - int rightOffset(int y, bool firstLine) const { return rightRelOffset(y, rightOffset(), firstLine); } - int leftOffset(int y, bool firstLine) const { return leftRelOffset(y, leftOffset(), firstLine); } - + virtual VisiblePosition positionForPoint(const IntPoint&); // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.) - virtual int availableWidth() const; // FIXME: Should be possible to remove this. See https://bugs.webkit.org/show_bug.cgi?id=46127 virtual int availableLogicalWidth() const; RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); } @@ -196,21 +194,21 @@ protected: } void moveChildrenTo(RenderBlock* to, RenderObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert = false); - int maxTopPosMargin() const { return m_rareData ? m_rareData->m_topPos : RenderBlockRareData::topPosDefault(this); } - int maxTopNegMargin() const { return m_rareData ? m_rareData->m_topNeg : RenderBlockRareData::topNegDefault(this); } - int maxBottomPosMargin() const { return m_rareData ? m_rareData->m_bottomPos : RenderBlockRareData::bottomPosDefault(this); } - int maxBottomNegMargin() const { return m_rareData ? m_rareData->m_bottomNeg : RenderBlockRareData::bottomNegDefault(this); } + int maxPosMarginBefore() const { return m_rareData ? m_rareData->m_beforePos : RenderBlockRareData::beforePosDefault(this); } + int maxNegMarginBefore() const { return m_rareData ? m_rareData->m_beforeNeg : RenderBlockRareData::beforeNegDefault(this); } + int maxPosMarginAfter() const { return m_rareData ? m_rareData->m_afterPos : RenderBlockRareData::afterPosDefault(this); } + int maxNegMarginAfter() const { return m_rareData ? m_rareData->m_afterNeg : RenderBlockRareData::afterNegDefault(this); } - void setMaxTopMargins(int pos, int neg); - void setMaxBottomMargins(int pos, int neg); + void setMaxMarginBeforeValues(int pos, int neg); + void setMaxMarginAfterValues(int pos, int neg); void initMaxMarginValues() { if (m_rareData) { - m_rareData->m_topPos = RenderBlockRareData::topPosDefault(this); - m_rareData->m_topNeg = RenderBlockRareData::topNegDefault(this); - m_rareData->m_bottomPos = RenderBlockRareData::bottomPosDefault(this); - m_rareData->m_bottomNeg = RenderBlockRareData::bottomNegDefault(this); + m_rareData->m_beforePos = RenderBlockRareData::beforePosDefault(this); + m_rareData->m_beforeNeg = RenderBlockRareData::beforeNegDefault(this); + m_rareData->m_afterPos = RenderBlockRareData::afterPosDefault(this); + m_rareData->m_afterNeg = RenderBlockRareData::afterNegDefault(this); m_rareData->m_paginationStrut = 0; } } @@ -222,12 +220,14 @@ protected: virtual void paint(PaintInfo&, int tx, int ty); virtual void paintObject(PaintInfo&, int tx, int ty); - int rightRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const; - int leftRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const; + int logicalRightOffsetForContent() const; + int logicalLeftOffsetForContent() const; + int logicalRightOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const; + int logicalLeftOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const; virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual int firstLineBoxBaseline() const; virtual int lastLineBoxBaseline() const; @@ -284,8 +284,14 @@ private: virtual bool isSelfCollapsingBlock() const; - virtual int maxTopMargin(bool positive) const { return positive ? maxTopPosMargin() : maxTopNegMargin(); } - virtual int maxBottomMargin(bool positive) const { return positive ? maxBottomPosMargin() : maxBottomNegMargin(); } + virtual int maxMarginBefore(MarginSign sign) const + { + return (sign == PositiveMargin) ? maxPosMarginBefore() : maxNegMarginBefore(); + } + virtual int maxMarginAfter(MarginSign sign) const + { + return (sign == PositiveMargin) ? maxPosMarginAfter() : maxNegMarginAfter(); + } virtual void repaintOverhangingFloats(bool paintAllDescendants); @@ -364,8 +370,8 @@ private: InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, bool& hyphenated, EClear*, FloatingObject* lastFloatFromPreviousLine); RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject); InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine); - void computeHorizontalPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&); - void computeVerticalPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&); + void computeInlineDirectionPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&); + void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&); void deleteEllipsisLineBoxes(); void checkLinesForTextOverflow(); void addOverflowFromInlineChildren(); @@ -409,16 +415,14 @@ private: inline int leftBottom(); inline int rightBottom(); - int rightOffset() const; - int leftOffset() const; virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); bool hitTestFloats(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); virtual bool isPointInOverflowControl(HitTestResult&, int x, int y, int tx, int ty); - void calcInlinePrefWidths(); - void calcBlockPrefWidths(); + void computeInlinePreferredLogicalWidths(); + void computeBlockPreferredLogicalWidths(); // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline // children. @@ -496,8 +500,8 @@ private: class MarginInfo { // Collapsing flags for whether we can collapse our margins with our children's margins. bool m_canCollapseWithChildren : 1; - bool m_canCollapseTopWithChildren : 1; - bool m_canCollapseBottomWithChildren : 1; + bool m_canCollapseMarginBeforeWithChildren : 1; + bool m_canCollapseMarginAfterWithChildren : 1; // Whether or not we are a quirky container, i.e., do we collapse away top and bottom // margins in our container. Table cells and the body are the common examples. We @@ -508,30 +512,30 @@ private: // They may or may not collapse with the top margin of the block (|m_canCollapseTopWithChildren| tells us that), but they will // always be collapsing with one another. This variable can remain set to true through multiple iterations // as long as we keep encountering self-collapsing blocks. - bool m_atTopOfBlock : 1; + bool m_atBeforeSideOfBlock : 1; // This flag is set when we know we're examining bottom margins and we know we're at the bottom of the block. - bool m_atBottomOfBlock : 1; + bool m_atAfterSideOfBlock : 1; // These variables are used to detect quirky margins that we need to collapse away (in table cells // and in the body element). - bool m_topQuirk : 1; - bool m_bottomQuirk : 1; - bool m_determinedTopQuirk : 1; + bool m_marginBeforeQuirk : 1; + bool m_marginAfterQuirk : 1; + bool m_determinedMarginBeforeQuirk : 1; // These flags track the previous maximal positive and negative margins. int m_posMargin; int m_negMargin; public: - MarginInfo(RenderBlock* b, int top, int bottom); + MarginInfo(RenderBlock* b, int beforeBorderPadding, int afterBorderPadding); - void setAtTopOfBlock(bool b) { m_atTopOfBlock = b; } - void setAtBottomOfBlock(bool b) { m_atBottomOfBlock = b; } + void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; } + void setAtAfterSideOfBlock(bool b) { m_atAfterSideOfBlock = b; } void clearMargin() { m_posMargin = m_negMargin = 0; } - void setTopQuirk(bool b) { m_topQuirk = b; } - void setBottomQuirk(bool b) { m_bottomQuirk = b; } - void setDeterminedTopQuirk(bool b) { m_determinedTopQuirk = b; } + void setMarginBeforeQuirk(bool b) { m_marginBeforeQuirk = b; } + void setMarginAfterQuirk(bool b) { m_marginAfterQuirk = b; } + void setDeterminedMarginBeforeQuirk(bool b) { m_determinedMarginBeforeQuirk = b; } void setPosMargin(int p) { m_posMargin = p; } void setNegMargin(int n) { m_negMargin = n; } void setPosMarginIfLarger(int p) { if (p > m_posMargin) m_posMargin = p; } @@ -539,15 +543,15 @@ private: void setMargin(int p, int n) { m_posMargin = p; m_negMargin = n; } - bool atTopOfBlock() const { return m_atTopOfBlock; } - bool canCollapseWithTop() const { return m_atTopOfBlock && m_canCollapseTopWithChildren; } - bool canCollapseWithBottom() const { return m_atBottomOfBlock && m_canCollapseBottomWithChildren; } - bool canCollapseTopWithChildren() const { return m_canCollapseTopWithChildren; } - bool canCollapseBottomWithChildren() const { return m_canCollapseBottomWithChildren; } + bool atBeforeSideOfBlock() const { return m_atBeforeSideOfBlock; } + bool canCollapseWithMarginBefore() const { return m_atBeforeSideOfBlock && m_canCollapseMarginBeforeWithChildren; } + bool canCollapseWithMarginAfter() const { return m_atAfterSideOfBlock && m_canCollapseMarginAfterWithChildren; } + bool canCollapseMarginBeforeWithChildren() const { return m_canCollapseMarginBeforeWithChildren; } + bool canCollapseMarginAfterWithChildren() const { return m_canCollapseMarginAfterWithChildren; } bool quirkContainer() const { return m_quirkContainer; } - bool determinedTopQuirk() const { return m_determinedTopQuirk; } - bool topQuirk() const { return m_topQuirk; } - bool bottomQuirk() const { return m_bottomQuirk; } + bool determinedMarginBeforeQuirk() const { return m_determinedMarginBeforeQuirk; } + bool marginBeforeQuirk() const { return m_marginBeforeQuirk; } + bool marginAfterQuirk() const { return m_marginAfterQuirk; } int posMargin() const { return m_posMargin; } int negMargin() const { return m_negMargin; } int margin() const { return m_posMargin - m_negMargin; } @@ -588,25 +592,38 @@ private: // Allocated only when some of these fields have non-default values struct RenderBlockRareData : Noncopyable { - RenderBlockRareData(const RenderBlock* o) - : m_topPos(topPosDefault(o)) - , m_topNeg(topNegDefault(o)) - , m_bottomPos(bottomPosDefault(o)) - , m_bottomNeg(bottomNegDefault(o)) + RenderBlockRareData(const RenderBlock* block) + : m_beforePos(beforePosDefault(block)) + , m_beforeNeg(beforeNegDefault(block)) + , m_afterPos(afterPosDefault(block)) + , m_afterNeg(afterNegDefault(block)) , m_paginationStrut(0) , m_pageY(0) { } - static int topPosDefault(const RenderBlock* o) { return o->marginTop() > 0 ? o->marginTop() : 0; } - static int topNegDefault(const RenderBlock* o) { return o->marginTop() < 0 ? -o->marginTop() : 0; } - static int bottomPosDefault(const RenderBlock* o) { return o->marginBottom() > 0 ? o->marginBottom() : 0; } - static int bottomNegDefault(const RenderBlock* o) { return o->marginBottom() < 0 ? -o->marginBottom() : 0; } + static int beforePosDefault(const RenderBlock* block) + { + return std::max(block->marginBefore(), 0); + } + + static int beforeNegDefault(const RenderBlock* block) + { + return std::max(-block->marginBefore(), 0); + } + static int afterPosDefault(const RenderBlock* block) + { + return std::max(block->marginAfter(), 0); + } + static int afterNegDefault(const RenderBlock* block) + { + return std::max(-block->marginAfter(), 0); + } - int m_topPos; - int m_topNeg; - int m_bottomPos; - int m_bottomNeg; + int m_beforePos; + int m_beforeNeg; + int m_afterPos; + int m_afterNeg; int m_paginationStrut; int m_pageY; }; diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index c43f2a8..5076450 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -86,20 +86,6 @@ static int inlineWidth(RenderObject* child, bool start = true, bool end = true) return extraWidth; } -static void chopMidpointsAt(LineMidpointState& lineMidpointState, RenderObject* obj, unsigned pos) -{ - if (!lineMidpointState.numMidpoints) - return; - InlineIterator* midpoints = lineMidpointState.midpoints.data(); - for (int i = lineMidpointState.numMidpoints - 1; i >= 0; i--) { - const InlineIterator& point = midpoints[i]; - if (point.obj == obj && point.pos == pos) { - lineMidpointState.numMidpoints = i; - break; - } - } -} - static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator& lBreak) { // Check to see if our last midpoint is a start point beyond the line break. If so, @@ -115,21 +101,8 @@ static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator& if (currpoint == lBreak) { // We hit the line break before the start point. Shave off the start point. lineMidpointState.numMidpoints--; - if (endpoint.obj->style()->collapseWhiteSpace()) { - if (endpoint.obj->isText()) { - // Don't shave a character off the endpoint if it was from a soft hyphen. - RenderText* textObj = toRenderText(endpoint.obj); - if (endpoint.pos + 1 < textObj->textLength()) { - if (textObj->characters()[endpoint.pos+1] == softHyphen) - return; - } else if (startpoint.obj->isText()) { - RenderText *startText = toRenderText(startpoint.obj); - if (startText->textLength() && startText->characters()[0] == softHyphen) - return; - } - } + if (endpoint.obj->style()->collapseWhiteSpace()) endpoint.pos--; - } } } } @@ -209,8 +182,8 @@ static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRo static inline void dirtyLineBoxesForRenderer(RenderObject* o, bool fullLayout) { if (o->isText()) { - if (o->prefWidthsDirty() && o->isCounter()) - toRenderText(o)->calcPrefWidths(0); // FIXME: Counters depend on this hack. No clue why. Should be investigated and removed. + if (o->preferredLogicalWidthsDirty() && o->isCounter()) + toRenderText(o)->computePreferredLogicalWidths(0); // FIXME: Counters depend on this hack. No clue why. Should be investigated and removed. toRenderText(o)->dirtyLineBoxes(fullLayout); } else toRenderInline(o)->dirtyLineBoxes(fullLayout); @@ -327,11 +300,11 @@ RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun, return lastRootBox(); } -void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) +void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { // First determine our total width. - int availableWidth = lineWidth(height(), firstLine); - int totWidth = lineBox->getFlowSpacingWidth(); + int availableWidth = availableLogicalWidthForLine(height(), firstLine); + int totWidth = lineBox->getFlowSpacingLogicalWidth(); bool needsWordSpacing = false; unsigned numSpaces = 0; ETextAlign textAlign = style()->textAlign(); @@ -365,7 +338,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool const AtomicString& hyphenString = rt->style()->hyphenString(); hyphenWidth = rt->style(firstLine)->font().width(TextRun(hyphenString.characters(), hyphenString.length())); } - r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth); + r->m_box->setLogicalWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth); if (!fallbackFonts.isEmpty()) { ASSERT(r->m_box->isText()); GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(static_cast<InlineTextBox*>(r->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).first; @@ -379,19 +352,19 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool } } else if (!r->m_object->isRenderInline()) { RenderBox* renderBox = toRenderBox(r->m_object); - renderBox->calcWidth(); - r->m_box->setWidth(renderBox->width()); + renderBox->computeLogicalWidth(); + r->m_box->setLogicalWidth(renderBox->width()); totWidth += renderBox->marginLeft() + renderBox->marginRight(); } - totWidth += r->m_box->width(); + totWidth += r->m_box->logicalWidth(); } // Armed with the total width of the line (without justification), // we now examine our text-align property in order to determine where to position the // objects horizontally. The total width of the line can be increased if we end up // justifying text. - int x = leftOffset(height(), firstLine); + int x = logicalLeftOffsetForLine(height(), firstLine); switch (textAlign) { case LEFT: case WEBKIT_LEFT: @@ -399,10 +372,10 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool // particular with RTL blocks, wide lines should still spill out to the left. if (style()->direction() == LTR) { if (totWidth > availableWidth && trailingSpaceRun) - trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceRun->m_box->width() - totWidth + availableWidth)); + trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth)); } else { if (trailingSpaceRun) - trailingSpaceRun->m_box->setWidth(0); + trailingSpaceRun->m_box->setLogicalWidth(0); else if (totWidth > availableWidth) x -= (totWidth - availableWidth); } @@ -410,8 +383,8 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool case JUSTIFY: if (numSpaces && !reachedEnd && !lineBox->endsWithBreak()) { if (trailingSpaceRun) { - totWidth -= trailingSpaceRun->m_box->width(); - trailingSpaceRun->m_box->setWidth(0); + totWidth -= trailingSpaceRun->m_box->logicalWidth(); + trailingSpaceRun->m_box->setLogicalWidth(0); } break; } @@ -421,7 +394,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool // for right to left fall through to right aligned if (style()->direction() == LTR) { if (totWidth > availableWidth && trailingSpaceRun) - trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceRun->m_box->width() - totWidth + availableWidth)); + trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth)); break; } case RIGHT: @@ -431,15 +404,15 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool // side of the block. if (style()->direction() == LTR) { if (trailingSpaceRun) { - totWidth -= trailingSpaceRun->m_box->width(); - trailingSpaceRun->m_box->setWidth(0); + totWidth -= trailingSpaceRun->m_box->logicalWidth(); + trailingSpaceRun->m_box->setLogicalWidth(0); } if (totWidth < availableWidth) x += availableWidth - totWidth; } else { if (totWidth > availableWidth && trailingSpaceRun) { - trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceRun->m_box->width() - totWidth + availableWidth)); - totWidth -= trailingSpaceRun->m_box->width(); + trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth)); + totWidth -= trailingSpaceRun->m_box->logicalWidth(); } else x += availableWidth - totWidth; } @@ -448,9 +421,9 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool case WEBKIT_CENTER: int trailingSpaceWidth = 0; if (trailingSpaceRun) { - totWidth -= trailingSpaceRun->m_box->width(); - trailingSpaceWidth = min(trailingSpaceRun->m_box->width(), (availableWidth - totWidth + 1) / 2); - trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceWidth)); + totWidth -= trailingSpaceRun->m_box->logicalWidth(); + trailingSpaceWidth = min(trailingSpaceRun->m_box->logicalWidth(), (availableWidth - totWidth + 1) / 2); + trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceWidth)); } if (style()->direction() == LTR) x += max((availableWidth - totWidth) / 2, 0); @@ -492,12 +465,12 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool // The widths of all runs are now known. We can now place every inline box (and // compute accurate widths for the inline flow boxes). needsWordSpacing = false; - lineBox->placeBoxesHorizontally(x, needsWordSpacing, textBoxDataMap); + lineBox->placeBoxesInInlineDirection(x, needsWordSpacing, textBoxDataMap); } -void RenderBlock::computeVerticalPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) +void RenderBlock::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { - setHeight(lineBox->verticallyAlignBoxes(height(), textBoxDataMap)); + setLogicalHeight(lineBox->alignBoxesInBlockDirection(height(), textBoxDataMap)); lineBox->setBlockHeight(height()); // Now make sure we place replaced render objects correctly. @@ -540,7 +513,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i m_overflow.clear(); - setHeight(borderTop() + paddingTop()); + setLogicalHeight(borderTop() + paddingTop()); int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight(); // Figure out if we should clear out our line boxes. @@ -610,7 +583,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i // If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths. if (relayoutChildren && (o->style()->paddingLeft().isPercent() || o->style()->paddingRight().isPercent())) - o->setPrefWidthsDirty(true, false); + o->setPreferredLogicalWidthsDirty(true, false); if (o->isPositioned()) o->containingBlock()->insertPositionedObject(box); @@ -899,10 +872,10 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i // Now we position all of our text runs horizontally. if (!isSVGRootInlineBox) - computeHorizontalPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap); + computeInlineDirectionPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap); // Now position our text runs vertically. - computeVerticalPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap); + computeBlockDirectionPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap); #if ENABLE(SVG) // SVG text layout code computes vertical & horizontal positions on its own. @@ -937,22 +910,22 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i int adjustment = 0; adjustLinePositionForPagination(lineBox, adjustment); if (adjustment) { - int oldLineWidth = lineWidth(oldHeight, firstLine); + int oldLineWidth = availableLogicalWidthForLine(oldHeight, firstLine); lineBox->adjustPosition(0, adjustment); if (useRepaintBounds) // This can only be a positive adjustment, so no need to update repaintTop. repaintBottom = max(repaintBottom, lineBox->bottomVisibleOverflow()); - if (lineWidth(oldHeight + adjustment, firstLine) != oldLineWidth) { + if (availableLogicalWidthForLine(oldHeight + adjustment, firstLine) != oldLineWidth) { // We have to delete this line, remove all floats that got added, and let line layout re-run. lineBox->deleteLine(renderArena()); removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldHeight); - setHeight(oldHeight + adjustment); + setLogicalHeight(oldHeight + adjustment); resolver.setPosition(oldEnd); end = oldEnd; continue; } - setHeight(lineBox->blockHeight()); + setLogicalHeight(lineBox->blockHeight()); } } } @@ -1003,12 +976,12 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { int floatTop = (*f)->y() - (*f)->marginTop(); insertFloatingObject(*f); - setHeight(floatTop + delta); + setLogicalHeight(floatTop + delta); positionNewFloats(); } } } - setHeight(lastRootBox()->blockHeight()); + setLogicalHeight(lastRootBox()->blockHeight()); } else { // Delete all the remaining lines. RootInlineBox* line = endLine; @@ -1033,8 +1006,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i m_lineBoxes.appendLineBox(trailingFloatsLineBox); trailingFloatsLineBox->setConstructed(); GlyphOverflowAndFallbackFontsMap textBoxDataMap; - trailingFloatsLineBox->verticallyAlignBoxes(height(), textBoxDataMap); - trailingFloatsLineBox->setVerticalOverflowPositions(height(), bottomLayoutOverflow, height(), bottomVisualOverflow, 0); + trailingFloatsLineBox->alignBoxesInBlockDirection(height(), textBoxDataMap); + trailingFloatsLineBox->setBlockDirectionOverflowPositions(height(), bottomLayoutOverflow, height(), bottomVisualOverflow, 0); trailingFloatsLineBox->setBlockHeight(height()); } if (lastFloat) { @@ -1061,10 +1034,10 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i } // Now add in the bottom border/padding. - setHeight(height() + toAdd); + setLogicalHeight(height() + toAdd); if (!firstLineBox() && hasLineIfEmpty()) - setHeight(height() + lineHeight(true, true)); + setLogicalHeight(height() + lineHeight(true, true)); // See if we have any lines that spill out of our block. If we do, then we will possibly need to // truncate text. @@ -1179,7 +1152,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa Vector<RenderBox*>::iterator end = cleanLineFloats->end(); for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { insertFloatingObject(*f); - setHeight((*f)->y() - (*f)->marginTop()); + setLogicalHeight((*f)->y() - (*f)->marginTop()); positionNewFloats(); ASSERT(floats[numCleanFloats].object == *f); numCleanFloats++; @@ -1187,7 +1160,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa } line = line->nextRootBox(); } - setHeight(savedHeight); + setLogicalHeight(savedHeight); } firstLine = !last; @@ -1196,7 +1169,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa RenderObject* startObj; int pos = 0; if (last) { - setHeight(last->blockHeight()); + setLogicalHeight(last->blockHeight()); startObj = last->lineBreakObj(); pos = last->lineBreakPos(); resolver.setStatus(last->lineBreakBidiStatus()); @@ -1414,14 +1387,14 @@ void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEm // A relative positioned inline encloses us. In this case, we also have to determine our // position as though we were an inline. Set |staticX| and |staticY| on the relative positioned // inline so that we can obtain the value later. - toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : rightOffset(height(), false)); + toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), false) : logicalRightOffsetForLine(height(), false)); toRenderInline(c)->layer()->setStaticY(height()); } RenderBox* box = toRenderBox(object); if (box->style()->hasStaticX()) { if (box->style()->isOriginalDisplayInlineType()) - box->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : width() - rightOffset(height(), false)); + box->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), false) : width() - logicalRightOffsetForLine(height(), false)); else box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight()); } @@ -1436,12 +1409,12 @@ void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEm int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly, FloatingObject* lastFloatFromPreviousLine) { - int availableWidth = lineWidth(height(), firstLine); + int availableWidth = availableLogicalWidthForLine(height(), firstLine); while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), isLineEmpty, previousLineBrokeCleanly)) { RenderObject* object = resolver.position().obj; if (object->isFloating()) { positionNewFloatOnLine(insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine); - availableWidth = lineWidth(height(), firstLine); + availableWidth = availableLogicalWidthForLine(height(), firstLine); } else if (object->isPositioned()) { // FIXME: The math here is actually not really right. It's a best-guess approximation that // will work for the common cases @@ -1450,14 +1423,14 @@ int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL // A relative positioned inline encloses us. In this case, we also have to determine our // position as though we were an inline. Set |staticX| and |staticY| on the relative positioned // inline so that we can obtain the value later. - toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine)); + toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), firstLine) : logicalRightOffsetForLine(height(), firstLine)); toRenderInline(c)->layer()->setStaticY(height()); } RenderBox* box = toRenderBox(object); if (box->style()->hasStaticX()) { if (box->style()->isOriginalDisplayInlineType()) - box->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : width() - rightOffset(height(), firstLine)); + box->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), firstLine) : width() - logicalRightOffsetForLine(height(), firstLine)); else box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight()); } @@ -1500,14 +1473,14 @@ void RenderBlock::fitBelowFloats(int widthToFit, bool firstLine, int& availableW if (!floatBottom) break; - newLineWidth = lineWidth(floatBottom, firstLine); + newLineWidth = availableLogicalWidthForLine(floatBottom, firstLine); lastFloatBottom = floatBottom; if (newLineWidth >= widthToFit) break; } if (newLineWidth > availableWidth) { - setHeight(lastFloatBottom); + setLogicalHeight(lastFloatBottom); availableWidth = newLineWidth; } } @@ -1650,7 +1623,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool // it after moving to next line (in newLine() func) if (floatsFitOnLine && floatBox->width() + floatBox->marginLeft() + floatBox->marginRight() + w + tmpW <= width) { positionNewFloatOnLine(f, lastFloatFromPreviousLine); - width = lineWidth(height(), firstLine); + width = availableLogicalWidthForLine(height(), firstLine); } else floatsFitOnLine = false; } else if (o->isPositioned()) { @@ -1790,6 +1763,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool bool breakWords = o->style()->breakWords() && ((autoWrap && !w) || currWS == PRE); bool midWordBreak = false; bool breakAll = o->style()->wordBreak() == BreakAllWordBreak && autoWrap; + int hyphenWidth = 0; if (t->isWordBreak()) { w += tmpW; @@ -1808,48 +1782,13 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool if (!collapseWhiteSpace || !currentCharacterIsSpace) isLineEmpty = false; - - // Check for soft hyphens. Go ahead and ignore them. - if (c == softHyphen) { - if (!ignoringSpaces) { - // Ignore soft hyphens - InlineIterator beforeSoftHyphen; - if (pos) - beforeSoftHyphen = InlineIterator(0, o, pos - 1); - else - beforeSoftHyphen = InlineIterator(0, last, last->isText() ? toRenderText(last)->textLength() - 1 : 0); - // Two consecutive soft hyphens. Avoid overlapping midpoints. - if (lineMidpointState.numMidpoints && lineMidpointState.midpoints[lineMidpointState.numMidpoints - 1].obj == o && - lineMidpointState.midpoints[lineMidpointState.numMidpoints - 1].pos == pos) - lineMidpointState.numMidpoints--; - else - addMidpoint(lineMidpointState, beforeSoftHyphen); - - // Add the width up to but not including the hyphen. - tmpW += textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing; - - // For wrapping text only, include the hyphen. We need to ensure it will fit - // on the line if it shows when we break. - if (autoWrap) - tmpW += textWidth(t, pos, 1, f, w + tmpW, isFixedPitch, collapseWhiteSpace); - - InlineIterator afterSoftHyphen(0, o, pos); - afterSoftHyphen.increment(); - addMidpoint(lineMidpointState, afterSoftHyphen); - } - pos++; - len--; - lastSpaceWordSpacing = 0; - lastSpace = pos; // Cheesy hack to prevent adding in widths of the run twice. - if (style->hyphens() == HyphensNone) { - // Prevent a line break at the soft hyphen by ensuring that betweenWords is false - // in the next iteration. - atStart = true; - } - continue; + if (c == softHyphen && autoWrap && !hyphenWidth && style->hyphens() != HyphensNone) { + const AtomicString& hyphenString = style->hyphenString(); + hyphenWidth = f.width(TextRun(hyphenString.characters(), hyphenString.length())); + tmpW += hyphenWidth; } - + #if ENABLE(SVG) if (isSVGText) { RenderSVGInlineText* svgInlineText = static_cast<RenderSVGInlineText*>(t); @@ -1872,8 +1811,8 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool midWordBreak = w + wrapW + charWidth > width; } - bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(str, pos, strlen, nextBreakable, breakNBSP)); - + bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(str, pos, strlen, nextBreakable, breakNBSP) && (style->hyphens() != HyphensNone || (pos && str[pos - 1] != softHyphen))); + if (betweenWords || midWordBreak) { bool stoppedIgnoringSpaces = false; if (ignoringSpaces) { @@ -1943,13 +1882,17 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool lBreak.increment(); previousLineBrokeCleanly = true; } + if (lBreak.obj && lBreak.pos && lBreak.obj->isText() && toRenderText(lBreak.obj)->textLength() && toRenderText(lBreak.obj)->characters()[lBreak.pos - 1] == softHyphen && style->hyphens() != HyphensNone) + hyphenated = true; goto end; // Didn't fit. Jump to the end. } else { if (!betweenWords || (midWordBreak && !autoWrap)) tmpW -= additionalTmpW; - if (pos > 0 && str[pos-1] == softHyphen) + if (hyphenWidth) { // Subtract the width of the soft hyphen out since we fit on a line. - tmpW -= textWidth(t, pos - 1, 1, f, w + tmpW, isFixedPitch, collapseWhiteSpace); + tmpW -= hyphenWidth; + hyphenWidth = 0; + } } } @@ -2194,14 +2137,6 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool lBreak.increment(); } - if (lBreak.obj && lBreak.pos >= 2 && lBreak.obj->isText()) { - // For soft hyphens on line breaks, we have to chop out the midpoints that made us - // ignore the hyphen so that it will render at the end of the line. - UChar c = toRenderText(lBreak.obj)->characters()[lBreak.pos - 1]; - if (c == softHyphen) - chopMidpointsAt(lineMidpointState, lBreak.obj, lBreak.pos - 2); - } - return lBreak; } @@ -2237,9 +2172,9 @@ void RenderBlock::checkLinesForTextOverflow() // Include the scrollbar for overflow blocks, which means we want to use "contentWidth()" bool ltr = style()->direction() == LTR; for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { - int blockRightEdge = rightOffset(curr->y(), curr == firstRootBox()); - int blockLeftEdge = leftOffset(curr->y(), curr == firstRootBox()); - int lineBoxEdge = ltr ? curr->x() + curr->width() : curr->x(); + int blockRightEdge = logicalRightOffsetForLine(curr->y(), curr == firstRootBox()); + int blockLeftEdge = logicalLeftOffsetForLine(curr->y(), curr == firstRootBox()); + int lineBoxEdge = ltr ? curr->x() + curr->logicalWidth() : curr->x(); if ((ltr && lineBoxEdge > blockRightEdge) || (!ltr && lineBoxEdge < blockLeftEdge)) { // This line spills out of our box in the appropriate direction. Now we need to see if the line // can be truncated. In order for truncation to be possible, the line must have sufficient space to diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 33772a3..553be53 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -75,8 +75,8 @@ RenderBox::RenderBox(Node* node) , m_marginRight(0) , m_marginTop(0) , m_marginBottom(0) - , m_minPrefWidth(-1) - , m_maxPrefWidth(-1) + , m_minPreferredLogicalWidth(-1) + , m_maxPreferredLogicalWidth(-1) , m_inlineBoxWrapper(0) #ifdef ANDROID_LAYOUT , m_visibleWidth(0) @@ -90,6 +90,158 @@ RenderBox::~RenderBox() { } +int RenderBox::marginBefore() const +{ + return marginBeforeUsing(style()); +} + +int RenderBox::marginBeforeUsing(const RenderStyle* s) const +{ + switch (s->blockFlow()) { + case TopToBottomBlockFlow: + return m_marginTop; + case BottomToTopBlockFlow: + return m_marginBottom; + case LeftToRightBlockFlow: + return m_marginLeft; + case RightToLeftBlockFlow: + return m_marginRight; + } + ASSERT_NOT_REACHED(); + return m_marginTop; +} + +int RenderBox::marginAfter() const +{ + return marginAfterUsing(style()); +} + +int RenderBox::marginAfterUsing(const RenderStyle* s) const +{ + switch (s->blockFlow()) { + case TopToBottomBlockFlow: + return m_marginBottom; + case BottomToTopBlockFlow: + return m_marginTop; + case LeftToRightBlockFlow: + return m_marginRight; + case RightToLeftBlockFlow: + return m_marginLeft; + } + ASSERT_NOT_REACHED(); + return m_marginBottom; +} + +int RenderBox::marginStart() const +{ + return marginStartUsing(style()); +} + +int RenderBox::marginStartUsing(const RenderStyle* s) const +{ + if (s->isVerticalBlockFlow()) + return s->direction() == LTR ? m_marginLeft : m_marginRight; + return s->direction() == LTR ? m_marginTop : m_marginBottom; +} + +int RenderBox::marginEnd() const +{ + return marginEndUsing(style()); +} + +int RenderBox::marginEndUsing(const RenderStyle* s) const +{ + if (s->isVerticalBlockFlow()) + return s->direction() == LTR ? m_marginRight : m_marginLeft; + return s->direction() == LTR ? m_marginBottom : m_marginTop; +} + +void RenderBox::setMarginStart(int margin) +{ + setMarginStartUsing(style(), margin); +} + +void RenderBox::setMarginEnd(int margin) +{ + setMarginEndUsing(style(), margin); +} + +void RenderBox::setMarginStartUsing(const RenderStyle* s, int margin) +{ + if (s->isVerticalBlockFlow()) { + if (s->direction() == LTR) + m_marginLeft = margin; + else + m_marginRight = margin; + } else { + if (s->direction() == LTR) + m_marginTop = margin; + else + m_marginBottom = margin; + } +} + +void RenderBox::setMarginEndUsing(const RenderStyle* s, int margin) +{ + if (s->isVerticalBlockFlow()) { + if (s->direction() == LTR) + m_marginRight = margin; + else + m_marginLeft = margin; + } else { + if (s->direction() == LTR) + m_marginBottom = margin; + else + m_marginTop = margin; + } +} + +void RenderBox::setMarginBefore(int margin) +{ + setMarginBeforeUsing(style(), margin); +} + +void RenderBox::setMarginAfter(int margin) +{ + setMarginAfterUsing(style(), margin); +} + +void RenderBox::setMarginBeforeUsing(const RenderStyle* s, int margin) +{ + switch (s->blockFlow()) { + case TopToBottomBlockFlow: + m_marginTop = margin; + break; + case BottomToTopBlockFlow: + m_marginBottom = margin; + break; + case LeftToRightBlockFlow: + m_marginLeft = margin; + break; + case RightToLeftBlockFlow: + m_marginRight = margin; + break; + } +} + +void RenderBox::setMarginAfterUsing(const RenderStyle* s, int margin) +{ + switch (s->blockFlow()) { + case TopToBottomBlockFlow: + m_marginBottom = margin; + break; + case BottomToTopBlockFlow: + m_marginTop = margin; + break; + case LeftToRightBlockFlow: + m_marginRight = margin; + break; + case RightToLeftBlockFlow: + m_marginLeft = margin; + break; + } +} + void RenderBox::destroy() { // A lot of the code in this function is just pasted into @@ -195,6 +347,12 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle // Set the text color if we're the body. if (isBody()) document()->setTextColor(style()->visitedDependentColor(CSSPropertyColor)); + else if (oldStyle && isRoot() && oldStyle->blockFlow() != style()->blockFlow()) { + // Propagate the new block flow up to the RenderView. + RenderView* viewRenderer = view(); + viewRenderer->style()->setBlockFlow(style()->blockFlow()); + viewRenderer->setNeedsLayoutAndPrefWidthsRecalc(); + } } void RenderBox::updateBoxModelInfoFromStyle() @@ -468,20 +626,20 @@ void RenderBox::panScroll(const IntPoint& source) layer()->panScrollFromPoint(source); } -int RenderBox::minPrefWidth() const +int RenderBox::minPreferredLogicalWidth() const { - if (prefWidthsDirty()) - const_cast<RenderBox*>(this)->calcPrefWidths(); + if (preferredLogicalWidthsDirty()) + const_cast<RenderBox*>(this)->computePreferredLogicalWidths(); - return m_minPrefWidth; + return m_minPreferredLogicalWidth; } -int RenderBox::maxPrefWidth() const +int RenderBox::maxPreferredLogicalWidth() const { - if (prefWidthsDirty()) - const_cast<RenderBox*>(this)->calcPrefWidths(); + if (preferredLogicalWidthsDirty()) + const_cast<RenderBox*>(this)->computePreferredLogicalWidths(); - return m_maxPrefWidth; + return m_maxPreferredLogicalWidth; } int RenderBox::overrideSize() const @@ -516,33 +674,33 @@ int RenderBox::overrideHeight() const return hasOverrideSize() ? overrideSize() : height(); } -int RenderBox::calcBorderBoxWidth(int width) const +int RenderBox::computeBorderBoxLogicalWidth(int width) const { - int bordersPlusPadding = borderAndPaddingWidth(); + int bordersPlusPadding = borderAndPaddingLogicalWidth(); if (style()->boxSizing() == CONTENT_BOX) return width + bordersPlusPadding; return max(width, bordersPlusPadding); } -int RenderBox::calcBorderBoxHeight(int height) const +int RenderBox::computeBorderBoxLogicalHeight(int height) const { - int bordersPlusPadding = borderAndPaddingHeight(); + int bordersPlusPadding = borderAndPaddingLogicalHeight(); if (style()->boxSizing() == CONTENT_BOX) return height + bordersPlusPadding; return max(height, bordersPlusPadding); } -int RenderBox::calcContentBoxWidth(int width) const +int RenderBox::computeContentBoxLogicalWidth(int width) const { if (style()->boxSizing() == BORDER_BOX) - width -= borderAndPaddingWidth(); + width -= borderAndPaddingLogicalWidth(); return max(0, width); } -int RenderBox::calcContentBoxHeight(int height) const +int RenderBox::computeContentBoxLogicalHeight(int height) const { if (style()->boxSizing() == BORDER_BOX) - height -= borderAndPaddingHeight(); + height -= borderAndPaddingLogicalHeight(); return max(0, height); } @@ -858,7 +1016,7 @@ void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, b InlineBox* boxWrap = inlineBoxWrapper(); RootInlineBox* r = boxWrap ? boxWrap->root() : 0; if (r) { - FloatRect rootRect(tx + r->x(), ty + r->selectionTop(), r->width(), r->selectionHeight()); + FloatRect rootRect(tx + r->x(), ty + r->selectionTop(), r->logicalWidth(), r->selectionHeight()); FloatRect imageRect(tx + x(), rootRect.y(), width(), rootRect.height()); page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, rootRect, behindText, false); } else { @@ -964,12 +1122,30 @@ IntRect RenderBox::clipRect(int tx, int ty) return IntRect(clipX, clipY, clipWidth, clipHeight); } -int RenderBox::containingBlockWidthForContent() const +int RenderBox::containingBlockLogicalWidthForContent() const { RenderBlock* cb = containingBlock(); if (shrinkToAvoidFloats()) - return cb->lineWidth(y(), false); - return cb->availableWidth(); + return cb->availableLogicalWidthForLine(y(), false); + return cb->availableLogicalWidth(); +} + +int RenderBox::perpendicularContainingBlockLogicalHeight() const +{ + RenderBlock* cb = containingBlock(); + RenderStyle* containingBlockStyle = cb->style(); + Length logicalHeightLength = containingBlockStyle->logicalHeight(); + + // FIXME: For now just support fixed heights. Eventually should support percentage heights as well. + if (!logicalHeightLength.isFixed()) { + // Rather than making the child be completely unconstrained, WinIE uses the viewport width and height + // as a constraint. We do that for now as well even though it's likely being unconstrained is what the spec + // will decide. + return containingBlockStyle->isVerticalBlockFlow() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWidth(); + } + + // Use the content box logical height as specified by the style. + return cb->computeContentBoxLogicalHeight(logicalHeightLength.value()); } void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const @@ -1276,6 +1452,7 @@ void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect) } } +<<<<<<< HEAD #ifdef ANDROID_LAYOUT void RenderBox::setVisibleWidth(int newWidth) { const Settings* settings = document()->settings(); @@ -1298,6 +1475,9 @@ bool RenderBox::checkAndSetRelayoutChildren(bool* relayoutChildren) { #endif void RenderBox::calcWidth() +======= +void RenderBox::computeLogicalWidth() +>>>>>>> webkit.org at r68651 { #ifdef ANDROID_LAYOUT if (view()->frameView()) @@ -1305,36 +1485,44 @@ void RenderBox::calcWidth() #endif if (isPositioned()) { - calcAbsoluteHorizontal(); + // FIXME: This calculation is not patched for block-flow yet. + // https://bugs.webkit.org/show_bug.cgi?id=46500 + computePositionedLogicalWidth(); return; } - // If layout is limited to a subtree, the subtree root's width does not change. + // If layout is limited to a subtree, the subtree root's logical width does not change. if (node() && view()->frameView() && view()->frameView()->layoutRoot(true) == this) return; // The parent box is flexing us, so it has increased or decreased our // width. Use the width from the style context. + // FIXME: Account for block-flow in flexible boxes. + // https://bugs.webkit.org/show_bug.cgi?id=46418 if (hasOverrideSize() && parent()->style()->boxOrient() == HORIZONTAL && parent()->isFlexibleBox() && parent()->isFlexingChildren()) { - setWidth(overrideSize()); + setLogicalWidth(overrideSize()); return; } + // FIXME: Account for block-flow in flexible boxes. + // https://bugs.webkit.org/show_bug.cgi?id=46418 bool inVerticalBox = parent()->isFlexibleBox() && (parent()->style()->boxOrient() == VERTICAL); bool stretching = (parent()->style()->boxAlign() == BSTRETCH); - bool treatAsReplaced = shouldCalculateSizeAsReplaced() && (!inVerticalBox || !stretching); + bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching); - Length w = (treatAsReplaced) ? Length(calcReplacedWidth(), Fixed) : style()->width(); + Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedWidth(), Fixed) : style()->logicalWidth(); RenderBlock* cb = containingBlock(); - int containerWidth = max(0, containingBlockWidthForContent()); - - Length marginLeft = style()->marginLeft(); - Length marginRight = style()->marginRight(); - + int containerLogicalWidth = max(0, containingBlockLogicalWidthForContent()); + bool hasPerpendicularContainingBlock = cb->style()->isVerticalBlockFlow() != style()->isVerticalBlockFlow(); + int containerWidthInInlineDirection = containerLogicalWidth; + if (hasPerpendicularContainingBlock) + containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight(); + if (isInline() && !isInlineBlockOrInlineTable()) { // just calculate margins +<<<<<<< HEAD m_marginLeft = marginLeft.calcMinValue(containerWidth); m_marginRight = marginRight.calcMinValue(containerWidth); #ifdef ANDROID_LAYOUT @@ -1355,38 +1543,46 @@ void RenderBox::calcWidth() } } #endif +======= + setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth)); + setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth)); + if (treatAsReplaced) + setLogicalWidth(max(logicalWidthLength.value() + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth())); +>>>>>>> webkit.org at r68651 return; } // Width calculations if (treatAsReplaced) - setWidth(w.value() + borderAndPaddingWidth()); + setLogicalWidth(logicalWidthLength.value() + borderAndPaddingLogicalWidth()); else { - // Calculate Width - setWidth(calcWidthUsing(Width, containerWidth)); - - // Calculate MaxWidth - if (!style()->maxWidth().isUndefined()) { - int maxW = calcWidthUsing(MaxWidth, containerWidth); - if (width() > maxW) { - setWidth(maxW); - w = style()->maxWidth(); + // Calculate LogicalWidth + setLogicalWidth(computeLogicalWidthUsing(LogicalWidth, containerWidthInInlineDirection)); + + // Calculate MaxLogicalWidth + if (!style()->logicalMaxWidth().isUndefined()) { + int maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection); + if (logicalWidth() > maxLogicalWidth) { + setLogicalWidth(maxLogicalWidth); + logicalWidthLength = style()->logicalMaxWidth(); } } - // Calculate MinWidth - int minW = calcWidthUsing(MinWidth, containerWidth); - if (width() < minW) { - setWidth(minW); - w = style()->minWidth(); + // Calculate MinLogicalWidth + int minLogicalWidth = computeLogicalWidthUsing(MinLogicalWidth, containerWidthInInlineDirection); + if (logicalWidth() < minLogicalWidth) { + setLogicalWidth(minLogicalWidth); + logicalWidthLength = style()->logicalMinWidth(); } } - if (stretchesToMinIntrinsicWidth()) { - setWidth(max(width(), minPrefWidth())); - w = Length(width(), Fixed); + // Fieldsets are currently the only objects that stretch to their minimum width. + if (stretchesToMinIntrinsicLogicalWidth()) { + setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth())); + logicalWidthLength = Length(logicalWidth(), Fixed); } +<<<<<<< HEAD // Margin calculations if (w.isAuto()) { m_marginLeft = marginLeft.calcMinValue(containerWidth); @@ -1411,44 +1607,48 @@ void RenderBox::calcWidth() setWidth(width() -(m_marginLeft + m_marginRight)); } #endif +======= + // Margin calculations. + if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock || isFloating() || isInline()) { + setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth)); + setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth)); + } else + computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth()); +>>>>>>> webkit.org at r68651 - if (containerWidth && containerWidth != (width() + m_marginLeft + m_marginRight) - && !isFloating() && !isInline() && !cb->isFlexibleBox()) { - if (cb->style()->direction() == LTR) - m_marginRight = containerWidth - width() - m_marginLeft; - else - m_marginLeft = containerWidth - width() - m_marginRight; - } + if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (logicalWidth() + marginStart() + marginEnd()) + && !isFloating() && !isInline() && !cb->isFlexibleBox()) + setMarginEndUsing(cb->style(), containerLogicalWidth - logicalWidth() - marginStartUsing(cb->style())); } -int RenderBox::calcWidthUsing(WidthType widthType, int cw) +int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availableLogicalWidth) { - int widthResult = width(); - Length w; - if (widthType == Width) - w = style()->width(); - else if (widthType == MinWidth) - w = style()->minWidth(); + int logicalWidthResult = logicalWidth(); + Length logicalWidth; + if (widthType == LogicalWidth) + logicalWidth = style()->logicalWidth(); + else if (widthType == MinLogicalWidth) + logicalWidth = style()->logicalMinWidth(); else - w = style()->maxWidth(); + logicalWidth = style()->logicalMaxWidth(); - if (w.isIntrinsicOrAuto()) { - int marginLeft = style()->marginLeft().calcMinValue(cw); - int marginRight = style()->marginRight().calcMinValue(cw); - if (cw) - widthResult = cw - marginLeft - marginRight; + if (logicalWidth.isIntrinsicOrAuto()) { + int marginStart = style()->marginStart().calcMinValue(availableLogicalWidth); + int marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth); + if (availableLogicalWidth) + logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; - if (sizesToIntrinsicWidth(widthType)) { - widthResult = max(widthResult, minPrefWidth()); - widthResult = min(widthResult, maxPrefWidth()); + if (sizesToIntrinsicLogicalWidth(widthType)) { + logicalWidthResult = max(logicalWidthResult, minPreferredLogicalWidth()); + logicalWidthResult = min(logicalWidthResult, maxPreferredLogicalWidth()); } - } else - widthResult = calcBorderBoxWidth(w.calcValue(cw)); + } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead. + logicalWidthResult = computeBorderBoxLogicalWidth(logicalWidth.calcValue(availableLogicalWidth)); - return widthResult; + return logicalWidthResult; } -bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const +bool RenderBox::sizesToIntrinsicLogicalWidth(LogicalWidthType widthType) const { // Marquees in WinIE are like a mixture of blocks and inline-blocks. They size as though they're blocks, // but they allow text to sit on the same line as the marquee. @@ -1457,12 +1657,15 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const // This code may look a bit strange. Basically width:intrinsic should clamp the size when testing both // min-width and width. max-width is only clamped if it is also intrinsic. - Length width = (widthType == MaxWidth) ? style()->maxWidth() : style()->width(); - if (width.type() == Intrinsic) + Length logicalWidth = (widthType == MaxLogicalWidth) ? style()->logicalMaxWidth() : style()->logicalWidth(); + if (logicalWidth.type() == Intrinsic) return true; // Children of a horizontal marquee do not fill the container by default. // FIXME: Need to deal with MAUTO value properly. It could be vertical. + // FIXME: Think about block-flow here. Need to find out how marquee direction relates to + // block-flow (as well as how marquee overflow should relate to block flow). + // https://bugs.webkit.org/show_bug.cgi?id=46472 if (parent()->style()->overflowX() == OMARQUEE) { EMarqueeDirection dir = parent()->style()->marqueeDirection(); if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT) @@ -1471,6 +1674,8 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const // Flexible horizontal boxes lay out children at their intrinsic widths. Also vertical boxes // that don't stretch their kids lay out their children at their intrinsic widths. + // FIXME: Think about block-flow here. + // https://bugs.webkit.org/show_bug.cgi?id=46473 if (parent()->isFlexibleBox() && (parent()->style()->boxOrient() == HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) return true; @@ -1478,82 +1683,108 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const // Button, input, select, textarea, legend and datagrid treat // width value of 'auto' as 'intrinsic' unless it's in a // stretching vertical flexbox. - if (width.type() == Auto && !(parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->style()->boxAlign() == BSTRETCH) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag) || node()->hasTagName(datagridTag))) + // FIXME: Think about block-flow here. + // https://bugs.webkit.org/show_bug.cgi?id=46473 + if (logicalWidth.type() == Auto && !(parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->style()->boxAlign() == BSTRETCH) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag) || node()->hasTagName(datagridTag))) return true; return false; } -void RenderBox::calcHorizontalMargins(const Length& marginLeft, const Length& marginRight, int containerWidth) +void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, int containerWidth, int childWidth) { - if (isFloating() || isInline()) { - // Inline blocks/tables and floats don't have their margins increased. - m_marginLeft = marginLeft.calcMinValue(containerWidth); - m_marginRight = marginRight.calcMinValue(containerWidth); + const RenderStyle* containingBlockStyle = containingBlock->style(); + Length marginStartLength = style()->marginStartUsing(containingBlockStyle); + Length marginEndLength = style()->marginEndUsing(containingBlockStyle); + + // Case One: The object is being centered in the containing block's available logical width. + if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth < containerWidth) + || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containingBlock->style()->textAlign() == WEBKIT_CENTER)) { + setMarginStartUsing(containingBlockStyle, max(0, (containerWidth - childWidth) / 2)); + setMarginEndUsing(containingBlockStyle, containerWidth - childWidth - marginStartUsing(containingBlockStyle)); return; - } - - if ((marginLeft.isAuto() && marginRight.isAuto() && width() < containerWidth) - || (!marginLeft.isAuto() && !marginRight.isAuto() && containingBlock()->style()->textAlign() == WEBKIT_CENTER)) { - m_marginLeft = max(0, (containerWidth - width()) / 2); - m_marginRight = containerWidth - width() - m_marginLeft; - } else if ((marginRight.isAuto() && width() < containerWidth) - || (!marginLeft.isAuto() && containingBlock()->style()->direction() == RTL && containingBlock()->style()->textAlign() == WEBKIT_LEFT)) { - m_marginLeft = marginLeft.calcValue(containerWidth); - m_marginRight = containerWidth - width() - m_marginLeft; - } else if ((marginLeft.isAuto() && width() < containerWidth) - || (!marginRight.isAuto() && containingBlock()->style()->direction() == LTR && containingBlock()->style()->textAlign() == WEBKIT_RIGHT)) { - m_marginRight = marginRight.calcValue(containerWidth); - m_marginLeft = containerWidth - width() - m_marginRight; - } else { - // This makes auto margins 0 if we failed a width() < containerWidth test above (css2.1, 10.3.3). - m_marginLeft = marginLeft.calcMinValue(containerWidth); - m_marginRight = marginRight.calcMinValue(containerWidth); - } + } + + // Case Two: The object is being pushed to the start of the containing block's available logical width. + if (marginEndLength.isAuto() && childWidth < containerWidth) { + setMarginStartUsing(containingBlockStyle, marginStartLength.calcValue(containerWidth)); + setMarginEndUsing(containingBlockStyle, containerWidth - childWidth - marginStartUsing(containingBlockStyle)); + return; + } + + // Case Three: The object is being pushed to the end of the containing block's available logical width. + bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((containingBlockStyle->direction() == RTL && containingBlockStyle->textAlign() == WEBKIT_LEFT) + || (containingBlockStyle->direction() == LTR && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); + if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) { + setMarginEndUsing(containingBlockStyle, marginEndLength.calcValue(containerWidth)); + setMarginStartUsing(containingBlockStyle, containerWidth - childWidth - marginEndUsing(containingBlockStyle)); + return; + } + + // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3). In that case + // auto margins will just turn into 0. + setMarginStartUsing(containingBlockStyle, marginStartLength.calcMinValue(containerWidth)); + setMarginEndUsing(containingBlockStyle, marginEndLength.calcMinValue(containerWidth)); } -void RenderBox::calcHeight() +void RenderBox::computeLogicalHeight() { // Cell height is managed by the table and inline non-replaced elements do not support a height property. if (isTableCell() || (isInline() && !isReplaced())) return; Length h; - if (isPositioned()) - calcAbsoluteVertical(); - else { - calcVerticalMargins(); + if (isPositioned()) { + // FIXME: This calculation is not patched for block-flow yet. + // https://bugs.webkit.org/show_bug.cgi?id=46500 + computePositionedLogicalHeight(); + } else { + RenderBlock* cb = containingBlock(); + bool hasPerpendicularContainingBlock = cb->style()->isVerticalBlockFlow() != style()->isVerticalBlockFlow(); + + if (!hasPerpendicularContainingBlock) + computeBlockDirectionMargins(cb); // For tables, calculate margins only. - if (isTable()) + if (isTable()) { + if (hasPerpendicularContainingBlock) + computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), logicalHeight()); return; + } + // FIXME: Account for block-flow in flexible boxes. + // https://bugs.webkit.org/show_bug.cgi?id=46418 bool inHorizontalBox = parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL; bool stretching = parent()->style()->boxAlign() == BSTRETCH; - bool treatAsReplaced = shouldCalculateSizeAsReplaced() && (!inHorizontalBox || !stretching); + bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inHorizontalBox || !stretching); bool checkMinMaxHeight = false; // The parent box is flexing us, so it has increased or decreased our height. We have to // grab our cached flexible height. + // FIXME: Account for block-flow in flexible boxes. + // https://bugs.webkit.org/show_bug.cgi?id=46418 if (hasOverrideSize() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->isFlexingChildren()) - h = Length(overrideSize() - borderAndPaddingHeight(), Fixed); + h = Length(overrideSize() - borderAndPaddingLogicalHeight(), Fixed); else if (treatAsReplaced) - h = Length(calcReplacedHeight(), Fixed); + h = Length(computeReplacedHeight(), Fixed); else { - h = style()->height(); + h = style()->logicalHeight(); checkMinMaxHeight = true; } // Block children of horizontal flexible boxes fill the height of the box. + // FIXME: Account for block-flow in flexible boxes. + // https://bugs.webkit.org/show_bug.cgi?id=46418 if (h.isAuto() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL && parent()->isStretchingChildren()) { - h = Length(parentBox()->contentHeight() - marginTop() - marginBottom() - borderAndPaddingHeight(), Fixed); + h = Length(parentBox()->contentLogicalHeight() - marginBefore() - marginAfter() - borderAndPaddingLogicalHeight(), Fixed); checkMinMaxHeight = false; } int heightResult; if (checkMinMaxHeight) { +<<<<<<< HEAD #ifdef ANDROID_LAYOUT // in SSR mode, ignore CSS height as layout is so different if (document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) @@ -1561,10 +1792,13 @@ void RenderBox::calcHeight() else #endif heightResult = calcHeightUsing(style()->height()); +======= + heightResult = computeLogicalHeightUsing(style()->logicalHeight()); +>>>>>>> webkit.org at r68651 if (heightResult == -1) - heightResult = height(); - int minH = calcHeightUsing(style()->minHeight()); // Leave as -1 if unset. - int maxH = style()->maxHeight().isUndefined() ? heightResult : calcHeightUsing(style()->maxHeight()); + heightResult = logicalHeight(); + int minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset. + int maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight()); if (maxH == -1) maxH = heightResult; heightResult = min(maxH, heightResult); @@ -1573,10 +1807,13 @@ void RenderBox::calcHeight() // The only times we don't check min/max height are when a fixed length has // been given as an override. Just use that. The value has already been adjusted // for box-sizing. - heightResult = h.value() + borderAndPaddingHeight(); + heightResult = h.value() + borderAndPaddingLogicalHeight(); } - setHeight(heightResult); + setLogicalHeight(heightResult); + + if (hasPerpendicularContainingBlock) + computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), heightResult); } // WinIE quirk: The <html> block always fills the entire canvas in quirks mode. The <body> always fills the @@ -1585,36 +1822,46 @@ void RenderBox::calcHeight() // height since we don't set a height in RenderView when we're printing. So without this quirk, the // height has nothing to be a percentage of, and it ends up being 0. That is bad. bool paginatedContentNeedsBaseHeight = document()->printing() && h.isPercent() - && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->height().isPercent())); + && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->logicalHeight().isPercent())); if (stretchesToViewHeight() || paginatedContentNeedsBaseHeight) { - int margins = collapsedMarginTop() + collapsedMarginBottom(); - int visHeight = document()->printing() ? view()->pageHeight() : view()->viewHeight(); + // FIXME: Finish accounting for block flow here. + // https://bugs.webkit.org/show_bug.cgi?id=46603 + int margins = collapsedMarginBefore() + collapsedMarginAfter(); + int visHeight; + if (document()->printing()) + visHeight = static_cast<int>(view()->pageHeight()); + else { + if (style()->isVerticalBlockFlow()) + visHeight = view()->viewHeight(); + else + visHeight = view()->viewWidth(); + } if (isRoot()) - setHeight(max(height(), visHeight - margins)); + setLogicalHeight(max(logicalHeight(), visHeight - margins)); else { - int marginsBordersPadding = margins + parentBox()->marginTop() + parentBox()->marginBottom() + parentBox()->borderAndPaddingHeight(); - setHeight(max(height(), visHeight - marginsBordersPadding)); + int marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight(); + setLogicalHeight(max(logicalHeight(), visHeight - marginsBordersPadding)); } } } -int RenderBox::calcHeightUsing(const Length& h) +int RenderBox::computeLogicalHeightUsing(const Length& h) { - int height = -1; + int logicalHeight = -1; if (!h.isAuto()) { if (h.isFixed()) - height = h.value(); + logicalHeight = h.value(); else if (h.isPercent()) - height = calcPercentageHeight(h); - if (height != -1) { - height = calcBorderBoxHeight(height); - return height; + logicalHeight = computePercentageLogicalHeight(h); + if (logicalHeight != -1) { + logicalHeight = computeBorderBoxLogicalHeight(logicalHeight); + return logicalHeight; } } - return height; + return logicalHeight; } -int RenderBox::calcPercentageHeight(const Length& height) +int RenderBox::computePercentageLogicalHeight(const Length& height) { int result = -1; bool skippedAutoHeightContainingBlock = false; @@ -1624,7 +1871,7 @@ int RenderBox::calcPercentageHeight(const Length& height) // block that may have a specified height and then use it. In strict mode, this violates the // specification, which states that percentage heights just revert to auto if the containing // block has an auto height. - while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->height().isAuto()) { + while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->logicalHeight().isAuto()) { skippedAutoHeightContainingBlock = true; cb = cb->containingBlock(); cb->addPercentHeightDescendant(this); @@ -1633,7 +1880,9 @@ int RenderBox::calcPercentageHeight(const Length& height) // A positioned element that specified both top/bottom or that specifies height should be treated as though it has a height // explicitly specified that can be used for any percentage computations. - bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->height().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto())); + // FIXME: We can't just check top/bottom here. + // https://bugs.webkit.org/show_bug.cgi?id=46500 + bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto())); bool includeBorderPadding = isTable(); @@ -1652,7 +1901,7 @@ int RenderBox::calcPercentageHeight(const Length& height) // to grow to fill the space. This could end up being wrong in some cases, but it is // preferable to the alternative (sizing intrinsically and making the row end up too big). RenderTableCell* cell = toRenderTableCell(cb); - if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto())) + if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto())) return 0; return -1; } @@ -1661,24 +1910,24 @@ int RenderBox::calcPercentageHeight(const Length& height) } // Otherwise we only use our percentage height if our containing block had a specified // height. - else if (cb->style()->height().isFixed()) - result = cb->calcContentBoxHeight(cb->style()->height().value()); - else if (cb->style()->height().isPercent() && !isPositionedWithSpecifiedHeight) { + else if (cb->style()->logicalHeight().isFixed()) + result = cb->computeContentBoxLogicalHeight(cb->style()->logicalHeight().value()); + else if (cb->style()->logicalHeight().isPercent() && !isPositionedWithSpecifiedHeight) { // We need to recur and compute the percentage height for our containing block. - result = cb->calcPercentageHeight(cb->style()->height()); + result = cb->computePercentageLogicalHeight(cb->style()->logicalHeight()); if (result != -1) - result = cb->calcContentBoxHeight(result); + result = cb->computeContentBoxLogicalHeight(result); } else if (cb->isRenderView() || (cb->isBody() && document()->inQuirksMode()) || isPositionedWithSpecifiedHeight) { // Don't allow this to affect the block' height() member variable, since this // can get called while the block is still laying out its kids. - int oldHeight = cb->height(); - cb->calcHeight(); - result = cb->contentHeight(); - cb->setHeight(oldHeight); + int oldHeight = cb->logicalHeight(); + cb->computeLogicalHeight(); + result = cb->contentLogicalHeight(); + cb->setLogicalHeight(oldHeight); } else if (cb->isRoot() && isPositioned()) // Match the positioned objects behavior, which is that positioned objects will fill their viewport - // always. Note we could only hit this case by recurring into calcPercentageHeight on a positioned containing block. - result = cb->calcContentBoxHeight(cb->availableHeight()); + // always. Note we could only hit this case by recurring into computePercentageLogicalHeight on a positioned containing block. + result = cb->computeContentBoxLogicalHeight(cb->availableLogicalHeight()); if (result != -1) { result = height.calcValue(result); @@ -1686,31 +1935,34 @@ int RenderBox::calcPercentageHeight(const Length& height) // It is necessary to use the border-box to match WinIE's broken // box model. This is essential for sizing inside // table cells using percentage heights. - result -= borderAndPaddingHeight(); + result -= borderAndPaddingLogicalHeight(); result = max(0, result); } } return result; } -int RenderBox::calcReplacedWidth(bool includeMaxWidth) const +int RenderBox::computeReplacedWidth(bool includeMaxWidth) const { - int width = calcReplacedWidthUsing(style()->width()); - int minW = calcReplacedWidthUsing(style()->minWidth()); - int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth()); + int width = computeReplacedWidthUsing(style()->width()); + int minW = computeReplacedWidthUsing(style()->minWidth()); + int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth()); return max(minW, min(width, maxW)); } -int RenderBox::calcReplacedWidthUsing(Length width) const +int RenderBox::computeReplacedWidthUsing(Length width) const { switch (width.type()) { case Fixed: - return calcContentBoxWidth(width.value()); + return computeContentBoxLogicalWidth(width.value()); case Percent: { - const int cw = isPositioned() ? containingBlockWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockWidthForContent(); + // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the + // containing block's block-flow. + // https://bugs.webkit.org/show_bug.cgi?id=46496 + const int cw = isPositioned() ? containingBlockWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent(); if (cw > 0) - return calcContentBoxWidth(width.calcMinValue(cw)); + return computeContentBoxLogicalWidth(width.calcMinValue(cw)); } // fall through default: @@ -1718,20 +1970,20 @@ int RenderBox::calcReplacedWidthUsing(Length width) const } } -int RenderBox::calcReplacedHeight() const +int RenderBox::computeReplacedHeight() const { - int height = calcReplacedHeightUsing(style()->height()); - int minH = calcReplacedHeightUsing(style()->minHeight()); - int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight()); + int height = computeReplacedHeightUsing(style()->height()); + int minH = computeReplacedHeightUsing(style()->minHeight()); + int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight()); return max(minH, min(height, maxH)); } -int RenderBox::calcReplacedHeightUsing(Length height) const +int RenderBox::computeReplacedHeightUsing(Length height) const { switch (height.type()) { case Fixed: - return calcContentBoxHeight(height.value()); + return computeContentBoxLogicalHeight(height.value()); case Percent: { RenderObject* cb = isPositioned() ? container() : containingBlock(); @@ -1744,13 +1996,13 @@ int RenderBox::calcReplacedHeightUsing(Length height) const ASSERT(cb->isRenderBlock()); RenderBlock* block = toRenderBlock(cb); int oldHeight = block->height(); - block->calcHeight(); - int newHeight = block->calcContentBoxHeight(block->contentHeight()); + block->computeLogicalHeight(); + int newHeight = block->computeContentBoxLogicalHeight(block->contentHeight()); block->setHeight(oldHeight); - return calcContentBoxHeight(height.calcValue(newHeight)); + return computeContentBoxLogicalHeight(height.calcValue(newHeight)); } - int availableHeight = isPositioned() ? containingBlockHeightForPositioned(toRenderBoxModelObject(cb)) : toRenderBox(cb)->availableHeight(); + int availableHeight = isPositioned() ? containingBlockHeightForPositioned(toRenderBoxModelObject(cb)) : toRenderBox(cb)->availableLogicalHeight(); // It is necessary to use the border-box to match WinIE's broken // box model. This is essential for sizing inside @@ -1762,68 +2014,66 @@ int RenderBox::calcReplacedHeightUsing(Length height) const return height.calcValue(availableHeight - borderAndPaddingHeight()); } - return calcContentBoxHeight(height.calcValue(availableHeight)); + return computeContentBoxLogicalHeight(height.calcValue(availableHeight)); } default: return intrinsicSize().height(); } } -int RenderBox::availableHeight() const +int RenderBox::availableLogicalHeight() const { - return availableHeightUsing(style()->height()); + return availableLogicalHeightUsing(style()->logicalHeight()); } -int RenderBox::availableHeightUsing(const Length& h) const +int RenderBox::availableLogicalHeightUsing(const Length& h) const { if (h.isFixed()) - return calcContentBoxHeight(h.value()); + return computeContentBoxLogicalHeight(h.value()); if (isRenderView()) - return toRenderView(this)->frameView()->visibleHeight(); + return style()->isVerticalBlockFlow() ? toRenderView(this)->frameView()->visibleHeight() : toRenderView(this)->frameView()->visibleWidth(); // We need to stop here, since we don't want to increase the height of the table // artificially. We're going to rely on this cell getting expanded to some new // height, and then when we lay out again we'll use the calculation below. if (isTableCell() && (h.isAuto() || h.isPercent())) - return overrideSize() - borderAndPaddingWidth(); + return overrideSize() - borderAndPaddingLogicalWidth(); if (h.isPercent()) - return calcContentBoxHeight(h.calcValue(containingBlock()->availableHeight())); + return computeContentBoxLogicalHeight(h.calcValue(containingBlock()->availableLogicalHeight())); + // FIXME: We can't just check top/bottom here. + // https://bugs.webkit.org/show_bug.cgi?id=46500 if (isRenderBlock() && isPositioned() && style()->height().isAuto() && !(style()->top().isAuto() || style()->bottom().isAuto())) { RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); - int oldHeight = block->height(); - block->calcHeight(); - int newHeight = block->calcContentBoxHeight(block->contentHeight()); - block->setHeight(oldHeight); - return calcContentBoxHeight(newHeight); + int oldHeight = block->logicalHeight(); + block->computeLogicalHeight(); + int newHeight = block->computeContentBoxLogicalHeight(block->contentLogicalHeight()); + block->setLogicalHeight(oldHeight); + return computeContentBoxLogicalHeight(newHeight); } - return containingBlock()->availableHeight(); -} - -int RenderBox::availableLogicalWidth() const -{ - if (style()->isVerticalBlockFlow()) - return contentWidth(); - return contentHeight(); + return containingBlock()->availableLogicalHeight(); } -void RenderBox::calcVerticalMargins() +void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock) { if (isTableCell()) { - m_marginTop = 0; - m_marginBottom = 0; + // FIXME: Not right if we allow cells to have different directionality than the table. If we do allow this, though, + // we may just do it with an extra anonymous block inside the cell. + setMarginBefore(0); + setMarginAfter(0); return; } - // margins are calculated with respect to the _width_ of + // Margins are calculated with respect to the logical width of // the containing block (8.3) - int cw = containingBlock()->contentWidth(); + int cw = containingBlockLogicalWidthForContent(); - m_marginTop = style()->marginTop().calcMinValue(cw); - m_marginBottom = style()->marginBottom().calcMinValue(cw); + RenderStyle* containingBlockStyle = containingBlock->style(); + setMarginBeforeUsing(containingBlockStyle, style()->marginBeforeUsing(containingBlockStyle).calcMinValue(cw)); + setMarginAfterUsing(containingBlockStyle, style()->marginAfterUsing(containingBlockStyle).calcMinValue(cw)); } int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const @@ -1846,11 +2096,11 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con int fromLeft; int fromRight; if (containingBlock->style()->direction() == LTR) { - fromLeft = first->x() + first->borderLeft(); - fromRight = last->x() + last->width() - last->borderRight(); + fromLeft = first->logicalLeft() + first->borderLogicalLeft(); + fromRight = last->logicalLeft() + last->logicalWidth() - last->borderLogicalRight(); } else { - fromRight = first->x() + first->width() - first->borderRight(); - fromLeft = last->x() + last->borderLeft(); + fromRight = first->logicalLeft() + first->logicalWidth() - first->borderLogicalRight(); + fromLeft = last->logicalLeft() + last->borderLogicalLeft(); } return max(0, (fromRight - fromLeft)); @@ -1868,10 +2118,10 @@ int RenderBox::containingBlockHeightForPositioned(const RenderBoxModelObject* co return heightResult - containingBlock->borderTop() - containingBlock->borderBottom(); } -void RenderBox::calcAbsoluteHorizontal() +void RenderBox::computePositionedLogicalWidth() { if (isReplaced()) { - calcAbsoluteHorizontalReplaced(); + computePositionedLogicalWidthReplaced(); return; } @@ -1881,8 +2131,8 @@ void RenderBox::calcAbsoluteHorizontal() // was previously done in calculating the static distances, or ourself, which // was also previously done for deciding what to override when you had // over-constrained margins? Also note that the container block is used - // in similar situations in other parts of the RenderBox class (see calcWidth() - // and calcHorizontalMargins()). For now we are using the parent for quirks + // in similar situations in other parts of the RenderBox class (see computeLogicalWidth() + // and computeMarginsInContainingBlockInlineDirection()). For now we are using the parent for quirks // mode and the containing block for strict mode. // FIXME 2: Should we still deal with these the cases of 'left' or 'right' having @@ -1896,7 +2146,7 @@ void RenderBox::calcAbsoluteHorizontal() // The following is based off of the W3C Working Draft from April 11, 2006 of // CSS 2.1: Section 10.3.7 "Absolutely positioned, non-replaced elements" // <http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width> - // (block-style-comments in this function and in calcAbsoluteHorizontalValues() + // (block-style-comments in this function and in computePositionedLogicalWidthUsing() // correspond to text from the spec) @@ -1968,7 +2218,7 @@ void RenderBox::calcAbsoluteHorizontal() // Calculate constraint equation values for 'width' case. int widthResult; int xResult; - calcAbsoluteHorizontalValues(style()->width(), containerBlock, containerDirection, + computePositionedLogicalWidthUsing(style()->width(), containerBlock, containerDirection, containerWidth, bordersPlusPadding, left, right, marginLeft, marginRight, widthResult, m_marginLeft, m_marginRight, xResult); @@ -1982,7 +2232,7 @@ void RenderBox::calcAbsoluteHorizontal() int maxMarginRight; int maxXPos; - calcAbsoluteHorizontalValues(style()->maxWidth(), containerBlock, containerDirection, + computePositionedLogicalWidthUsing(style()->maxWidth(), containerBlock, containerDirection, containerWidth, bordersPlusPadding, left, right, marginLeft, marginRight, maxWidth, maxMarginLeft, maxMarginRight, maxXPos); @@ -2002,7 +2252,7 @@ void RenderBox::calcAbsoluteHorizontal() int minMarginRight; int minXPos; - calcAbsoluteHorizontalValues(style()->minWidth(), containerBlock, containerDirection, + computePositionedLogicalWidthUsing(style()->minWidth(), containerBlock, containerDirection, containerWidth, bordersPlusPadding, left, right, marginLeft, marginRight, minWidth, minMarginLeft, minMarginRight, minXPos); @@ -2015,8 +2265,8 @@ void RenderBox::calcAbsoluteHorizontal() } } - if (stretchesToMinIntrinsicWidth() && width() < minPrefWidth() - bordersPlusPadding) { - calcAbsoluteHorizontalValues(Length(minPrefWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection, + if (stretchesToMinIntrinsicLogicalWidth() && width() < minPreferredLogicalWidth() - bordersPlusPadding) { + computePositionedLogicalWidthUsing(Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection, containerWidth, bordersPlusPadding, left, right, marginLeft, marginRight, widthResult, m_marginLeft, m_marginRight, xResult); @@ -2028,7 +2278,7 @@ void RenderBox::calcAbsoluteHorizontal() setWidth(width() + bordersPlusPadding); } -void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, +void RenderBox::computePositionedLogicalWidthUsing(Length width, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, const int containerWidth, const int bordersPlusPadding, const Length left, const Length right, const Length marginLeft, const Length marginRight, int& widthValue, int& marginLeftValue, int& marginRightValue, int& xPos) @@ -2060,7 +2310,7 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO // case because the value is not used for any further calculations. leftValue = left.calcValue(containerWidth); - widthValue = calcContentBoxWidth(width.calcValue(containerWidth)); + widthValue = computeContentBoxLogicalWidth(width.calcValue(containerWidth)); const int availableSpace = containerWidth - (leftValue + widthValue + right.calcValue(containerWidth) + bordersPlusPadding); @@ -2152,8 +2402,8 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO int rightValue = right.calcValue(containerWidth); // FIXME: would it be better to have shrink-to-fit in one step? - int preferredWidth = maxPrefWidth() - bordersPlusPadding; - int preferredMinWidth = minPrefWidth() - bordersPlusPadding; + int preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; + int preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding; int availableWidth = availableSpace - rightValue; widthValue = min(max(preferredMinWidth, availableWidth), preferredWidth); leftValue = availableSpace - (widthValue + rightValue); @@ -2162,13 +2412,13 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO leftValue = left.calcValue(containerWidth); // FIXME: would it be better to have shrink-to-fit in one step? - int preferredWidth = maxPrefWidth() - bordersPlusPadding; - int preferredMinWidth = minPrefWidth() - bordersPlusPadding; + int preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; + int preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding; int availableWidth = availableSpace - leftValue; widthValue = min(max(preferredMinWidth, availableWidth), preferredWidth); } else if (leftIsAuto && !width.isAuto() && !rightIsAuto) { // RULE 4: (solve for left) - widthValue = calcContentBoxWidth(width.calcValue(containerWidth)); + widthValue = computeContentBoxLogicalWidth(width.calcValue(containerWidth)); leftValue = availableSpace - (widthValue + right.calcValue(containerWidth)); } else if (!leftIsAuto && widthIsAuto && !rightIsAuto) { // RULE 5: (solve for width) @@ -2177,7 +2427,7 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO } else if (!leftIsAuto&& !widthIsAuto && rightIsAuto) { // RULE 6: (no need solve for right) leftValue = left.calcValue(containerWidth); - widthValue = calcContentBoxWidth(width.calcValue(containerWidth)); + widthValue = computeContentBoxLogicalWidth(width.calcValue(containerWidth)); } } @@ -2192,7 +2442,7 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO InlineFlowBox* firstLine = flow->firstLineBox(); InlineFlowBox* lastLine = flow->lastLineBox(); if (firstLine && lastLine && firstLine != lastLine) { - xPos = leftValue + marginLeftValue + lastLine->borderLeft() + (lastLine->x() - firstLine->x()); + xPos = leftValue + marginLeftValue + lastLine->borderLogicalLeft() + (lastLine->x() - firstLine->x()); return; } } @@ -2200,17 +2450,17 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO xPos = leftValue + marginLeftValue + containerBlock->borderLeft(); } -void RenderBox::calcAbsoluteVertical() +void RenderBox::computePositionedLogicalHeight() { if (isReplaced()) { - calcAbsoluteVerticalReplaced(); + computePositionedLogicalHeightReplaced(); return; } // The following is based off of the W3C Working Draft from April 11, 2006 of // CSS 2.1: Section 10.6.4 "Absolutely positioned, non-replaced elements" // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-non-replaced-height> - // (block-style-comments in this function and in calcAbsoluteVerticalValues() + // (block-style-comments in this function and in computePositionedLogicalHeightUsing() // correspond to text from the spec) @@ -2259,7 +2509,7 @@ void RenderBox::calcAbsoluteVertical() int y; // Calculate constraint equation values for 'height' case. - calcAbsoluteVerticalValues(style()->height(), containerBlock, containerHeight, bordersPlusPadding, + computePositionedLogicalHeightUsing(style()->height(), containerBlock, containerHeight, bordersPlusPadding, top, bottom, marginTop, marginBottom, h, m_marginTop, m_marginBottom, y); setY(y); @@ -2274,7 +2524,7 @@ void RenderBox::calcAbsoluteVertical() int maxMarginBottom; int maxYPos; - calcAbsoluteVerticalValues(style()->maxHeight(), containerBlock, containerHeight, bordersPlusPadding, + computePositionedLogicalHeightUsing(style()->maxHeight(), containerBlock, containerHeight, bordersPlusPadding, top, bottom, marginTop, marginBottom, maxHeight, maxMarginTop, maxMarginBottom, maxYPos); @@ -2293,7 +2543,7 @@ void RenderBox::calcAbsoluteVertical() int minMarginBottom; int minYPos; - calcAbsoluteVerticalValues(style()->minHeight(), containerBlock, containerHeight, bordersPlusPadding, + computePositionedLogicalHeightUsing(style()->minHeight(), containerBlock, containerHeight, bordersPlusPadding, top, bottom, marginTop, marginBottom, minHeight, minMarginTop, minMarginBottom, minYPos); @@ -2309,13 +2559,13 @@ void RenderBox::calcAbsoluteVertical() setHeight(h + bordersPlusPadding); } -void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject* containerBlock, +void RenderBox::computePositionedLogicalHeightUsing(Length h, const RenderBoxModelObject* containerBlock, const int containerHeight, const int bordersPlusPadding, const Length top, const Length bottom, const Length marginTop, const Length marginBottom, int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos) { // 'top' and 'bottom' cannot both be 'auto' because 'top would of been - // converted to the static position in calcAbsoluteVertical() + // converted to the static position in computePositionedLogicalHeight() ASSERT(!(top.isAuto() && bottom.isAuto())); int contentHeight = height() - bordersPlusPadding; @@ -2344,7 +2594,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject* // NOTE: It is not necessary to solve for 'bottom' in the over constrained // case because the value is not used for any further calculations. - heightValue = calcContentBoxHeight(h.calcValue(containerHeight)); + heightValue = computeContentBoxLogicalHeight(h.calcValue(containerHeight)); topValue = top.calcValue(containerHeight); const int availableSpace = containerHeight - (topValue + heightValue + bottom.calcValue(containerHeight) + bordersPlusPadding); @@ -2411,7 +2661,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject* heightValue = contentHeight; } else if (topIsAuto && !heightIsAuto && !bottomIsAuto) { // RULE 4: (solve of top) - heightValue = calcContentBoxHeight(h.calcValue(containerHeight)); + heightValue = computeContentBoxLogicalHeight(h.calcValue(containerHeight)); topValue = availableSpace - (heightValue + bottom.calcValue(containerHeight)); } else if (!topIsAuto && heightIsAuto && !bottomIsAuto) { // RULE 5: (solve of height) @@ -2419,7 +2669,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject* heightValue = max(0, availableSpace - (topValue + bottom.calcValue(containerHeight))); } else if (!topIsAuto && !heightIsAuto && bottomIsAuto) { // RULE 6: (no need solve of bottom) - heightValue = calcContentBoxHeight(h.calcValue(containerHeight)); + heightValue = computeContentBoxLogicalHeight(h.calcValue(containerHeight)); topValue = top.calcValue(containerHeight); } } @@ -2428,7 +2678,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject* yPos = topValue + marginTopValue + containerBlock->borderTop(); } -void RenderBox::calcAbsoluteHorizontalReplaced() +void RenderBox::computePositionedLogicalWidthReplaced() { // The following is based off of the W3C Working Draft from April 11, 2006 of // CSS 2.1: Section 10.3.8 "Absolutely positioned, replaced elements" @@ -2458,9 +2708,9 @@ void RenderBox::calcAbsoluteHorizontalReplaced() * elements. \*-----------------------------------------------------------------------*/ // NOTE: This value of width is FINAL in that the min/max width calculations - // are dealt with in calcReplacedWidth(). This means that the steps to produce + // are dealt with in computeReplacedWidth(). This means that the steps to produce // correct max/min in the non-replaced version, are not necessary. - setWidth(calcReplacedWidth() + borderAndPaddingWidth()); + setWidth(computeReplacedWidth() + borderAndPaddingWidth()); const int availableSpace = containerWidth - width(); /*-----------------------------------------------------------------------*\ @@ -2598,7 +2848,7 @@ void RenderBox::calcAbsoluteHorizontalReplaced() InlineFlowBox* firstLine = flow->firstLineBox(); InlineFlowBox* lastLine = flow->lastLineBox(); if (firstLine && lastLine && firstLine != lastLine) { - m_frameRect.setX(leftValue + m_marginLeft + lastLine->borderLeft() + (lastLine->x() - firstLine->x())); + m_frameRect.setX(leftValue + m_marginLeft + lastLine->borderLogicalLeft() + (lastLine->x() - firstLine->x())); return; } } @@ -2606,7 +2856,7 @@ void RenderBox::calcAbsoluteHorizontalReplaced() m_frameRect.setX(leftValue + m_marginLeft + containerBlock->borderLeft()); } -void RenderBox::calcAbsoluteVerticalReplaced() +void RenderBox::computePositionedLogicalHeightReplaced() { // The following is based off of the W3C Working Draft from April 11, 2006 of // CSS 2.1: Section 10.6.5 "Absolutely positioned, replaced elements" @@ -2631,9 +2881,9 @@ void RenderBox::calcAbsoluteVerticalReplaced() * elements. \*-----------------------------------------------------------------------*/ // NOTE: This value of height is FINAL in that the min/max height calculations - // are dealt with in calcReplacedHeight(). This means that the steps to produce + // are dealt with in computeReplacedHeight(). This means that the steps to produce // correct max/min in the non-replaced version, are not necessary. - setHeight(calcReplacedHeight() + borderAndPaddingHeight()); + setHeight(computeReplacedHeight() + borderAndPaddingHeight()); const int availableSpace = containerHeight - height(); /*-----------------------------------------------------------------------*\ @@ -2913,7 +3163,7 @@ bool RenderBox::shrinkToAvoidFloats() const bool RenderBox::avoidsFloats() const { - return isReplaced() || hasOverflowClip() || isHR(); + return isReplaced() || hasOverflowClip() || isHR() || isBlockFlowRoot(); } void RenderBox::addShadowOverflow() diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h index b008c09..445c7bb 100644 --- a/WebCore/rendering/RenderBox.h +++ b/WebCore/rendering/RenderBox.h @@ -29,7 +29,7 @@ namespace WebCore { -enum WidthType { Width, MinWidth, MaxWidth }; +enum LogicalWidthType { LogicalWidth, MinLogicalWidth, MaxLogicalWidth }; class RenderBox : public RenderBoxModelObject { public: @@ -44,12 +44,52 @@ public: int y() const { return m_frameRect.y(); } int width() const { return m_frameRect.width(); } int height() const { return m_frameRect.height(); } - + void setX(int x) { m_frameRect.setX(x); } void setY(int y) { m_frameRect.setY(y); } void setWidth(int width) { m_frameRect.setWidth(width); } void setHeight(int height) { m_frameRect.setHeight(height); } - + + int logicalLeft() const { return style()->isVerticalBlockFlow() ? x() : y(); } + int logicalTop() const { return style()->isVerticalBlockFlow() ? y() : x(); } + int logicalWidth() const { return style()->isVerticalBlockFlow() ? width() : height(); } + int logicalHeight() const { return style()->isVerticalBlockFlow() ? height() : width(); } + void setLogicalLeft(int left) + { + if (style()->isVerticalBlockFlow()) + setX(left); + else + setY(left); + } + void setLogicalTop(int top) + { + if (style()->isVerticalBlockFlow()) + setY(top); + else + setX(top); + } + void setLogicalWidth(int size) + { + if (style()->isVerticalBlockFlow()) + setWidth(size); + else + setHeight(size); + } + void setLogicalHeight(int size) + { + if (style()->isVerticalBlockFlow()) + setHeight(size); + else + setWidth(size); + } + void setLogicalLocation(int left, int top) + { + if (style()->isVerticalBlockFlow()) + setLocation(left, top); + else + setLocation(top, left); + } + IntPoint location() const { return m_frameRect.location(); } IntSize locationOffset() const { return IntSize(x(), y()); } IntSize size() const { return m_frameRect.size(); } @@ -110,6 +150,8 @@ public: int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); } int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); } + int contentLogicalWidth() const { return style()->isVerticalBlockFlow() ? contentWidth() : contentHeight(); } + int contentLogicalHeight() const { return style()->isVerticalBlockFlow() ? contentHeight() : contentWidth(); } // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) // to return the remaining width on a given line (and the height of a single line). @@ -139,18 +181,41 @@ public: virtual int marginBottom() const { return m_marginBottom; } virtual int marginLeft() const { return m_marginLeft; } virtual int marginRight() const { return m_marginRight; } - + virtual int marginBefore() const; + virtual int marginAfter() const; + virtual int marginStart() const; + virtual int marginEnd() const; + void setMarginStart(int); + void setMarginEnd(int); + void setMarginBefore(int); + void setMarginAfter(int); + // The following five functions are used to implement collapsing margins. // All objects know their maximal positive and negative margins. The // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|. // For a non-collapsing box, such as a leaf element, this formula will simply return - // the margin of the element. Blocks override the maxTopMargin and maxBottomMargin + // the margin of the element. Blocks override the maxMarginBefore and maxMarginAfter // methods. + enum MarginSign { PositiveMargin, NegativeMargin }; virtual bool isSelfCollapsingBlock() const { return false; } - int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); } - int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); } - virtual int maxTopMargin(bool positive) const { return positive ? std::max(0, marginTop()) : -std::min(0, marginTop()); } - virtual int maxBottomMargin(bool positive) const { return positive ? std::max(0, marginBottom()) : -std::min(0, marginBottom()); } + int collapsedMarginBefore() const + { + return maxMarginBefore(PositiveMargin) - maxMarginBefore(NegativeMargin); + } + int collapsedMarginAfter() const + { + return maxMarginAfter(PositiveMargin) - maxMarginAfter(NegativeMargin); +} + virtual int maxMarginBefore(MarginSign sign) const + { + int beforeMargin = marginBefore(); + return (sign == PositiveMargin) ? std::max(0, beforeMargin) : -std::min(0, beforeMargin); + } + virtual int maxMarginAfter(MarginSign sign) const + { + int afterMargin = marginAfter(); + return (sign == PositiveMargin) ? std::max(0, afterMargin) : -std::min(0, afterMargin); + } virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); @@ -166,8 +231,8 @@ public: virtual void destroy(); - virtual int minPrefWidth() const; - virtual int maxPrefWidth() const; + virtual int minPreferredLogicalWidth() const; + virtual int maxPreferredLogicalWidth() const; int overrideSize() const; int overrideWidth() const; @@ -176,18 +241,19 @@ public: virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const; - int calcBorderBoxWidth(int width) const; - int calcBorderBoxHeight(int height) const; - int calcContentBoxWidth(int width) const; - int calcContentBoxHeight(int height) const; + int computeBorderBoxLogicalWidth(int width) const; + int computeBorderBoxLogicalHeight(int height) const; + int computeContentBoxLogicalWidth(int width) const; + int computeContentBoxLogicalHeight(int height) const; virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the box in which the border paints if border-fit is set. - // This method is now public so that centered objects like tables that are - // shifted right by left-aligned floats can recompute their left and - // right margins (so that they can remain centered after being - // shifted. -dwh - void calcHorizontalMargins(const Length& marginLeft, const Length& marginRight, int containerWidth); + // Resolve auto margins in the inline direction of the containing block so that objects can be pushed to the start, middle or end + // of the containing block. + void computeInlineDirectionMargins(RenderBlock* containingBlock, int containerWidth, int childWidth); + + // Used to resolve margins in the containing block's block-flow direction. + void computeBlockDirectionMargins(RenderBlock* containingBlock); void positionLineBox(InlineBox*); @@ -210,40 +276,43 @@ public: virtual void repaintDuringLayoutIfMoved(const IntRect&); - virtual int containingBlockWidthForContent() const; - - virtual void calcWidth(); - virtual void calcHeight(); + virtual int containingBlockLogicalWidthForContent() const; + int perpendicularContainingBlockLogicalHeight() const; + + virtual void computeLogicalWidth(); + virtual void computeLogicalHeight(); bool stretchesToViewHeight() const { - return document()->inQuirksMode() && style()->height().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody()); + return document()->inQuirksMode() && style()->height().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody()) && !isBlockFlowRoot(); } virtual IntSize intrinsicSize() const { return IntSize(); } // Whether or not the element shrinks to its intrinsic width (rather than filling the width // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this. - bool sizesToIntrinsicWidth(WidthType) const; - virtual bool stretchesToMinIntrinsicWidth() const { return false; } + bool sizesToIntrinsicLogicalWidth(LogicalWidthType) const; + virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; } - int calcWidthUsing(WidthType, int containerWidth); - int calcHeightUsing(const Length& height); - int calcReplacedWidthUsing(Length width) const; - int calcReplacedHeightUsing(Length height) const; + int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth); + int computeLogicalHeightUsing(const Length& height); + int computeReplacedWidthUsing(Length width) const; + int computeReplacedHeightUsing(Length height) const; - virtual int calcReplacedWidth(bool includeMaxWidth = true) const; - virtual int calcReplacedHeight() const; + virtual int computeReplacedWidth(bool includeMaxWidth = true) const; + virtual int computeReplacedHeight() const; - int calcPercentageHeight(const Length& height); + int computePercentageLogicalHeight(const Length& height); // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.) - virtual int availableWidth() const { return contentWidth(); } // FIXME: Investigate removing eventually. https://bugs.webkit.org/show_bug.cgi?id=46127 - virtual int availableHeight() const; - int availableHeightUsing(const Length&) const; - virtual int availableLogicalWidth() const; - - void calcVerticalMargins(); + virtual int availableLogicalWidth() const { return contentLogicalWidth(); } + int availableLogicalHeight() const; + int availableLogicalHeightUsing(const Length&) const; + + // There are a few cases where we need to refer specifically to the available physical width and available physical height. + // Relative positioning is one of those cases, since left/top offsets are physical. + int availableWidth() const { return style()->isVerticalBlockFlow() ? availableLogicalWidth() : availableLogicalHeight(); } + int availableHeight() const { return style()->isVerticalBlockFlow() ? availableLogicalHeight() : availableLogicalWidth(); } virtual int verticalScrollbarWidth() const; int horizontalScrollbarHeight() const; @@ -278,11 +347,11 @@ public: void tryLayoutDoingPositionedMovementOnly() { int oldWidth = width(); - calcWidth(); + computeLogicalWidth(); // If we shrink to fit our width may have changed, so we still need full layout. if (oldWidth != width()) return; - calcHeight(); + computeLogicalHeight(); setNeedsLayout(false); } @@ -300,9 +369,13 @@ public: virtual void markDescendantBlocksAndLinesForLayout(bool inLayout = true); +<<<<<<< HEAD #ifdef ANDROID_LAYOUT int getVisibleWidth() const { return m_visibleWidth; } #endif +======= + bool isBlockFlowRoot() const { return !parent() || parent()->style()->blockFlow() != style()->blockFlow(); } +>>>>>>> webkit.org at r68651 protected: virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); @@ -319,9 +392,9 @@ protected: void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText); #endif - void calcAbsoluteHorizontal(); + void computePositionedLogicalWidth(); - virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } + virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; @@ -337,23 +410,33 @@ private: int containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const; int containingBlockHeightForPositioned(const RenderBoxModelObject* containingBlock) const; - void calcAbsoluteVertical(); - void calcAbsoluteHorizontalValues(Length width, const RenderBoxModelObject* cb, TextDirection containerDirection, + void computePositionedLogicalHeight(); + void computePositionedLogicalWidthUsing(Length width, const RenderBoxModelObject* cb, TextDirection containerDirection, int containerWidth, int bordersPlusPadding, Length left, Length right, Length marginLeft, Length marginRight, int& widthValue, int& marginLeftValue, int& marginRightValue, int& xPos); - void calcAbsoluteVerticalValues(Length height, const RenderBoxModelObject* cb, + void computePositionedLogicalHeightUsing(Length height, const RenderBoxModelObject* cb, int containerHeight, int bordersPlusPadding, Length top, Length bottom, Length marginTop, Length marginBottom, int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos); - void calcAbsoluteVerticalReplaced(); - void calcAbsoluteHorizontalReplaced(); + void computePositionedLogicalHeightReplaced(); + void computePositionedLogicalWidthReplaced(); // This function calculates the minimum and maximum preferred widths for an object. // These values are used in shrink-to-fit layout systems. // These include tables, positioned objects, floats and flexible boxes. - virtual void calcPrefWidths() { setPrefWidthsDirty(false); } + virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); } + + void setMarginStartUsing(const RenderStyle*, int); + void setMarginEndUsing(const RenderStyle*, int); + void setMarginBeforeUsing(const RenderStyle*, int); + void setMarginAfterUsing(const RenderStyle*, int); + + int marginStartUsing(const RenderStyle*) const; + int marginEndUsing(const RenderStyle*) const; + int marginBeforeUsing(const RenderStyle*) const; + int marginAfterUsing(const RenderStyle*) const; private: // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). @@ -371,11 +454,11 @@ protected: int m_marginTop; int m_marginBottom; - // The preferred width of the element if it were to break its lines at every possible opportunity. - int m_minPrefWidth; + // The preferred logical width of the element if it were to break its lines at every possible opportunity. + int m_minPreferredLogicalWidth; - // The preferred width of the element if it never breaks any lines at all. - int m_maxPrefWidth; + // The preferred logical width of the element if it never breaks any lines at all. + int m_maxPreferredLogicalWidth; // For inline replaced elements, the inline box that owns us. InlineBox* m_inlineBoxWrapper; diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp index f4c2d2a..bbb9c2c 100644 --- a/WebCore/rendering/RenderBoxModelObject.cpp +++ b/WebCore/rendering/RenderBoxModelObject.cpp @@ -320,7 +320,7 @@ int RenderBoxModelObject::relativePositionOffsetX() const { // Objects that shrink to avoid floats normally use available line width when computing containing block width. However // in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the - // available width of the containing block. Therefore we don't use containingBlockWidthForContent() here, but instead explicitly + // available width of the containing block. Therefore we don't use containingBlockLogicalWidthForContent() here, but instead explicitly // call availableWidth on our containing block. if (!style()->left().isAuto()) { RenderBlock* cb = containingBlock(); @@ -505,8 +505,8 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co if (context->paintingDisabled()) return; - bool includeLeftEdge = box ? box->includeLeftEdge() : true; - bool includeRightEdge = box ? box->includeRightEdge() : true; + bool includeLeftEdge = box ? box->includeLogicalLeftEdge() : true; + bool includeRightEdge = box ? box->includeLogicalRightEdge() : true; int bLeft = includeLeftEdge ? borderLeft() : 0; int bRight = includeRightEdge ? borderRight() : 0; int pLeft = includeLeftEdge ? paddingLeft() : 0; @@ -624,6 +624,12 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co // Can't scroll a frameset document anyway. isOpaqueRoot = body->hasLocalName(framesetTag); } +#if ENABLE(SVG) + else { + // SVG documents and XML documents with SVG root nodes are transparent. + isOpaqueRoot = !document()->hasSVGRootNode(); + } +#endif } } else isOpaqueRoot = !view()->frameView()->isTransparent(); @@ -1590,6 +1596,18 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); } +static inline void uniformlyExpandBorderRadii(int delta, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) +{ + topLeft.expand(delta, delta); + topLeft.clampNegativeToZero(); + topRight.expand(delta, delta); + topRight.clampNegativeToZero(); + bottomLeft.expand(delta, delta); + bottomLeft.clampNegativeToZero(); + bottomRight.expand(delta, delta); + bottomRight.clampNegativeToZero(); +} + void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool begin, bool end) { // FIXME: Deal with border-image. Would be great to use border-image as a mask. @@ -1673,37 +1691,15 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int IntSize bottomLeftToClipOut = bottomLeft; IntSize bottomRightToClipOut = bottomRight; - if (shadowSpread < 0) { - topLeft.expand(shadowSpread, shadowSpread); - topLeft.clampNegativeToZero(); - - topRight.expand(shadowSpread, shadowSpread); - topRight.clampNegativeToZero(); - - bottomLeft.expand(shadowSpread, shadowSpread); - bottomLeft.clampNegativeToZero(); - - bottomRight.expand(shadowSpread, shadowSpread); - bottomRight.clampNegativeToZero(); - } + if (shadowSpread < 0) + uniformlyExpandBorderRadii(shadowSpread, topLeft, topRight, bottomLeft, bottomRight); // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time // when painting the shadow. On the other hand, it introduces subpixel gaps along the // corners. Those are avoided by insetting the clipping path by one pixel. if (hasOpaqueBackground) { rectToClipOut.inflate(-1); - - topLeftToClipOut.expand(-1, -1); - topLeftToClipOut.clampNegativeToZero(); - - topRightToClipOut.expand(-1, -1); - topRightToClipOut.clampNegativeToZero(); - - bottomLeftToClipOut.expand(-1, -1); - bottomLeftToClipOut.clampNegativeToZero(); - - bottomRightToClipOut.expand(-1, -1); - bottomRightToClipOut.clampNegativeToZero(); + uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); } if (!rectToClipOut.isEmpty()) @@ -1769,19 +1765,8 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int context->addPath(Path::createRectangle(outerRect)); if (hasBorderRadius) { - if (shadowSpread > 0) { - topLeft.expand(-shadowSpread, -shadowSpread); - topLeft.clampNegativeToZero(); - - topRight.expand(-shadowSpread, -shadowSpread); - topRight.clampNegativeToZero(); - - bottomLeft.expand(-shadowSpread, -shadowSpread); - bottomLeft.clampNegativeToZero(); - - bottomRight.expand(-shadowSpread, -shadowSpread); - bottomRight.clampNegativeToZero(); - } + if (shadowSpread > 0) + uniformlyExpandBorderRadii(-shadowSpread, topLeft, topRight, bottomLeft, bottomRight); context->addPath(Path::createRoundedRectangle(holeRect, topLeft, topRight, bottomLeft, bottomRight)); } else context->addPath(Path::createRectangle(holeRect)); @@ -1796,9 +1781,9 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int } } -int RenderBoxModelObject::containingBlockWidthForContent() const +int RenderBoxModelObject::containingBlockLogicalWidthForContent() const { - return containingBlock()->availableWidth(); + return containingBlock()->availableLogicalWidth(); } } // namespace WebCore diff --git a/WebCore/rendering/RenderBoxModelObject.h b/WebCore/rendering/RenderBoxModelObject.h index e91e799..83c9367 100644 --- a/WebCore/rendering/RenderBoxModelObject.h +++ b/WebCore/rendering/RenderBoxModelObject.h @@ -79,19 +79,29 @@ public: virtual int borderBottom() const { return style()->borderBottomWidth(); } virtual int borderLeft() const { return style()->borderLeftWidth(); } virtual int borderRight() const { return style()->borderRightWidth(); } + virtual int borderBefore() const { return style()->borderBeforeWidth(); } + virtual int borderAfter() const { return style()->borderAfterWidth(); } + virtual int borderStart() const { return style()->borderStartWidth(); } + virtual int borderEnd() const { return style()->borderEndWidth(); } int borderAndPaddingHeight() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); } int borderAndPaddingWidth() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); } + int borderAndPaddingLogicalHeight() const { return borderBefore() + borderAfter() + paddingBefore() + paddingAfter(); } + int borderAndPaddingLogicalWidth() const { return borderStart() + borderEnd() + paddingStart() + paddingEnd(); } virtual int marginTop() const = 0; virtual int marginBottom() const = 0; virtual int marginLeft() const = 0; virtual int marginRight() const = 0; + virtual int marginBefore() const = 0; + virtual int marginAfter() const = 0; + virtual int marginStart() const = 0; + virtual int marginEnd() const = 0; bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; } bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; } - virtual int containingBlockWidthForContent() const; + virtual int containingBlockLogicalWidthForContent() const; virtual void childBecameNonInline(RenderObject* /*child*/) { } diff --git a/WebCore/rendering/RenderCounter.cpp b/WebCore/rendering/RenderCounter.cpp index 6e678e8..639221d 100644 --- a/WebCore/rendering/RenderCounter.cpp +++ b/WebCore/rendering/RenderCounter.cpp @@ -328,10 +328,10 @@ PassRefPtr<StringImpl> RenderCounter::originalText() const return text.impl(); } -void RenderCounter::calcPrefWidths(int lead) +void RenderCounter::computePreferredLogicalWidths(int lead) { setTextInternal(originalText()); - RenderText::calcPrefWidths(lead); + RenderText::computePreferredLogicalWidths(lead); } void RenderCounter::invalidate(const AtomicString& identifier) diff --git a/WebCore/rendering/RenderCounter.h b/WebCore/rendering/RenderCounter.h index 10ba1dc..8d981df 100644 --- a/WebCore/rendering/RenderCounter.h +++ b/WebCore/rendering/RenderCounter.h @@ -49,7 +49,7 @@ private: virtual bool isCounter() const; virtual PassRefPtr<StringImpl> originalText() const; - virtual void calcPrefWidths(int leadWidth); + virtual void computePreferredLogicalWidths(int leadWidth); CounterContent m_counter; mutable CounterNode* m_counterNode; diff --git a/WebCore/rendering/RenderDataGrid.cpp b/WebCore/rendering/RenderDataGrid.cpp index 63a21cd..c322389 100644 --- a/WebCore/rendering/RenderDataGrid.cpp +++ b/WebCore/rendering/RenderDataGrid.cpp @@ -88,34 +88,34 @@ RenderStyle* RenderDataGrid::headerStyle(DataGridColumn* column) return column->headerStyle(); } -void RenderDataGrid::calcPrefWidths() +void RenderDataGrid::computePreferredLogicalWidths() { - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else - m_maxPrefWidth = calcContentBoxWidth(cDefaultWidth); + m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(cDefaultWidth); if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderDataGrid::layout() diff --git a/WebCore/rendering/RenderDataGrid.h b/WebCore/rendering/RenderDataGrid.h index c4b54df..1492d26 100644 --- a/WebCore/rendering/RenderDataGrid.h +++ b/WebCore/rendering/RenderDataGrid.h @@ -44,7 +44,7 @@ public: virtual const char* renderName() const { return "RenderDataGrid"; } virtual bool canHaveChildren() const { return false; } - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void layout(); virtual void paintObject(PaintInfo&, int tx, int ty); diff --git a/WebCore/rendering/RenderEmbeddedObject.cpp b/WebCore/rendering/RenderEmbeddedObject.cpp index 4179af3..aa301e2 100644 --- a/WebCore/rendering/RenderEmbeddedObject.cpp +++ b/WebCore/rendering/RenderEmbeddedObject.cpp @@ -215,8 +215,8 @@ void RenderEmbeddedObject::layout() { ASSERT(needsLayout()); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); RenderPart::layout(); diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp index bd245c7..d3b88c1 100644 --- a/WebCore/rendering/RenderFieldset.cpp +++ b/WebCore/rendering/RenderFieldset.cpp @@ -44,11 +44,11 @@ RenderFieldset::RenderFieldset(Node* element) { } -void RenderFieldset::calcPrefWidths() +void RenderFieldset::computePreferredLogicalWidths() { - RenderBlock::calcPrefWidths(); + RenderBlock::computePreferredLogicalWidths(); if (RenderBox* legend = findLegend()) { - int legendMinWidth = legend->minPrefWidth(); + int legendMinWidth = legend->minPreferredLogicalWidth(); Length legendMarginLeft = legend->style()->marginLeft(); Length legendMarginRight = legend->style()->marginLeft(); @@ -59,7 +59,7 @@ void RenderFieldset::calcPrefWidths() if (legendMarginRight.isFixed()) legendMinWidth += legendMarginRight.value(); - m_minPrefWidth = max(m_minPrefWidth, legendMinWidth + borderAndPaddingWidth()); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, legendMinWidth + borderAndPaddingWidth()); } } diff --git a/WebCore/rendering/RenderFieldset.h b/WebCore/rendering/RenderFieldset.h index df6a1da..bc8e8ae 100644 --- a/WebCore/rendering/RenderFieldset.h +++ b/WebCore/rendering/RenderFieldset.h @@ -40,9 +40,9 @@ private: virtual RenderObject* layoutLegend(bool relayoutChildren); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual bool avoidsFloats() const { return true; } - virtual bool stretchesToMinIntrinsicWidth() const { return true; } + virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; } virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp index 20ebe4d..cdb0470 100644 --- a/WebCore/rendering/RenderFileUploadControl.cpp +++ b/WebCore/rendering/RenderFileUploadControl.cpp @@ -257,41 +257,41 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty) paintInfo.context->restore(); } -void RenderFileUploadControl::calcPrefWidths() +void RenderFileUploadControl::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else { // Figure out how big the filename space needs to be for a given number of characters // (using "0" as the nominal character). const UChar ch = '0'; float charWidth = style()->font().floatWidth(TextRun(&ch, 1, false, 0, 0, false, false, false)); - m_maxPrefWidth = (int)ceilf(charWidth * defaultWidthNumChars); + m_maxPreferredLogicalWidth = (int)ceilf(charWidth * defaultWidthNumChars); } if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderFileUploadControl::receiveDroppedFiles(const Vector<String>& paths) diff --git a/WebCore/rendering/RenderFileUploadControl.h b/WebCore/rendering/RenderFileUploadControl.h index 205ba47..c96800c 100644 --- a/WebCore/rendering/RenderFileUploadControl.h +++ b/WebCore/rendering/RenderFileUploadControl.h @@ -51,7 +51,7 @@ private: virtual const char* renderName() const { return "RenderFileUploadControl"; } virtual void updateFromElement(); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void paintObject(PaintInfo&, int tx, int ty); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp index 659df8d..636c873 100644 --- a/WebCore/rendering/RenderFlexibleBox.cpp +++ b/WebCore/rendering/RenderFlexibleBox.cpp @@ -137,8 +137,8 @@ void RenderFlexibleBox::calcHorizontalPrefWidths() marginRight += mr.value(); margin = marginLeft + marginRight; - m_minPrefWidth += child->minPrefWidth() + margin; - m_maxPrefWidth += child->maxPrefWidth() + margin; + m_minPreferredLogicalWidth += child->minPreferredLogicalWidth() + margin; + m_maxPreferredLogicalWidth += child->maxPreferredLogicalWidth() + margin; } } @@ -160,39 +160,39 @@ void RenderFlexibleBox::calcVerticalPrefWidths() if (mr.isFixed()) margin += mr.value(); - int w = child->minPrefWidth() + margin; - m_minPrefWidth = max(w, m_minPrefWidth); + int w = child->minPreferredLogicalWidth() + margin; + m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth); - w = child->maxPrefWidth() + margin; - m_maxPrefWidth = max(w, m_maxPrefWidth); + w = child->maxPreferredLogicalWidth() + margin; + m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth); } } -void RenderFlexibleBox::calcPrefWidths() +void RenderFlexibleBox::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else { - m_minPrefWidth = m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0; if (hasMultipleLines() || isVertical()) calcVerticalPrefWidths(); else calcHorizontalPrefWidths(); - m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth); + m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); } if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); @@ -200,10 +200,10 @@ void RenderFlexibleBox::calcPrefWidths() if (hasOverflowClip() && style()->overflowY() == OSCROLL) toAdd += verticalScrollbarWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXME: Implement */) @@ -219,8 +219,8 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM int previousWidth = width(); int previousHeight = height(); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); m_overflow.clear(); @@ -251,7 +251,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM else layoutVerticalBox(relayoutChildren); - calcHeight(); + computeLogicalHeight(); if (previousHeight != height()) relayoutChildren = true; @@ -266,14 +266,14 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM // bottom margin max values to 0. This way we don't factor in the values // twice when we collapse with our previous vertically adjacent and // following vertically adjacent blocks. - int pos = maxTopPosMargin(); - int neg = maxTopNegMargin(); - if (maxBottomPosMargin() > pos) - pos = maxBottomPosMargin(); - if (maxBottomNegMargin() > neg) - neg = maxBottomNegMargin(); - setMaxTopMargins(pos, neg); - setMaxBottomMargins(0, 0); + int pos = maxPosMarginBefore(); + int neg = maxNegMarginBefore(); + if (maxPosMarginAfter() > pos) + pos = maxPosMarginAfter(); + if (maxNegMarginAfter() > neg) + neg = maxNegMarginAfter(); + setMaxMarginBeforeValues(pos, neg); + setMaxMarginAfterValues(0, 0); } // Add in the overflow from children. @@ -372,7 +372,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren) } // Compute the child's vertical margins. - child->calcVerticalMargins(); + child->computeBlockDirectionMargins(this); if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight) { RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0; @@ -412,7 +412,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren) setHeight(height() + toAdd); oldHeight = height(); - calcHeight(); + computeLogicalHeight(); relayoutChildren = false; if (oldHeight != height()) @@ -444,7 +444,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren) // fill the height of a containing box by default. // Now do a layout. int oldChildHeight = child->height(); - child->calcHeight(); + child->computeLogicalHeight(); if (oldChildHeight != child->height()) child->setChildNeedsLayout(true, false); @@ -643,7 +643,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren) } } - // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of + // So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of // a height change, we revert our height back to the intrinsic height before returning. if (heightSpecified) setHeight(oldHeight); @@ -713,7 +713,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren) } // Compute the child's vertical margins. - child->calcVerticalMargins(); + child->computeBlockDirectionMargins(this); // Add in the child's marginTop to our height. setHeight(height() + child->marginTop()); @@ -769,7 +769,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren) // Now we have to calc our height, so we know how much space we have remaining. oldHeight = height(); - calcHeight(); + computeLogicalHeight(); if (oldHeight != height()) heightSpecified = true; @@ -925,7 +925,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren) } } - // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of + // So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of // a height change, we revert our height back to the intrinsic height before returning. if (heightSpecified) setHeight(oldHeight); @@ -1001,7 +1001,7 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC int totalWidth; InlineBox* anchorBox = lastLine->lastChild(); if (anchorBox && anchorBox->renderer()->node() && anchorBox->renderer()->node()->isLink()) - totalWidth = anchorBox->width() + font.width(TextRun(ellipsisAndSpace, 2)); + totalWidth = anchorBox->logicalWidth() + font.width(TextRun(ellipsisAndSpace, 2)); else { anchorBox = 0; totalWidth = font.width(TextRun(&horizontalEllipsis, 1)); @@ -1018,12 +1018,12 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC continue; int ltr = true; - int blockRightEdge = destBlock->rightOffset(lastVisibleLine->y(), false); - int blockLeftEdge = destBlock->leftOffset(lastVisibleLine->y(), false); + int blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false); + int blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false); int blockEdge = ltr ? blockRightEdge : blockLeftEdge; if (!lastVisibleLine->canAccommodateEllipsis(ltr, blockEdge, - lastVisibleLine->x() + lastVisibleLine->width(), + lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) continue; @@ -1062,9 +1062,9 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign child->style()->maxWidth().isFixed()) maxW = child->style()->maxWidth().value(); else if (child->style()->maxWidth().type() == Intrinsic) - maxW = child->maxPrefWidth(); + maxW = child->maxPreferredLogicalWidth(); else if (child->style()->maxWidth().type() == MinIntrinsic) - maxW = child->minPrefWidth(); + maxW = child->minPreferredLogicalWidth(); if (maxW == INT_MAX) return maxW; return max(0, maxW - w); @@ -1083,14 +1083,14 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign // FIXME: For now just handle fixed values. if (isHorizontal()) { - int minW = child->minPrefWidth(); + int minW = child->minPreferredLogicalWidth(); int w = child->overrideWidth() - child->borderAndPaddingWidth(); if (child->style()->minWidth().isFixed()) minW = child->style()->minWidth().value(); else if (child->style()->minWidth().type() == Intrinsic) - minW = child->maxPrefWidth(); + minW = child->maxPreferredLogicalWidth(); else if (child->style()->minWidth().type() == MinIntrinsic) - minW = child->minPrefWidth(); + minW = child->minPreferredLogicalWidth(); int allowedShrinkage = min(0, minW - w); return allowedShrinkage; diff --git a/WebCore/rendering/RenderFlexibleBox.h b/WebCore/rendering/RenderFlexibleBox.h index 2aa20b5..8525c29 100644 --- a/WebCore/rendering/RenderFlexibleBox.h +++ b/WebCore/rendering/RenderFlexibleBox.h @@ -36,7 +36,7 @@ public: virtual const char* renderName() const; - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); void calcHorizontalPrefWidths(); void calcVerticalPrefWidths(); diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp index bfcb940..839e963 100644 --- a/WebCore/rendering/RenderForeignObject.cpp +++ b/WebCore/rendering/RenderForeignObject.cpp @@ -82,13 +82,13 @@ const AffineTransform& RenderForeignObject::localToParentTransform() const return m_localToParentTransform; } -void RenderForeignObject::calcWidth() +void RenderForeignObject::computeLogicalWidth() { // FIXME: Investigate in size rounding issues setWidth(static_cast<int>(roundf(m_viewport.width()))); } -void RenderForeignObject::calcHeight() +void RenderForeignObject::computeLogicalHeight() { // FIXME: Investigate in size rounding issues setHeight(static_cast<int>(roundf(m_viewport.height()))); @@ -99,7 +99,7 @@ void RenderForeignObject::layout() ASSERT(needsLayout()); ASSERT(!view()->layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree. - LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout()); + LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); SVGForeignObjectElement* foreign = static_cast<SVGForeignObjectElement*>(node()); bool updateCachedBoundariesInParents = false; diff --git a/WebCore/rendering/RenderForeignObject.h b/WebCore/rendering/RenderForeignObject.h index d8c1f68..87423e6 100644 --- a/WebCore/rendering/RenderForeignObject.h +++ b/WebCore/rendering/RenderForeignObject.h @@ -57,8 +57,8 @@ public: virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } private: - virtual void calcWidth(); - virtual void calcHeight(); + virtual void computeLogicalWidth(); + virtual void computeLogicalHeight(); virtual const AffineTransform& localToParentTransform() const; virtual AffineTransform localTransform() const { return m_localTransform; } diff --git a/WebCore/rendering/RenderFrameBase.cpp b/WebCore/rendering/RenderFrameBase.cpp index 4a62f8a..b36ad3a 100644 --- a/WebCore/rendering/RenderFrameBase.cpp +++ b/WebCore/rendering/RenderFrameBase.cpp @@ -53,8 +53,8 @@ void RenderFrameBase::layoutWithFlattening(bool fixedWidth, bool fixedHeight) // need to update to calculate min/max correctly updateWidgetPosition(); - if (childRoot->prefWidthsDirty()) - childRoot->calcPrefWidths(); + if (childRoot->preferredLogicalWidthsDirty()) + childRoot->computePreferredLogicalWidths(); // if scrollbars are off, and the width or height are fixed // we obey them and do not expand. With frame flattening @@ -69,7 +69,7 @@ void RenderFrameBase::layoutWithFlattening(bool fixedWidth, bool fixedHeight) // make sure minimum preferred width is enforced if (isScrollable || !fixedWidth) { - setWidth(max(width(), childRoot->minPrefWidth() + hBorder)); + setWidth(max(width(), childRoot->minPreferredLogicalWidth() + hBorder)); // update again to pass the new width to the child frame updateWidgetPosition(); childFrameView->layout(); diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp index c89495b..68bb536 100644 --- a/WebCore/rendering/RenderHTMLCanvas.cpp +++ b/WebCore/rendering/RenderHTMLCanvas.cpp @@ -73,12 +73,12 @@ void RenderHTMLCanvas::canvasSizeChanged() if (!parent()) return; - if (!prefWidthsDirty()) - setPrefWidthsDirty(true); + if (!preferredLogicalWidthsDirty()) + setPreferredLogicalWidthsDirty(true); IntSize oldSize = size(); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); if (oldSize == size()) return; diff --git a/WebCore/rendering/RenderIFrame.cpp b/WebCore/rendering/RenderIFrame.cpp index 8421c9e..cbe4c70 100644 --- a/WebCore/rendering/RenderIFrame.cpp +++ b/WebCore/rendering/RenderIFrame.cpp @@ -41,8 +41,9 @@ RenderIFrame::RenderIFrame(Element* element) { } -void RenderIFrame::calcHeight() +void RenderIFrame::computeLogicalHeight() { +<<<<<<< HEAD RenderPart::calcHeight(); #ifdef ANDROID_FLATTEN_IFRAME if (!node()->hasTagName(iframeTag) || !widget() || !widget()->isFrameView()) @@ -68,6 +69,9 @@ void RenderIFrame::calcHeight() updateWidgetPosition(); return; #endif +======= + RenderPart::computeLogicalHeight(); +>>>>>>> webkit.org at r68651 if (!flattenFrame()) return; @@ -83,8 +87,9 @@ void RenderIFrame::calcHeight() } } -void RenderIFrame::calcWidth() +void RenderIFrame::computeLogicalWidth() { +<<<<<<< HEAD RenderPart::calcWidth(); #ifdef ANDROID_FLATTEN_IFRAME if (!node()->hasTagName(iframeTag) || !widget() || !widget()->isFrameView()) @@ -117,6 +122,9 @@ void RenderIFrame::calcWidth() updateWidgetPosition(); return; #endif +======= + RenderPart::computeLogicalWidth(); +>>>>>>> webkit.org at r68651 if (!flattenFrame()) return; @@ -162,8 +170,8 @@ void RenderIFrame::layout() { ASSERT(needsLayout()); - RenderPart::calcWidth(); - RenderPart::calcHeight(); + RenderPart::computeLogicalWidth(); + RenderPart::computeLogicalHeight(); #ifdef ANDROID_FLATTEN_IFRAME // Calculate the styled dimensions by subtracting the border and padding. diff --git a/WebCore/rendering/RenderIFrame.h b/WebCore/rendering/RenderIFrame.h index ab659a4..325e2b3 100644 --- a/WebCore/rendering/RenderIFrame.h +++ b/WebCore/rendering/RenderIFrame.h @@ -39,8 +39,8 @@ public: #endif private: - virtual void calcHeight(); - virtual void calcWidth(); + virtual void computeLogicalHeight(); + virtual void computeLogicalWidth(); virtual void layout(); diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index d5d52f6..dd01861 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -155,10 +155,10 @@ void RenderImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect) // lets see if we need to relayout at all.. int oldwidth = width(); int oldheight = height(); - if (!prefWidthsDirty()) - setPrefWidthsDirty(true); - calcWidth(); - calcHeight(); + if (!preferredLogicalWidthsDirty()) + setPreferredLogicalWidthsDirty(true); + computeLogicalWidth(); + computeLogicalHeight(); if (imageSizeChanged || width() != oldwidth || height() != oldheight) { shouldRepaint = false; @@ -369,7 +369,7 @@ HTMLMapElement* RenderImage::imageMap() const bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) { - HitTestResult tempResult(result.point(), result.padding()); + HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding()); bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction); if (tempResult.innerNode() && node()) { @@ -439,7 +439,7 @@ bool RenderImage::isHeightSpecified() const return false; } -int RenderImage::calcReplacedWidth(bool includeMaxWidth) const +int RenderImage::computeReplacedWidth(bool includeMaxWidth) const { if (m_imageResource->imageHasRelativeWidth()) if (RenderObject* cb = isPositioned() ? container() : containingBlock()) { @@ -449,7 +449,7 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const int width; if (isWidthSpecified()) - width = calcReplacedWidthUsing(style()->width()); + width = computeReplacedWidthUsing(style()->width()); else if (m_imageResource->usesImageContainerSize()) width = m_imageResource->imageSize(style()->effectiveZoom()).width(); else if (m_imageResource->imageHasRelativeWidth()) @@ -457,8 +457,8 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const else width = calcAspectRatioWidth(); - int minW = calcReplacedWidthUsing(style()->minWidth()); - int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth()); + int minW = computeReplacedWidthUsing(style()->minWidth()); + int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth()); #ifdef ANDROID_LAYOUT width = max(minW, min(width, maxW)); @@ -474,11 +474,11 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const #endif } -int RenderImage::calcReplacedHeight() const +int RenderImage::computeReplacedHeight() const { int height; if (isHeightSpecified()) - height = calcReplacedHeightUsing(style()->height()); + height = computeReplacedHeightUsing(style()->height()); else if (m_imageResource->usesImageContainerSize()) height = m_imageResource->imageSize(style()->effectiveZoom()).height(); else if (m_imageResource->imageHasRelativeHeight()) @@ -486,8 +486,8 @@ int RenderImage::calcReplacedHeight() const else height = calcAspectRatioHeight(); - int minH = calcReplacedHeightUsing(style()->minHeight()); - int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight()); + int minH = computeReplacedHeightUsing(style()->minHeight()); + int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight()); #ifdef ANDROID_LAYOUT height = max(minH, min(height, maxH)); @@ -520,7 +520,7 @@ int RenderImage::calcAspectRatioWidth() const return 0; if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) return size.width(); // Don't bother scaling. - return RenderBox::calcReplacedHeight() * size.width() / size.height(); + return RenderBox::computeReplacedHeight() * size.width() / size.height(); } int RenderImage::calcAspectRatioHeight() const @@ -530,7 +530,7 @@ int RenderImage::calcAspectRatioHeight() const return 0; if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) return size.height(); // Don't bother scaling. - return RenderBox::calcReplacedWidth() * size.height() / size.width(); + return RenderBox::computeReplacedWidth() * size.height() / size.width(); } } // namespace WebCore diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h index f9acba8..022d792 100644 --- a/WebCore/rendering/RenderImage.h +++ b/WebCore/rendering/RenderImage.h @@ -61,7 +61,11 @@ protected: bool isWidthSpecified() const; bool isHeightSpecified() const; - virtual void intrinsicSizeChanged() { imageChanged(m_imageResource->imagePtr()); } + virtual void intrinsicSizeChanged() + { + if (m_imageResource) + imageChanged(m_imageResource->imagePtr()); + } private: virtual const char* renderName() const { return "RenderImage"; } @@ -76,8 +80,8 @@ private: virtual void notifyFinished(CachedResource*); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); - virtual int calcReplacedWidth(bool includeMaxWidth = true) const; - virtual int calcReplacedHeight() const; + virtual int computeReplacedWidth(bool includeMaxWidth = true) const; + virtual int computeReplacedHeight() const; int calcAspectRatioWidth() const; int calcAspectRatioHeight() const; diff --git a/WebCore/rendering/RenderIndicator.cpp b/WebCore/rendering/RenderIndicator.cpp index 32ef916..cd7be36 100644 --- a/WebCore/rendering/RenderIndicator.cpp +++ b/WebCore/rendering/RenderIndicator.cpp @@ -44,8 +44,8 @@ void RenderIndicator::layout() ASSERT(needsLayout()); LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); layoutParts(); repainter.repaintAfterLayout(); setNeedsLayout(false); diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp index c985b92..b4bfe2f 100644 --- a/WebCore/rendering/RenderInline.cpp +++ b/WebCore/rendering/RenderInline.cpp @@ -413,7 +413,7 @@ void RenderInline::absoluteRects(Vector<IntRect>& rects, int tx, int ty) { if (InlineFlowBox* curr = firstLineBox()) { for (; curr; curr = curr->nextLineBox()) - rects.append(IntRect(tx + curr->x(), ty + curr->y(), curr->width(), curr->height())); + rects.append(IntRect(tx + curr->x(), ty + curr->y(), curr->logicalWidth(), curr->logicalHeight())); } else rects.append(IntRect(tx, ty, 0, 0)); @@ -432,7 +432,7 @@ void RenderInline::absoluteQuads(Vector<FloatQuad>& quads) { if (InlineFlowBox* curr = firstLineBox()) { for (; curr; curr = curr->nextLineBox()) { - FloatRect localRect(curr->x(), curr->y(), curr->width(), curr->height()); + FloatRect localRect(curr->x(), curr->y(), curr->logicalWidth(), curr->logicalHeight()); quads.append(localToAbsoluteQuad(localRect)); } } else @@ -458,28 +458,53 @@ int RenderInline::offsetTop() const return y; } -int RenderInline::marginLeft() const +static int computeMargin(const RenderInline* renderer, const Length& margin) { - Length margin = style()->marginLeft(); if (margin.isAuto()) return 0; if (margin.isFixed()) return margin.value(); if (margin.isPercent()) - return margin.calcMinValue(max(0, containingBlock()->availableWidth())); + return margin.calcMinValue(max(0, renderer->containingBlock()->availableLogicalWidth())); return 0; } +int RenderInline::marginLeft() const +{ + if (!style()->isVerticalBlockFlow()) + return 0; + return computeMargin(this, style()->marginLeft()); +} + int RenderInline::marginRight() const { - Length margin = style()->marginRight(); - if (margin.isAuto()) + if (!style()->isVerticalBlockFlow()) return 0; - if (margin.isFixed()) - return margin.value(); - if (margin.isPercent()) - return margin.calcMinValue(max(0, containingBlock()->availableWidth())); - return 0; + return computeMargin(this, style()->marginRight()); +} + +int RenderInline::marginTop() const +{ + if (style()->isVerticalBlockFlow()) + return 0; + return computeMargin(this, style()->marginTop()); +} + +int RenderInline::marginBottom() const +{ + if (style()->isVerticalBlockFlow()) + return 0; + return computeMargin(this, style()->marginBottom()); +} + +int RenderInline::marginStart() const +{ + return computeMargin(this, style()->marginStart()); +} + +int RenderInline::marginEnd() const +{ + return computeMargin(this, style()->marginEnd()); } const char* RenderInline::renderName() const @@ -538,12 +563,12 @@ IntRect RenderInline::linesBoundingBox() const for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { if (curr == firstLineBox() || curr->x() < leftSide) leftSide = curr->x(); - if (curr == firstLineBox() || curr->x() + curr->width() > rightSide) - rightSide = curr->x() + curr->width(); + if (curr == firstLineBox() || curr->x() + curr->logicalWidth() > rightSide) + rightSide = curr->x() + curr->logicalWidth(); } result.setWidth(rightSide - leftSide); result.setX(leftSide); - result.setHeight(lastLineBox()->y() + lastLineBox()->height() - firstLineBox()->y()); + result.setHeight(lastLineBox()->y() + lastLineBox()->logicalHeight() - firstLineBox()->y()); result.setY(firstLineBox()->y()); } @@ -931,8 +956,8 @@ void RenderInline::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { RootInlineBox* root = curr->root(); int top = max(root->lineTop(), curr->y()); - int bottom = min(root->lineBottom(), curr->y() + curr->height()); - IntRect rect(tx + curr->x(), ty + top, curr->width(), bottom - top); + int bottom = min(root->lineBottom(), curr->y() + curr->logicalHeight()); + IntRect rect(tx + curr->x(), ty + top, curr->logicalWidth(), bottom - top); if (!rect.isEmpty()) rects.append(rect); } @@ -988,8 +1013,8 @@ void RenderInline::paintOutline(GraphicsContext* graphicsContext, int tx, int ty for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { RootInlineBox* root = curr->root(); int top = max(root->lineTop(), curr->y()); - int bottom = min(root->lineBottom(), curr->y() + curr->height()); - rects.append(IntRect(curr->x(), top, curr->width(), bottom - top)); + int bottom = min(root->lineBottom(), curr->y() + curr->logicalHeight()); + rects.append(IntRect(curr->x(), top, curr->logicalWidth(), bottom - top)); } rects.append(IntRect()); diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h index 71a8a89..feb8b8f 100644 --- a/WebCore/rendering/RenderInline.h +++ b/WebCore/rendering/RenderInline.h @@ -40,7 +40,13 @@ public: virtual int marginLeft() const; virtual int marginRight() const; - + virtual int marginTop() const; + virtual int marginBottom() const; + virtual int marginBefore() const { return 0; } + virtual int marginAfter() const { return 0; } + virtual int marginStart() const; + virtual int marginEnd() const; + virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); @@ -108,9 +114,6 @@ private: virtual int offsetWidth() const { return linesBoundingBox().width(); } virtual int offsetHeight() const { return linesBoundingBox().height(); } - // Just ignore top/bottom margins on RenderInlines. - virtual int marginTop() const { return 0; } - virtual int marginBottom() const { return 0; } virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth); virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed); diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index da6fad1..63233e5 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -468,6 +468,28 @@ TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio return *m_transform; } +static bool checkContainingBlockChainForPagination(RenderBoxModelObject* renderer, RenderBox* ancestorColumnsRenderer) +{ + RenderView* view = renderer->view(); + RenderBoxModelObject* prevBlock = renderer; + RenderBlock* containingBlock; + for (containingBlock = renderer->containingBlock(); + containingBlock && containingBlock != view && containingBlock != ancestorColumnsRenderer; + containingBlock = containingBlock->containingBlock()) + prevBlock = containingBlock; + + // If the columns block wasn't in our containing block chain, then we aren't paginated by it. + if (containingBlock != ancestorColumnsRenderer) + return false; + + // If the previous block is absolutely positioned, then we can't be paginated by the columns block. + if (prevBlock->isPositioned()) + return false; + + // Otherwise we are paginated by the columns block. + return true; +} + void RenderLayer::updatePagination() { m_isPaginated = false; @@ -484,10 +506,10 @@ void RenderLayer::updatePagination() RenderLayer* ancestorStackingContext = stackingContext(); for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { if (curr->renderer()->hasColumns()) { - m_isPaginated = true; + m_isPaginated = checkContainingBlockChainForPagination(renderer(), curr->renderBox()); return; } - if (curr == ancestorStackingContext || (curr->parent() && curr->parent()->renderer()->isPositioned())) + if (curr == ancestorStackingContext) return; } } @@ -2912,7 +2934,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. if (fgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. - HitTestResult tempResult(result.point(), result.padding()); + HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding()); if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestDescendants) && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { if (result.isRectBasedTest()) @@ -2941,7 +2963,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont return candidateLayer; if (bgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { - HitTestResult tempResult(result.point(), result.padding()); + HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding()); if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { if (result.isRectBasedTest()) @@ -2998,7 +3020,7 @@ RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* r for (int i = list->size() - 1; i >= 0; --i) { RenderLayer* childLayer = list->at(i); RenderLayer* hitLayer = 0; - HitTestResult tempResult(result.point(), result.padding()); + HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding()); if (childLayer->isPaginated()) hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestPoint, transformState, zOffsetForDescendants); else diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index dbd61e1..68086ca 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -1209,6 +1209,16 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim return runningAcceleratedAnimation; } +void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName) +{ + m_graphicsLayer->pauseAnimation(animationName, timeOffset); +} + +void RenderLayerBacking::animationFinished(const String& animationName) +{ + m_graphicsLayer->removeAnimation(animationName); +} + bool RenderLayerBacking::startTransition(double timeOffset, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle) { bool didAnimate = false; @@ -1221,7 +1231,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, int property, const opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity()))); opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity()))); // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here. - if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, String(), timeOffset)) { + if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) { // To ensure that the correct opacity is visible when the animation ends, also set the final opacity. updateLayerOpacity(toStyle); didAnimate = true; @@ -1235,7 +1245,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, int property, const KeyframeValueList transformVector(AnimatedPropertyWebkitTransform); transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform())); transformVector.insert(new TransformAnimationValue(1, &toStyle->transform())); - if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, String(), timeOffset)) { + if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) { // To ensure that the correct transform is visible when the animation ends, also set the final opacity. updateLayerTransform(toStyle); didAnimate = true; @@ -1249,34 +1259,32 @@ bool RenderLayerBacking::startTransition(double timeOffset, int property, const return didAnimate; } -void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time) -{ - renderer()->animation()->notifyAnimationStarted(renderer(), time); -} - -void RenderLayerBacking::notifySyncRequired(const GraphicsLayer*) +void RenderLayerBacking::transitionPaused(double timeOffset, int property) { - if (!renderer()->documentBeingDestroyed()) - compositor()->scheduleSync(); + AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property); + if (animatedProperty != AnimatedPropertyInvalid) + m_graphicsLayer->pauseAnimation(GraphicsLayer::animationNameForTransition(animatedProperty), timeOffset); } -void RenderLayerBacking::animationFinished(const String& animationName) +void RenderLayerBacking::transitionFinished(int property) { - m_graphicsLayer->removeAnimationsForKeyframes(animationName); + AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property); + if (animatedProperty != AnimatedPropertyInvalid) + m_graphicsLayer->removeAnimation(GraphicsLayer::animationNameForTransition(animatedProperty)); } -void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName) +void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time) { - m_graphicsLayer->pauseAnimation(animationName, timeOffset); + renderer()->animation()->notifyAnimationStarted(renderer(), time); } -void RenderLayerBacking::transitionFinished(int property) +void RenderLayerBacking::notifySyncRequired(const GraphicsLayer*) { - AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property); - if (animatedProperty != AnimatedPropertyInvalid) - m_graphicsLayer->removeAnimationsForProperty(animatedProperty); + if (!renderer()->documentBeingDestroyed()) + compositor()->scheduleSync(); } +// This is used for the 'freeze' API, for testing only. void RenderLayerBacking::suspendAnimations(double time) { m_graphicsLayer->suspendAnimations(time); diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index 808000b..fb3ab67 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -105,12 +105,14 @@ public: void rendererContentChanged(); // Interface to start, finish, suspend and resume animations and transitions - bool startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes); bool startTransition(double timeOffset, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle); - void animationFinished(const String& name); - void animationPaused(double timeOffset, const String& name); + void transitionPaused(double timeOffset, int property); void transitionFinished(int property); + bool startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes); + void animationPaused(double timeOffset, const String& name); + void animationFinished(const String& name); + void suspendAnimations(double time = 0); void resumeAnimations(); diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp index 45e66eb..760d2ea 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -246,16 +246,16 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq // contain the point. This is a quick short-circuit that we can take to avoid walking any lines. // FIXME: This check is flawed in the following extremely obscure way: // if some line in the middle has a huge overflow, it might actually extend below the last line. - if (y - result.paddingHeight() >= ty + lastLineBox()->root()->bottomVisibleOverflow() - || y + result.paddingHeight() < ty + firstLineBox()->root()->topVisibleOverflow()) + if (y - result.topPadding() >= ty + lastLineBox()->root()->bottomVisibleOverflow() + || y + result.bottomPadding() < ty + firstLineBox()->root()->topVisibleOverflow()) return false; // See if our root lines contain the point. If so, then we hit test // them further. Note that boxes can easily overlap, so we can't make any assumptions // based off positions of our first line box or our last line box. for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) { - if (y + result.paddingHeight() >= ty + curr->root()->topVisibleOverflow() - && y - result.paddingHeight() < ty + curr->root()->bottomVisibleOverflow()) { + if (y + result.bottomPadding() >= ty + curr->root()->topVisibleOverflow() + && y - result.topPadding() < ty + curr->root()->bottomVisibleOverflow()) { bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty); if (inside) { renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty)); diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp index aa31b6c..39442e1 100644 --- a/WebCore/rendering/RenderListBox.cpp +++ b/WebCore/rendering/RenderListBox.cpp @@ -160,39 +160,39 @@ void RenderListBox::scrollToRevealSelection() scrollToRevealElementAtListIndex(firstIndex); } -void RenderListBox::calcPrefWidths() +void RenderListBox::computePreferredLogicalWidths() { ASSERT(!m_optionsChanged); - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else { - m_maxPrefWidth = m_optionsWidth + 2 * optionsSpacingHorizontal; + m_maxPreferredLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal; if (m_vBar) - m_maxPrefWidth += m_vBar->width(); + m_maxPreferredLogicalWidth += m_vBar->width(); } if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } int RenderListBox::size() const @@ -219,14 +219,14 @@ int RenderListBox::listHeight() const return itemHeight() * numItems() - rowSpacing; } -void RenderListBox::calcHeight() +void RenderListBox::computeLogicalHeight() { int toAdd = borderAndPaddingHeight(); int itemHeight = RenderListBox::itemHeight(); setHeight(itemHeight * size() - rowSpacing + toAdd); - RenderBlock::calcHeight(); + RenderBlock::computeLogicalHeight(); if (m_vBar) { bool enabled = numVisibleItems() < numItems(); diff --git a/WebCore/rendering/RenderListBox.h b/WebCore/rendering/RenderListBox.h index dcee739..c69f205 100644 --- a/WebCore/rendering/RenderListBox.h +++ b/WebCore/rendering/RenderListBox.h @@ -70,9 +70,9 @@ private: virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual int baselinePosition(bool firstLine, bool isRootLineBox) const; - virtual void calcHeight(); + virtual void computeLogicalHeight(); virtual void layout(); diff --git a/WebCore/rendering/RenderListItem.cpp b/WebCore/rendering/RenderListItem.cpp index 2366a34..b414f38 100644 --- a/WebCore/rendering/RenderListItem.cpp +++ b/WebCore/rendering/RenderListItem.cpp @@ -210,7 +210,7 @@ void RenderListItem::updateMarkerLocation() lineBoxParent = this; } - if (markerPar != lineBoxParent || m_marker->prefWidthsDirty()) { + if (markerPar != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) { // Removing and adding the marker can trigger repainting in // containers other than ourselves, so we need to disable LayoutState. view()->disableLayoutState(); @@ -219,20 +219,20 @@ void RenderListItem::updateMarkerLocation() if (!lineBoxParent) lineBoxParent = this; lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent)); - if (m_marker->prefWidthsDirty()) - m_marker->calcPrefWidths(); + if (m_marker->preferredLogicalWidthsDirty()) + m_marker->computePreferredLogicalWidths(); view()->enableLayoutState(); } } } -void RenderListItem::calcPrefWidths() +void RenderListItem::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); updateMarkerLocation(); - RenderBlock::calcPrefWidths(); + RenderBlock::computePreferredLogicalWidths(); } void RenderListItem::layout() @@ -245,7 +245,7 @@ void RenderListItem::layout() void RenderListItem::positionListMarker() { - if (m_marker && !m_marker->isInside() && m_marker->inlineBoxWrapper()) { + if (m_marker && m_marker->parent()->isBox() && !m_marker->isInside() && m_marker->inlineBoxWrapper()) { int markerOldX = m_marker->x(); int yOffset = 0; int xOffset = 0; @@ -262,23 +262,23 @@ void RenderListItem::positionListMarker() // and really shouldn't keep propagating overflow up. This won't really break anything other than repainting // not being as tight as it could be though. if (style()->direction() == LTR) { - int leftLineOffset = leftRelOffset(yOffset, leftOffset(yOffset, false), false); + int leftLineOffset = logicalLeftOffsetForLine(yOffset, logicalLeftOffsetForLine(yOffset, false), false); markerXPos = leftLineOffset - xOffset - paddingLeft() - borderLeft() + m_marker->marginLeft(); m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0); for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) { if (markerXPos < box->leftLayoutOverflow()) { - box->setHorizontalOverflowPositions(markerXPos, box->rightLayoutOverflow(), box->leftVisualOverflow(), box->rightVisualOverflow()); + box->setInlineDirectionOverflowPositions(markerXPos, box->rightLayoutOverflow(), box->leftVisualOverflow(), box->rightVisualOverflow()); if (box == root) adjustOverflow = true; } } } else { - int rightLineOffset = rightRelOffset(yOffset, rightOffset(yOffset, false), false); + int rightLineOffset = logicalRightOffsetForLine(yOffset, logicalRightOffsetForLine(yOffset, false), false); markerXPos = rightLineOffset - xOffset + paddingRight() + borderRight() + m_marker->marginLeft(); m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0); for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) { if (markerXPos + m_marker->width() > box->rightLayoutOverflow()) { - box->setHorizontalOverflowPositions(box->leftLayoutOverflow(), markerXPos + m_marker->width(), box->leftVisualOverflow(), box->rightVisualOverflow()); + box->setInlineDirectionOverflowPositions(box->leftLayoutOverflow(), markerXPos + m_marker->width(), box->leftVisualOverflow(), box->rightVisualOverflow()); if (box == root) adjustOverflow = true; } @@ -314,6 +314,29 @@ const String& RenderListItem::markerText() const return staticNullString; } +String RenderListItem::markerTextWithSuffix() const +{ + if (!m_marker) + return String(); + + // Append the suffix for the marker in the right place depending + // on the direction of the text (right-to-left or left-to-right). + + const String& markerText = m_marker->text(); + const String markerSuffix = m_marker->suffix(); + Vector<UChar> resultVector; + + if (m_marker->style()->direction() == RTL) + resultVector.append(markerSuffix.characters(), markerSuffix.length()); + + resultVector.append(markerText.characters(), markerText.length()); + + if (m_marker->style()->direction() == LTR) + resultVector.append(markerSuffix.characters(), markerSuffix.length()); + + return String::adopt(resultVector); +} + void RenderListItem::explicitValueChanged() { if (m_marker) diff --git a/WebCore/rendering/RenderListItem.h b/WebCore/rendering/RenderListItem.h index 13d81f2..f7bd661 100644 --- a/WebCore/rendering/RenderListItem.h +++ b/WebCore/rendering/RenderListItem.h @@ -45,6 +45,7 @@ public: bool notInList() const { return m_notInList; } const String& markerText() const; + String markerTextWithSuffix() const; void updateListMarkerNumbers(); @@ -59,7 +60,7 @@ private: virtual void paint(PaintInfo&, int tx, int ty); virtual void layout(); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void positionListMarker(); diff --git a/WebCore/rendering/RenderListMarker.cpp b/WebCore/rendering/RenderListMarker.cpp index 7b33c3d..18811df 100644 --- a/WebCore/rendering/RenderListMarker.cpp +++ b/WebCore/rendering/RenderListMarker.cpp @@ -1274,13 +1274,12 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty) void RenderListMarker::layout() { ASSERT(needsLayout()); - ASSERT(!prefWidthsDirty()); - + if (isImage()) { setWidth(m_image->imageSize(this, style()->effectiveZoom()).width()); setHeight(m_image->imageSize(this, style()->effectiveZoom()).height()); } else { - setWidth(minPrefWidth()); + setWidth(minPreferredLogicalWidth()); setHeight(style()->font().height()); } @@ -1308,9 +1307,9 @@ void RenderListMarker::imageChanged(WrappedImagePtr o, const IntRect*) repaint(); } -void RenderListMarker::calcPrefWidths() +void RenderListMarker::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); m_text = ""; @@ -1321,8 +1320,8 @@ void RenderListMarker::calcPrefWidths() // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box. int bulletWidth = font.ascent() / 2; m_image->setImageContainerSize(IntSize(bulletWidth, bulletWidth)); - m_minPrefWidth = m_maxPrefWidth = m_image->imageSize(this, style()->effectiveZoom()).width(); - setPrefWidthsDirty(false); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = m_image->imageSize(this, style()->effectiveZoom()).width(); + setPreferredLogicalWidthsDirty(false); updateMargins(); return; } @@ -1428,10 +1427,10 @@ void RenderListMarker::calcPrefWidths() break; } - m_minPrefWidth = width; - m_maxPrefWidth = width; + m_minPreferredLogicalWidth = width; + m_maxPreferredLogicalWidth = width; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); updateMargins(); } @@ -1455,9 +1454,9 @@ void RenderListMarker::updateMargins() case Square: if (style()->direction() == LTR) { marginLeft = -1; - marginRight = font.ascent() - minPrefWidth() + 1; + marginRight = font.ascent() - minPreferredLogicalWidth() + 1; } else { - marginLeft = font.ascent() - minPrefWidth() + 1; + marginLeft = font.ascent() - minPreferredLogicalWidth() + 1; marginRight = -1; } break; @@ -1467,7 +1466,7 @@ void RenderListMarker::updateMargins() } else { if (style()->direction() == LTR) { if (isImage()) - marginLeft = -minPrefWidth() - cMarkerPadding; + marginLeft = -minPreferredLogicalWidth() - cMarkerPadding; else { int offset = font.ascent() * 2 / 3; switch (style()->listStyleType()) { @@ -1479,7 +1478,7 @@ void RenderListMarker::updateMargins() case NoneListStyle: break; default: - marginLeft = m_text.isEmpty() ? 0 : -minPrefWidth() - offset / 2; + marginLeft = m_text.isEmpty() ? 0 : -minPreferredLogicalWidth() - offset / 2; } } } else { @@ -1491,7 +1490,7 @@ void RenderListMarker::updateMargins() case Disc: case Circle: case Square: - marginLeft = offset + cMarkerPadding + 1 - minPrefWidth(); + marginLeft = offset + cMarkerPadding + 1 - minPreferredLogicalWidth(); break; case NoneListStyle: break; @@ -1500,7 +1499,7 @@ void RenderListMarker::updateMargins() } } } - marginRight = -marginLeft - minPrefWidth(); + marginRight = -marginLeft - minPreferredLogicalWidth(); } style()->setMarginLeft(Length(marginLeft, Fixed)); @@ -1523,6 +1522,25 @@ int RenderListMarker::baselinePosition(bool, bool) const return height(); } +String RenderListMarker::suffix() const +{ + EListStyleType type = style()->listStyleType(); + const UChar suffix = listMarkerSuffix(type, m_listItem->value()); + + Vector<UChar> resultVector; + resultVector.append(suffix); + + // If the suffix is not ' ', an extra space is needed + if (suffix != ' ') { + if (style()->direction() == LTR) + resultVector.append(' '); + else + resultVector.prepend(' '); + } + + return String::adopt(resultVector); +} + bool RenderListMarker::isInside() const { return m_listItem->notInList() || style()->listStylePosition() == INSIDE; diff --git a/WebCore/rendering/RenderListMarker.h b/WebCore/rendering/RenderListMarker.h index 971877b..1e55898 100644 --- a/WebCore/rendering/RenderListMarker.h +++ b/WebCore/rendering/RenderListMarker.h @@ -38,9 +38,10 @@ public: RenderListMarker(RenderListItem*); virtual ~RenderListMarker(); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); const String& text() const { return m_text; } + String suffix() const; bool isInside() const; diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp index b6a97a9..a88903f 100644 --- a/WebCore/rendering/RenderMenuList.cpp +++ b/WebCore/rendering/RenderMenuList.cpp @@ -239,34 +239,34 @@ IntRect RenderMenuList::controlClipRect(int tx, int ty) const return intersection(outerBox, innerBox); } -void RenderMenuList::calcPrefWidths() +void RenderMenuList::computePreferredLogicalWidths() { - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else - m_maxPrefWidth = max(m_optionsWidth, theme()->minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); + m_maxPreferredLogicalWidth = max(m_optionsWidth, theme()->minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderMenuList::showPopup() diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h index 512fa9b..7faa372 100644 --- a/WebCore/rendering/RenderMenuList.h +++ b/WebCore/rendering/RenderMenuList.h @@ -74,7 +74,7 @@ private: virtual const char* renderName() const { return "RenderMenuList"; } - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); diff --git a/WebCore/rendering/RenderMeter.cpp b/WebCore/rendering/RenderMeter.cpp index 1a99976..226d605 100644 --- a/WebCore/rendering/RenderMeter.cpp +++ b/WebCore/rendering/RenderMeter.cpp @@ -48,15 +48,15 @@ RenderMeter::~RenderMeter() m_barPart->detach(); } -void RenderMeter::calcWidth() +void RenderMeter::computeLogicalWidth() { - RenderBox::calcWidth(); + RenderBox::computeLogicalWidth(); setWidth(theme()->meterSizeForBounds(this, frameRect()).width()); } -void RenderMeter::calcHeight() +void RenderMeter::computeLogicalHeight() { - RenderBox::calcHeight(); + RenderBox::computeLogicalHeight(); setHeight(theme()->meterSizeForBounds(this, frameRect()).height()); } diff --git a/WebCore/rendering/RenderMeter.h b/WebCore/rendering/RenderMeter.h index 0e73e40..6d4c53b 100644 --- a/WebCore/rendering/RenderMeter.h +++ b/WebCore/rendering/RenderMeter.h @@ -40,8 +40,8 @@ public: private: virtual const char* renderName() const { return "RenderMeter"; } virtual bool isMeter() const { return true; } - virtual void calcWidth(); - virtual void calcHeight(); + virtual void computeLogicalWidth(); + virtual void computeLogicalHeight(); virtual void layoutParts(); virtual bool shouldHaveParts() const; diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index 9ee97b4..eb75ce2 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -193,7 +193,7 @@ RenderObject::RenderObject(Node* node) , m_needsPositionedMovementLayout(false) , m_normalChildNeedsLayout(false) , m_posChildNeedsLayout(false) - , m_prefWidthsDirty(false) + , m_preferredLogicalWidthsDirty(false) , m_floating(false) , m_positioned(false) , m_relPositioned(false) @@ -212,8 +212,8 @@ RenderObject::RenderObject(Node* node) , m_hasCounterNodeMap(false) , m_everHadLayout(false) , m_childrenInline(false) - , m_topMarginQuirk(false) - , m_bottomMarginQuirk(false) + , m_marginBeforeQuirk(false) + , m_marginAfterQuirk(false) , m_hasMarkupTruncation(false) , m_selectionState(SelectionNone) , m_hasColumns(false) @@ -576,27 +576,27 @@ RenderBlock* RenderObject::firstLineBlock() const return 0; } -void RenderObject::setPrefWidthsDirty(bool b, bool markParents) +void RenderObject::setPreferredLogicalWidthsDirty(bool b, bool markParents) { - bool alreadyDirty = m_prefWidthsDirty; - m_prefWidthsDirty = b; + bool alreadyDirty = m_preferredLogicalWidthsDirty; + m_preferredLogicalWidthsDirty = b; if (b && !alreadyDirty && markParents && (isText() || (style()->position() != FixedPosition && style()->position() != AbsolutePosition))) - invalidateContainerPrefWidths(); + invalidateContainerPreferredLogicalWidths(); } -void RenderObject::invalidateContainerPrefWidths() +void RenderObject::invalidateContainerPreferredLogicalWidths() { // In order to avoid pathological behavior when inlines are deeply nested, we do include them // in the chain that we mark dirty (even though they're kind of irrelevant). RenderObject* o = isTableCell() ? containingBlock() : container(); - while (o && !o->m_prefWidthsDirty) { + while (o && !o->m_preferredLogicalWidthsDirty) { // Don't invalidate the outermost object of an unrooted subtree. That object will be // invalidated when the subtree is added to the document. RenderObject* container = o->isTableCell() ? o->containingBlock() : o->container(); if (!container && !o->isRenderView()) break; - o->m_prefWidthsDirty = true; + o->m_preferredLogicalWidthsDirty = true; if (o->style()->position() == FixedPosition || o->style()->position() == AbsolutePosition) // A positioned object has no effect on the min/max width of its containing block ever. // We can optimize this case and not go up any further. @@ -1994,7 +1994,7 @@ void RenderObject::getTransformFromContainer(const RenderObject* containerObject if (containerObject && containerObject->hasLayer() && containerObject->style()->hasPerspective()) { // Perpsective on the container affects us, so we have to factor it in here. ASSERT(containerObject->hasLayer()); - FloatPoint perspectiveOrigin = toRenderBox(containerObject)->layer()->perspectiveOrigin(); + FloatPoint perspectiveOrigin = toRenderBoxModelObject(containerObject)->layer()->perspectiveOrigin(); TransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(containerObject->style()->perspective()); @@ -2098,8 +2098,8 @@ RenderObject* RenderObject::container(RenderBoxModelObject* repaintContainer, bo // (2) For normal flow elements, it just returns the parent. // (3) For absolute positioned elements, it will return a relative positioned inline. // containingBlock() simply skips relpositioned inlines and lets an enclosing block handle - // the layout of the positioned object. This does mean that calcAbsoluteHorizontal and - // calcAbsoluteVertical have to use container(). + // the layout of the positioned object. This does mean that computePositionedLogicalWidth and + // computePositionedLogicalHeight have to use container(). RenderObject* o = parent(); if (isText()) @@ -2345,7 +2345,7 @@ RenderStyle* RenderObject::firstLineStyleSlowCase() const RenderStyle* parentStyle = renderer->parent()->firstLineStyle(); if (parentStyle != renderer->parent()->style()) { // A first-line style is in effect. Cache a first-line style for ourselves. - style->setHasPseudoStyle(FIRST_LINE_INHERITED); + renderer->style()->setHasPseudoStyle(FIRST_LINE_INHERITED); style = renderer->getCachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle); } } diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index f2ca471..70b0da5 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -394,7 +394,7 @@ public: bool posChildNeedsLayout() const { return m_posChildNeedsLayout; } bool normalChildNeedsLayout() const { return m_normalChildNeedsLayout; } - bool prefWidthsDirty() const { return m_prefWidthsDirty; } + bool preferredLogicalWidthsDirty() const { return m_preferredLogicalWidthsDirty; } bool isSelectionBorder() const; @@ -455,13 +455,13 @@ public: void setNeedsLayout(bool b, bool markParents = true); void setChildNeedsLayout(bool b, bool markParents = true); void setNeedsPositionedMovementLayout(); - void setPrefWidthsDirty(bool, bool markParents = true); - void invalidateContainerPrefWidths(); + void setPreferredLogicalWidthsDirty(bool, bool markParents = true); + void invalidateContainerPreferredLogicalWidths(); void setNeedsLayoutAndPrefWidthsRecalc() { setNeedsLayout(true); - setPrefWidthsDirty(true); + setPreferredLogicalWidthsDirty(true); } void setPositioned(bool b = true) { m_positioned = b; } @@ -561,8 +561,8 @@ public: // the rect that will be painted if this object is passed as the paintingRoot IntRect paintingRootRect(IntRect& topLevelRect); - virtual int minPrefWidth() const { return 0; } - virtual int maxPrefWidth() const { return 0; } + virtual int minPreferredLogicalWidth() const { return 0; } + virtual int maxPreferredLogicalWidth() const { return 0; } RenderStyle* style() const { return m_style.get(); } RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); } @@ -688,11 +688,10 @@ public: */ virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); - virtual void calcVerticalMargins() { } - bool isTopMarginQuirk() const { return m_topMarginQuirk; } - bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; } - void setTopMarginQuirk(bool b = true) { m_topMarginQuirk = b; } - void setBottomMarginQuirk(bool b = true) { m_bottomMarginQuirk = b; } + bool isMarginBeforeQuirk() const { return m_marginBeforeQuirk; } + bool isMarginAfterQuirk() const { return m_marginAfterQuirk; } + void setMarginBeforeQuirk(bool b = true) { m_marginBeforeQuirk = b; } + void setMarginAfterQuirk(bool b = true) { m_marginAfterQuirk = b; } // When performing a global document tear-down, the renderer of the document is cleared. We use this // as a hook to detect the case of document destruction and don't waste time doing unnecessary work. @@ -812,7 +811,7 @@ private: bool m_needsPositionedMovementLayout :1; bool m_normalChildNeedsLayout : 1; bool m_posChildNeedsLayout : 1; - bool m_prefWidthsDirty : 1; + bool m_preferredLogicalWidthsDirty : 1; bool m_floating : 1; bool m_positioned : 1; @@ -842,8 +841,8 @@ private: // These bitfields are moved here from subclasses to pack them together // from RenderBlock bool m_childrenInline : 1; - bool m_topMarginQuirk : 1; - bool m_bottomMarginQuirk : 1; + bool m_marginBeforeQuirk : 1; + bool m_marginAfterQuirk : 1; bool m_hasMarkupTruncation : 1; unsigned m_selectionState : 3; // SelectionState bool m_hasColumns : 1; diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp index 0f31df1..cbe1900 100644 --- a/WebCore/rendering/RenderPath.cpp +++ b/WebCore/rendering/RenderPath.cpp @@ -98,7 +98,7 @@ bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) void RenderPath::layout() { - LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout()); + LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout()); SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node()); bool updateCachedBoundariesInParents = false; diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp index b54a228..d3b449c 100644 --- a/WebCore/rendering/RenderReplaced.cpp +++ b/WebCore/rendering/RenderReplaced.cpp @@ -57,6 +57,13 @@ RenderReplaced::~RenderReplaced() { } +void RenderReplaced::setStyle(PassRefPtr<RenderStyle> newStyle) +{ + if (newStyle->blockFlow() != TopToBottomBlockFlow) + newStyle->setBlockFlow(TopToBottomBlockFlow); + RenderBox::setStyle(newStyle); +} + void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderBox::styleDidChange(diff, oldStyle); @@ -75,8 +82,8 @@ void RenderReplaced::layout() setHeight(minimumReplacedHeight()); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); m_overflow.clear(); addShadowOverflow(); @@ -200,34 +207,34 @@ static inline bool lengthIsSpecified(Length length) return lengthType == Fixed || lengthType == Percent; } -int RenderReplaced::calcReplacedWidth(bool includeMaxWidth) const +int RenderReplaced::computeReplacedWidth(bool includeMaxWidth) const { int width; if (lengthIsSpecified(style()->width())) - width = calcReplacedWidthUsing(style()->width()); + width = computeReplacedWidthUsing(style()->width()); else if (m_hasIntrinsicSize) width = calcAspectRatioWidth(); else width = intrinsicSize().width(); - int minW = calcReplacedWidthUsing(style()->minWidth()); - int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth()); + int minW = computeReplacedWidthUsing(style()->minWidth()); + int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth()); return max(minW, min(width, maxW)); } -int RenderReplaced::calcReplacedHeight() const +int RenderReplaced::computeReplacedHeight() const { int height; if (lengthIsSpecified(style()->height())) - height = calcReplacedHeightUsing(style()->height()); + height = computeReplacedHeightUsing(style()->height()); else if (m_hasIntrinsicSize) height = calcAspectRatioHeight(); else height = intrinsicSize().height(); - int minH = calcReplacedHeightUsing(style()->minHeight()); - int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight()); + int minH = computeReplacedHeightUsing(style()->minHeight()); + int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight()); return max(minH, min(height, maxH)); } @@ -238,7 +245,7 @@ int RenderReplaced::calcAspectRatioWidth() const int intrinsicHeight = intrinsicSize().height(); if (!intrinsicHeight) return 0; - return RenderBox::calcReplacedHeight() * intrinsicWidth / intrinsicHeight; + return RenderBox::computeReplacedHeight() * intrinsicWidth / intrinsicHeight; } int RenderReplaced::calcAspectRatioHeight() const @@ -247,27 +254,27 @@ int RenderReplaced::calcAspectRatioHeight() const int intrinsicHeight = intrinsicSize().height(); if (!intrinsicWidth) return 0; - return RenderBox::calcReplacedWidth() * intrinsicHeight / intrinsicWidth; + return RenderBox::computeReplacedWidth() * intrinsicHeight / intrinsicWidth; } -void RenderReplaced::calcPrefWidths() +void RenderReplaced::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); int borderAndPadding = borderAndPaddingWidth(); - m_maxPrefWidth = calcReplacedWidth(false) + borderAndPadding; + m_maxPreferredLogicalWidth = computeReplacedWidth(false) + borderAndPadding; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) - m_maxPrefWidth = min(m_maxPrefWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); if (style()->width().isPercent() || style()->height().isPercent() || style()->maxWidth().isPercent() || style()->maxHeight().isPercent() || style()->minWidth().isPercent() || style()->minHeight().isPercent()) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } int RenderReplaced::lineHeight(bool, bool) const diff --git a/WebCore/rendering/RenderReplaced.h b/WebCore/rendering/RenderReplaced.h index 8a0543c..872f6d0 100644 --- a/WebCore/rendering/RenderReplaced.h +++ b/WebCore/rendering/RenderReplaced.h @@ -32,13 +32,15 @@ public: RenderReplaced(Node*, const IntSize& intrinsicSize); virtual ~RenderReplaced(); + virtual void setStyle(PassRefPtr<RenderStyle>); + protected: virtual void layout(); virtual IntSize intrinsicSize() const; - virtual int calcReplacedWidth(bool includeMaxWidth = true) const; - virtual int calcReplacedHeight() const; + virtual int computeReplacedWidth(bool includeMaxWidth = true) const; + virtual int computeReplacedHeight() const; virtual int minimumReplacedHeight() const { return 0; } virtual void setSelectionState(SelectionState); @@ -63,7 +65,7 @@ private: virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const; virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const; - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); int calcAspectRatioWidth() const; int calcAspectRatioHeight() const; diff --git a/WebCore/rendering/RenderReplica.cpp b/WebCore/rendering/RenderReplica.cpp index 1d589ae..4b11f40 100644 --- a/WebCore/rendering/RenderReplica.cpp +++ b/WebCore/rendering/RenderReplica.cpp @@ -52,11 +52,11 @@ void RenderReplica::layout() setNeedsLayout(false); } -void RenderReplica::calcPrefWidths() +void RenderReplica::computePreferredLogicalWidths() { - m_minPrefWidth = parentBox()->width(); - m_maxPrefWidth = m_minPrefWidth; - setPrefWidthsDirty(false); + m_minPreferredLogicalWidth = parentBox()->width(); + m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth; + setPreferredLogicalWidthsDirty(false); } void RenderReplica::paint(PaintInfo& paintInfo, int tx, int ty) diff --git a/WebCore/rendering/RenderReplica.h b/WebCore/rendering/RenderReplica.h index 48c64e4..a7b03f6 100644 --- a/WebCore/rendering/RenderReplica.h +++ b/WebCore/rendering/RenderReplica.h @@ -43,7 +43,7 @@ public: virtual bool requiresLayer() const { return true; } virtual void layout(); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void paint(PaintInfo&, int tx, int ty); diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp index 8c99270..b5974ca 100644 --- a/WebCore/rendering/RenderSVGContainer.cpp +++ b/WebCore/rendering/RenderSVGContainer.cpp @@ -53,7 +53,7 @@ void RenderSVGContainer::layout() // Allow RenderSVGViewportContainer to update its viewport. calcViewport(); - LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout()); + LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint()); // Allow RenderSVGTransformableContainer to update its transform. bool updatedTransform = calculateLocalTransform(); diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index 0056fa3..a89a738 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -62,7 +62,7 @@ void RenderSVGImage::layout() { ASSERT(needsLayout()); - LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout()); + LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); SVGImageElement* image = static_cast<SVGImageElement*>(node()); bool updateCachedBoundariesInParents = false; diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp index bc6bc12..5d12a61 100644 --- a/WebCore/rendering/RenderSVGInline.cpp +++ b/WebCore/rendering/RenderSVGInline.cpp @@ -39,7 +39,7 @@ RenderSVGInline::RenderSVGInline(Node* n) InlineFlowBox* RenderSVGInline::createInlineFlowBox() { InlineFlowBox* box = new (renderArena()) SVGInlineFlowBox(this); - box->setHasVirtualHeight(); + box->setHasVirtualLogicalHeight(); return box; } @@ -90,7 +90,7 @@ void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads) FloatRect textBoundingBox = object->strokeBoundingBox(); for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) - quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->width(), box->height()))); + quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()))); } void RenderSVGInline::destroy() diff --git a/WebCore/rendering/RenderSVGInlineText.cpp b/WebCore/rendering/RenderSVGInlineText.cpp index 0539d27..f5ea5fc 100644 --- a/WebCore/rendering/RenderSVGInlineText.cpp +++ b/WebCore/rendering/RenderSVGInlineText.cpp @@ -56,7 +56,7 @@ void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle InlineTextBox* RenderSVGInlineText::createTextBox() { InlineTextBox* box = new (renderArena()) SVGInlineTextBox(this); - box->setHasVirtualHeight(); + box->setHasVirtualLogicalHeight(); return box; } diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index 698033e..4dccad6 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -93,7 +93,6 @@ PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() // Add effects to the builder RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(); - builder->clearEffects(); for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) { if (!node->isSVGElement()) continue; @@ -108,6 +107,7 @@ PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() builder->clearEffects(); return 0; } + builder->appendEffectToEffectReferences(effect); effectElement->setStandardAttributes(primitiveBoundingBoxMode, effect.get()); builder->add(effectElement->result(), effect); } diff --git a/WebCore/rendering/RenderSVGResourceFilterPrimitive.h b/WebCore/rendering/RenderSVGResourceFilterPrimitive.h index 96e2c5e..4b23737 100644 --- a/WebCore/rendering/RenderSVGResourceFilterPrimitive.h +++ b/WebCore/rendering/RenderSVGResourceFilterPrimitive.h @@ -36,10 +36,11 @@ namespace WebCore { class RenderSVGResourceFilterPrimitive : public RenderSVGHiddenContainer { public: - RenderSVGResourceFilterPrimitive(SVGFilterPrimitiveStandardAttributes* filterPrimitiveElement); + RenderSVGResourceFilterPrimitive(SVGFilterPrimitiveStandardAttributes* filterPrimitiveElement); private: - virtual bool isSVGResourceFilterPrimitive() const { return true; } + virtual const char* renderName() const { return "RenderSVGResourceFilterPrimitive"; } + virtual bool isSVGResourceFilterPrimitive() const { return true; } }; } // namespace WebCore diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 4e23c42..82b10d5 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -63,28 +63,28 @@ int RenderSVGRoot::baselinePosition(bool, bool) const return height() + marginTop() + marginBottom(); } -void RenderSVGRoot::calcPrefWidths() +void RenderSVGRoot::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); int borderAndPadding = borderAndPaddingWidth(); - int width = calcReplacedWidth(false) + borderAndPadding; + int width = computeReplacedWidth(false) + borderAndPadding; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) { - m_minPrefWidth = 0; - m_maxPrefWidth = width; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = width; } else - m_minPrefWidth = m_maxPrefWidth = width; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } -int RenderSVGRoot::calcReplacedWidth(bool includeMaxWidth) const +int RenderSVGRoot::computeReplacedWidth(bool includeMaxWidth) const { - int replacedWidth = RenderBox::calcReplacedWidth(includeMaxWidth); + int replacedWidth = RenderBox::computeReplacedWidth(includeMaxWidth); if (!style()->width().isPercent()) return replacedWidth; @@ -93,9 +93,9 @@ int RenderSVGRoot::calcReplacedWidth(bool includeMaxWidth) const return static_cast<int>(roundf(replacedWidth * svg->currentScale())); } -int RenderSVGRoot::calcReplacedHeight() const +int RenderSVGRoot::computeReplacedHeight() const { - int replacedHeight = RenderBox::calcReplacedHeight(); + int replacedHeight = RenderBox::computeReplacedHeight(); if (!style()->height().isPercent()) return replacedHeight; @@ -112,11 +112,11 @@ void RenderSVGRoot::layout() view()->disableLayoutState(); bool needsLayout = selfNeedsLayout(); - LayoutRepainter repainter(*this, needsLayout && m_everHadLayout && checkForRepaintDuringLayout()); + LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout); IntSize oldSize(width(), height()); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); calcViewport(); SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h index 63a7b3f..3c29b87 100644 --- a/WebCore/rendering/RenderSVGRoot.h +++ b/WebCore/rendering/RenderSVGRoot.h @@ -53,9 +53,9 @@ private: virtual int lineHeight(bool b, bool isRootLineBox = false) const; virtual int baselinePosition(bool b, bool isRootLineBox = false) const; - virtual void calcPrefWidths(); - virtual int calcReplacedWidth(bool includeMaxWidth = true) const; - virtual int calcReplacedHeight() const; + virtual void computePreferredLogicalWidths(); + virtual int computeReplacedWidth(bool includeMaxWidth = true) const; + virtual int computeReplacedHeight() const; virtual void layout(); virtual void paint(PaintInfo&, int parentX, int parentY); diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index c20a509..92091af 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -74,7 +74,7 @@ void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, void RenderSVGText::layout() { ASSERT(needsLayout()); - LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout()); + LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); bool updateCachedBoundariesInParents = false; if (m_needsTransformUpdate) { @@ -124,7 +124,7 @@ void RenderSVGText::layout() RootInlineBox* RenderSVGText::createRootInlineBox() { RootInlineBox* box = new (renderArena()) SVGRootInlineBox(this); - box->setHasVirtualHeight(); + box->setHasVirtualLogicalHeight(); return box; } diff --git a/WebCore/rendering/RenderScrollbarPart.cpp b/WebCore/rendering/RenderScrollbarPart.cpp index ea61e24..16cc204 100644 --- a/WebCore/rendering/RenderScrollbarPart.cpp +++ b/WebCore/rendering/RenderScrollbarPart.cpp @@ -114,14 +114,14 @@ void RenderScrollbarPart::computeScrollbarHeight() m_marginBottom = style()->marginBottom().calcMinValue(visibleSize); } -void RenderScrollbarPart::calcPrefWidths() +void RenderScrollbarPart::computePreferredLogicalWidths() { - if (!prefWidthsDirty()) + if (!preferredLogicalWidthsDirty()) return; - m_minPrefWidth = m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderScrollbarPart::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) diff --git a/WebCore/rendering/RenderScrollbarPart.h b/WebCore/rendering/RenderScrollbarPart.h index 114bbff..24485d0 100644 --- a/WebCore/rendering/RenderScrollbarPart.h +++ b/WebCore/rendering/RenderScrollbarPart.h @@ -43,7 +43,7 @@ public: virtual bool requiresLayer() const { return false; } virtual void layout(); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); void paintIntoRect(GraphicsContext*, int tx, int ty, const IntRect&); diff --git a/WebCore/rendering/RenderSlider.cpp b/WebCore/rendering/RenderSlider.cpp index 39ac2e5..33df244 100644 --- a/WebCore/rendering/RenderSlider.cpp +++ b/WebCore/rendering/RenderSlider.cpp @@ -164,34 +164,34 @@ int RenderSlider::baselinePosition(bool, bool) const return height() + marginTop(); } -void RenderSlider::calcPrefWidths() +void RenderSlider::computePreferredLogicalWidths() { - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else - m_maxPrefWidth = defaultTrackLength * style()->effectiveZoom(); + m_maxPreferredLogicalWidth = defaultTrackLength * style()->effectiveZoom(); if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderSlider::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) @@ -278,8 +278,8 @@ void RenderSlider::layout() IntSize oldSize = size(); setSize(baseSize); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); if (thumb) { if (oldSize != size()) diff --git a/WebCore/rendering/RenderSlider.h b/WebCore/rendering/RenderSlider.h index fc8ce24..d214e41 100644 --- a/WebCore/rendering/RenderSlider.h +++ b/WebCore/rendering/RenderSlider.h @@ -43,7 +43,7 @@ namespace WebCore { virtual bool isSlider() const { return true; } virtual int baselinePosition(bool, bool) const; - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void layout(); virtual void updateFromElement(); diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 931cf45..c2835d6 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -200,7 +200,7 @@ void RenderTable::removeChild(RenderObject* oldChild) setNeedsSectionRecalc(); } -void RenderTable::calcWidth() +void RenderTable::computeLogicalWidth() { #ifdef ANDROID_LAYOUT if (view()->frameView()) @@ -208,20 +208,20 @@ void RenderTable::calcWidth() #endif if (isPositioned()) - calcAbsoluteHorizontal(); + computePositionedLogicalWidth(); RenderBlock* cb = containingBlock(); - int availableWidth = cb->availableWidth(); + int availableWidth = cb->availableLogicalWidth(); LengthType widthType = style()->width().type(); if (widthType > Relative && style()->width().isPositive()) { // Percent or fixed table setWidth(style()->width().calcMinValue(availableWidth)); - setWidth(max(minPrefWidth(), width())); + setWidth(max(minPreferredLogicalWidth(), width())); } else { // An auto width table should shrink to fit within the line width if necessary in order to // avoid overlapping floats. - availableWidth = cb->lineWidth(y(), false); + availableWidth = cb->availableLogicalWidthForLine(y(), false); // Subtract out any fixed margins from our available width for auto width tables. int marginTotal = 0; @@ -234,20 +234,24 @@ void RenderTable::calcWidth() int availContentWidth = max(0, availableWidth - marginTotal); // Ensure we aren't bigger than our max width or smaller than our min width. - setWidth(min(availContentWidth, maxPrefWidth())); + setWidth(min(availContentWidth, maxPreferredLogicalWidth())); } - setWidth(max(width(), minPrefWidth())); + setWidth(max(width(), minPreferredLogicalWidth())); // Finally, with our true width determined, compute our margins for real. m_marginRight = 0; m_marginLeft = 0; +<<<<<<< HEAD #ifdef ANDROID_LAYOUT // in SSR mode, we ignore left/right margin for table if (document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) return; #endif calcHorizontalMargins(style()->marginLeft(), style()->marginRight(), availableWidth); +======= + computeInlineDirectionMargins(cb, availableWidth, width()); +>>>>>>> webkit.org at r68651 } void RenderTable::layout() @@ -272,7 +276,7 @@ void RenderTable::layout() #endif int oldWidth = width(); - calcWidth(); + computeLogicalWidth(); #ifdef ANDROID_LAYOUT if (!checkAndSetRelayoutChildren(&relayoutChildren) @@ -377,7 +381,7 @@ void RenderTable::layout() setHeight(height() + bpTop); if (!isPositioned()) - calcHeight(); + computeLogicalHeight(); Length h = style()->height(); int th = 0; @@ -385,7 +389,7 @@ void RenderTable::layout() // Tables size as though CSS height includes border/padding. th = h.value() - (bpTop + bpBottom); else if (h.isPercent()) - th = calcPercentageHeight(h); + th = computePercentageLogicalHeight(h); th = max(0, th); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { @@ -430,7 +434,7 @@ void RenderTable::layout() } if (isPositioned()) - calcHeight(); + computeLogicalHeight(); // table can be containing block of positioned elements. // FIXME: Only pass true if width or height changed. @@ -592,19 +596,19 @@ void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty) paintMaskImages(paintInfo, tx, ty, w, h); } -void RenderTable::calcPrefWidths() +void RenderTable::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); recalcSectionsIfNeeded(); recalcHorizontalBorders(); - m_tableLayout->calcPrefWidths(m_minPrefWidth, m_maxPrefWidth); + m_tableLayout->computePreferredLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); if (m_caption) - m_minPrefWidth = max(m_minPrefWidth, m_caption->minPrefWidth()); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_caption->minPreferredLogicalWidth()); - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderTable::splitColumn(int pos, int firstSpan) diff --git a/WebCore/rendering/RenderTable.h b/WebCore/rendering/RenderTable.h index dace8ba..58d4915 100644 --- a/WebCore/rendering/RenderTable.h +++ b/WebCore/rendering/RenderTable.h @@ -165,7 +165,7 @@ private: virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); virtual void paintMask(PaintInfo&, int tx, int ty); virtual void layout(); - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int xPos, int yPos, int tx, int ty, HitTestAction); virtual int firstLineBoxBaseline() const; @@ -175,7 +175,7 @@ private: virtual void setCellWidths(); - virtual void calcWidth(); + virtual void computeLogicalWidth(); virtual IntRect overflowClipRect(int tx, int ty); diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp index 66d1d7b..06f4726 100644 --- a/WebCore/rendering/RenderTableCell.cpp +++ b/WebCore/rendering/RenderTableCell.cpp @@ -50,8 +50,8 @@ RenderTableCell::RenderTableCell(Node* node) , m_column(-1) , m_rowSpan(1) , m_columnSpan(1) - , m_intrinsicPaddingTop(0) - , m_intrinsicPaddingBottom(0) + , m_intrinsicPaddingBefore(0) + , m_intrinsicPaddingAfter(0) , m_percentageHeight(0) { updateFromElement(); @@ -127,14 +127,14 @@ Length RenderTableCell::styleOrColWidth() const return w; } -void RenderTableCell::calcPrefWidths() +void RenderTableCell::computePreferredLogicalWidths() { - // The child cells rely on the grids up in the sections to do their calcPrefWidths work. Normally the sections are set up early, as table + // The child cells rely on the grids up in the sections to do their computePreferredLogicalWidths work. Normally the sections are set up early, as table // cells are added, but relayout can cause the cells to be freed, leaving stale pointers in the sections' // grids. We must refresh those grids before the child cells try to use them. table()->recalcSectionsIfNeeded(); - RenderBlock::calcPrefWidths(); + RenderBlock::computePreferredLogicalWidths(); if (node() && style()->autoWrap()) { // See if nowrap was set. Length w = styleOrColWidth(); @@ -145,11 +145,11 @@ void RenderTableCell::calcPrefWidths() // to make the minwidth of the cell into the fixed width. They do this // even in strict mode, so do not make this a quirk. Affected the top // of hiptop.com. - m_minPrefWidth = max(w.value(), m_minPrefWidth); + m_minPreferredLogicalWidth = max(w.value(), m_minPreferredLogicalWidth); } } -void RenderTableCell::calcWidth() +void RenderTableCell::computeLogicalWidth() { #ifdef ANDROID_LAYOUT if (view()->frameView()) @@ -173,12 +173,51 @@ void RenderTableCell::layout() int RenderTableCell::paddingTop(bool includeIntrinsicPadding) const { - return RenderBlock::paddingTop() + (includeIntrinsicPadding ? intrinsicPaddingTop() : 0); + int result = RenderBlock::paddingTop(); + if (!includeIntrinsicPadding || !style()->isVerticalBlockFlow()) + return result; + return result + (style()->blockFlow() == TopToBottomBlockFlow ? intrinsicPaddingBefore() : intrinsicPaddingAfter()); } int RenderTableCell::paddingBottom(bool includeIntrinsicPadding) const { - return RenderBlock::paddingBottom() + (includeIntrinsicPadding ? intrinsicPaddingBottom() : 0); + int result = RenderBlock::paddingBottom(); + if (!includeIntrinsicPadding || !style()->isVerticalBlockFlow()) + return result; + return result + (style()->blockFlow() == TopToBottomBlockFlow ? intrinsicPaddingAfter() : intrinsicPaddingBefore()); +} + +int RenderTableCell::paddingLeft(bool includeIntrinsicPadding) const +{ + int result = RenderBlock::paddingLeft(); + if (!includeIntrinsicPadding || style()->isVerticalBlockFlow()) + return result; + return result + (style()->blockFlow() == LeftToRightBlockFlow ? intrinsicPaddingBefore() : intrinsicPaddingAfter()); + +} + +int RenderTableCell::paddingRight(bool includeIntrinsicPadding) const +{ + int result = RenderBlock::paddingRight(); + if (!includeIntrinsicPadding || style()->isVerticalBlockFlow()) + return result; + return result + (style()->blockFlow() == LeftToRightBlockFlow ? intrinsicPaddingAfter() : intrinsicPaddingBefore()); +} + +int RenderTableCell::paddingBefore(bool includeIntrinsicPadding) const +{ + int result = RenderBlock::paddingBefore(); + if (!includeIntrinsicPadding) + return result; + return result + intrinsicPaddingBefore(); +} + +int RenderTableCell::paddingAfter(bool includeIntrinsicPadding) const +{ + int result = RenderBlock::paddingAfter(); + if (!includeIntrinsicPadding) + return result; + return result + intrinsicPaddingAfter(); } void RenderTableCell::setOverrideSize(int size) @@ -660,6 +699,28 @@ int RenderTableCell::borderBottom() const return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderBottom(); } +// FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed border drawing +// work with different block flow values instead of being hard-coded to top-to-bottom. +int RenderTableCell::borderStart() const +{ + return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderStart(); +} + +int RenderTableCell::borderEnd() const +{ + return table()->collapseBorders() ? borderHalfRight(false) : RenderBlock::borderEnd(); +} + +int RenderTableCell::borderBefore() const +{ + return table()->collapseBorders() ? borderHalfTop(false) : RenderBlock::borderBefore(); +} + +int RenderTableCell::borderAfter() const +{ + return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderAfter(); +} + int RenderTableCell::borderHalfLeft(bool outer) const { CollapsedBorderValue border = collapsedLeftBorder(table()->style()->direction() == RTL); diff --git a/WebCore/rendering/RenderTableCell.h b/WebCore/rendering/RenderTableCell.h index b6622f4..79376e9 100644 --- a/WebCore/rendering/RenderTableCell.h +++ b/WebCore/rendering/RenderTableCell.h @@ -53,14 +53,18 @@ public: Length styleOrColWidth() const; - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); void updateWidth(int); - int borderLeft() const; - int borderRight() const; - int borderTop() const; - int borderBottom() const; + virtual int borderLeft() const; + virtual int borderRight() const; + virtual int borderTop() const; + virtual int borderBottom() const; + virtual int borderStart() const; + virtual int borderEnd() const; + virtual int borderBefore() const; + virtual int borderAfter() const; int borderHalfLeft(bool outer) const; int borderHalfRight(bool outer) const; @@ -86,16 +90,24 @@ public: virtual int baselinePosition(bool firstLine = false, bool isRootLineBox = false) const; - void setIntrinsicPaddingTop(int p) { m_intrinsicPaddingTop = p; } - void setIntrinsicPaddingBottom(int p) { m_intrinsicPaddingBottom = p; } - void setIntrinsicPadding(int top, int bottom) { setIntrinsicPaddingTop(top); setIntrinsicPaddingBottom(bottom); } + void setIntrinsicPaddingBefore(int p) { m_intrinsicPaddingBefore = p; } + void setIntrinsicPaddingAfter(int p) { m_intrinsicPaddingAfter = p; } + void setIntrinsicPadding(int before, int after) { setIntrinsicPaddingBefore(before); setIntrinsicPaddingAfter(after); } void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } - int intrinsicPaddingTop() const { return m_intrinsicPaddingTop; } - int intrinsicPaddingBottom() const { return m_intrinsicPaddingBottom; } + int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } + int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; } virtual int paddingTop(bool includeIntrinsicPadding = true) const; virtual int paddingBottom(bool includeIntrinsicPadding = true) const; + virtual int paddingLeft(bool includeIntrinsicPadding = true) const; + virtual int paddingRight(bool includeIntrinsicPadding = true) const; + + // FIXME: For now we just assume the cell has the same block flow direction as the table. It's likely we'll + // create an extra anonymous RenderBlock to handle mixing directionality anyway, in which case we can lock + // the block flow directionality of the cells to the table's directionality. + virtual int paddingBefore(bool includeIntrinsicPadding = true) const; + virtual int paddingAfter(bool includeIntrinsicPadding = true) const; virtual void setOverrideSize(int); @@ -114,7 +126,7 @@ private: virtual bool requiresLayer() const { return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); } - virtual void calcWidth(); + virtual void computeLogicalWidth(); virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); virtual void paintMask(PaintInfo&, int tx, int ty); @@ -129,8 +141,8 @@ private: int m_column; int m_rowSpan; int m_columnSpan; - int m_intrinsicPaddingTop; - int m_intrinsicPaddingBottom; + int m_intrinsicPaddingBefore; + int m_intrinsicPaddingAfter; int m_percentageHeight; }; diff --git a/WebCore/rendering/RenderTableCol.cpp b/WebCore/rendering/RenderTableCol.cpp index 80e74e1..66d060b 100644 --- a/WebCore/rendering/RenderTableCol.cpp +++ b/WebCore/rendering/RenderTableCol.cpp @@ -88,12 +88,12 @@ void RenderTableCol::imageChanged(WrappedImagePtr, const IntRect*) repaint(); } -void RenderTableCol::calcPrefWidths() +void RenderTableCol::computePreferredLogicalWidths() { - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) - child->setPrefWidthsDirty(false); + child->setPreferredLogicalWidthsDirty(false); } RenderTable* RenderTableCol::table() const diff --git a/WebCore/rendering/RenderTableCol.h b/WebCore/rendering/RenderTableCol.h index 87209a1..c5f9afc 100644 --- a/WebCore/rendering/RenderTableCol.h +++ b/WebCore/rendering/RenderTableCol.h @@ -39,7 +39,7 @@ public: const RenderObjectChildList* children() const { return &m_children; } RenderObjectChildList* children() { return &m_children; } - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); int span() const { return m_span; } void setSpan(int span) { m_span = span; } diff --git a/WebCore/rendering/RenderTableRow.cpp b/WebCore/rendering/RenderTableRow.cpp index 0a8bfde..d0bd511 100644 --- a/WebCore/rendering/RenderTableRow.cpp +++ b/WebCore/rendering/RenderTableRow.cpp @@ -126,7 +126,7 @@ void RenderTableRow::layout() cell->setChildNeedsLayout(true, false); if (child->needsLayout()) { - cell->calcVerticalMargins(); + cell->computeBlockDirectionMargins(table()); cell->layout(); } } diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index 9e59109..37f2025 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -379,9 +379,9 @@ int RenderTableSection::calcRowHeight() cell->layoutIfNeeded(); } - int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingTop(); - int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingBottom(); - int adjustedHeight = cell->height() - (cell->intrinsicPaddingTop() + cell->intrinsicPaddingBottom()); + int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingBefore(); + int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingAfter(); + int adjustedHeight = cell->height() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter()); // Explicit heights use the border box in quirks mode. In strict mode do the right // thing and actually add in the border and padding. @@ -399,8 +399,8 @@ int RenderTableSection::calcRowHeight() if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) { int b = cell->baselinePosition(); if (b > cell->borderTop() + cell->paddingTop()) { - baseline = max(baseline, b - cell->intrinsicPaddingTop()); - bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingTop())); + baseline = max(baseline, b - cell->intrinsicPaddingBefore()); + bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingBefore())); } } } @@ -657,8 +657,8 @@ int RenderTableSection::layoutRows(int toAdd) } } - int oldTe = cell->intrinsicPaddingTop(); - int oldBe = cell->intrinsicPaddingBottom(); + int oldTe = cell->intrinsicPaddingBefore(); + int oldBe = cell->intrinsicPaddingAfter(); int heightWithoutIntrinsicPadding = cell->height() - oldTe - oldBe; int te = 0; @@ -687,8 +687,8 @@ int RenderTableSection::layoutRows(int toAdd) } int be = rHeight - heightWithoutIntrinsicPadding - te; - cell->setIntrinsicPaddingTop(te); - cell->setIntrinsicPaddingBottom(be); + cell->setIntrinsicPaddingBefore(te); + cell->setIntrinsicPaddingAfter(be); IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height()); diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index d786e6a..fada8b4 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -263,7 +263,7 @@ PassRefPtr<StringImpl> RenderText::originalText() const void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty) { for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) - rects.append(IntRect(tx + box->x(), ty + box->y(), box->width(), box->height())); + rects.append(IntRect(tx + box->x(), ty + box->y(), box->logicalWidth(), box->logicalHeight())); } void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight) @@ -281,7 +281,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { // Note: box->end() returns the index of the last character, not the index past it if (start <= box->start() && box->end() < end) { - IntRect r = IntRect(box->x(), box->y(), box->width(), box->height()); + IntRect r = IntRect(box->x(), box->y(), box->logicalWidth(), box->logicalHeight()); if (useSelectionHeight) { IntRect selectionRect = box->selectionRect(0, 0, start, end); r.setHeight(selectionRect.height()); @@ -297,7 +297,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u if (!r.isEmpty()) { if (!useSelectionHeight) { // change the height and y position because selectionRect uses selection-specific values - r.setHeight(box->height()); + r.setHeight(box->logicalHeight()); r.setY(box->y()); } FloatPoint origin = localToAbsolute(r.location()); @@ -380,7 +380,7 @@ void RenderText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, if (r.height()) { if (!useSelectionHeight) { // change the height and y position because selectionRect uses selection-specific values - r.setHeight(box->height()); + r.setHeight(box->logicalHeight()); r.setY(box->y()); } quads.append(localToAbsoluteQuad(FloatRect(r))); @@ -425,7 +425,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point) offset = firstTextBox()->offsetForPosition(point.x()); return createVisiblePosition(offset + firstTextBox()->start(), DOWNSTREAM); } - if (lastTextBox() && point.y() >= lastTextBox()->root()->lineTop() && point.x() >= lastTextBox()->m_x + lastTextBox()->m_width) { + if (lastTextBox() && point.y() >= lastTextBox()->root()->lineTop() && point.x() >= lastTextBox()->m_x + lastTextBox()->logicalWidth()) { // at the y coordinate of the last line or below // and the x coordinate is to the right of the last text box right edge offset = lastTextBox()->offsetForPosition(point.x()); @@ -444,7 +444,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point) // the affinity must be downstream so the position doesn't jump back to the previous line return createVisiblePosition(offset + box->start(), DOWNSTREAM); - if (point.x() < box->m_x + box->m_width) + if (point.x() < box->m_x + box->logicalWidth()) // and the x coordinate is to the left of the right edge of this box // check to see if position goes in this box return createVisiblePosition(offset + box->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM); @@ -489,11 +489,11 @@ IntRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, int* e int caretWidthRightOfOffset = caretWidth - caretWidthLeftOfOffset; int rootLeft = box->root()->x(); - int rootRight = rootLeft + box->root()->width(); + int rootRight = rootLeft + box->root()->logicalWidth(); // FIXME: should we use the width of the root inline box or the // width of the containing block for this? if (extraWidthToEndOfLine) - *extraWidthToEndOfLine = (box->root()->width() + rootLeft) - (left + 1); + *extraWidthToEndOfLine = (box->root()->logicalWidth() + rootLeft) - (left + 1); RenderBlock* cb = containingBlock(); RenderStyle* cbStyle = cb->style(); @@ -581,8 +581,8 @@ void RenderText::trimmedPrefWidths(int leadWidth, if (!collapseWhiteSpace) stripFrontSpaces = false; - if (m_hasTab || prefWidthsDirty()) - calcPrefWidths(leadWidth); + if (m_hasTab || preferredLogicalWidthsDirty()) + computePreferredLogicalWidths(leadWidth); beginWS = !stripFrontSpaces && m_hasBeginWS; endWS = m_hasEndWS; @@ -664,34 +664,34 @@ static inline bool isSpaceAccordingToStyle(UChar c, RenderStyle* style) return c == ' ' || (c == noBreakSpace && style->nbspMode() == SPACE); } -int RenderText::minPrefWidth() const +int RenderText::minPreferredLogicalWidth() const { - if (prefWidthsDirty()) - const_cast<RenderText*>(this)->calcPrefWidths(0); + if (preferredLogicalWidthsDirty()) + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0); return m_minWidth; } -int RenderText::maxPrefWidth() const +int RenderText::maxPreferredLogicalWidth() const { - if (prefWidthsDirty()) - const_cast<RenderText*>(this)->calcPrefWidths(0); + if (preferredLogicalWidthsDirty()) + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0); return m_maxWidth; } -void RenderText::calcPrefWidths(int leadWidth) +void RenderText::computePreferredLogicalWidths(int leadWidth) { HashSet<const SimpleFontData*> fallbackFonts; GlyphOverflow glyphOverflow; - calcPrefWidths(leadWidth, fallbackFonts, glyphOverflow); + computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow); if (fallbackFonts.isEmpty() && !glyphOverflow.left && !glyphOverflow.right && !glyphOverflow.top && !glyphOverflow.bottom) m_knownToHaveNoOverflowAndNoFallbackFonts = true; } -void RenderText::calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) +void RenderText::computePreferredLogicalWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) { - ASSERT(m_hasTab || prefWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts); + ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts); m_minWidth = 0; m_beginMinWidth = 0; @@ -877,7 +877,7 @@ void RenderText::calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& f m_endMinWidth = currMaxWidth; } - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } bool RenderText::isAllCollapsibleWhitespace() @@ -1249,14 +1249,14 @@ unsigned RenderText::width(unsigned from, unsigned len, const Font& f, int xPos, if (!style()->preserveNewline() && !from && len == textLength()) { if (fallbackFonts) { ASSERT(glyphOverflow); - if (prefWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) { - const_cast<RenderText*>(this)->calcPrefWidths(0, *fallbackFonts, *glyphOverflow); + if (preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) { + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0, *fallbackFonts, *glyphOverflow); if (fallbackFonts->isEmpty() && !glyphOverflow->left && !glyphOverflow->right && !glyphOverflow->top && !glyphOverflow->bottom) m_knownToHaveNoOverflowAndNoFallbackFonts = true; } w = m_maxWidth; } else - w = maxPrefWidth(); + w = maxPreferredLogicalWidth(); } else w = widthFromCache(f, from, len, xPos, fallbackFonts, glyphOverflow); } else @@ -1277,12 +1277,12 @@ IntRect RenderText::linesBoundingBox() const for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) { if (curr == firstTextBox() || curr->x() < leftSide) leftSide = curr->x(); - if (curr == firstTextBox() || curr->x() + curr->width() > rightSide) - rightSide = curr->x() + curr->width(); + if (curr == firstTextBox() || curr->x() + curr->logicalWidth() > rightSide) + rightSide = curr->x() + curr->logicalWidth(); } result.setWidth(rightSide - leftSide); result.setX(leftSide); - result.setHeight(lastTextBox()->y() + lastTextBox()->height() - firstTextBox()->y()); + result.setHeight(lastTextBox()->y() + lastTextBox()->logicalHeight() - firstTextBox()->y()); result.setY(firstTextBox()->y()); } diff --git a/WebCore/rendering/RenderText.h b/WebCore/rendering/RenderText.h index 6ab73f6..e3a6997 100644 --- a/WebCore/rendering/RenderText.h +++ b/WebCore/rendering/RenderText.h @@ -76,8 +76,8 @@ public: virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const; - virtual int minPrefWidth() const; - virtual int maxPrefWidth() const; + virtual int minPreferredLogicalWidth() const; + virtual int maxPreferredLogicalWidth() const; void trimmedPrefWidths(int leadWidth, int& beginMinW, bool& beginWS, @@ -124,7 +124,7 @@ public: void checkConsistency() const; - virtual void calcPrefWidths(int leadWidth); + virtual void computePreferredLogicalWidths(int leadWidth); bool isAllCollapsibleWhitespace(); protected: @@ -137,7 +137,7 @@ protected: virtual InlineTextBox* createTextBox(); // Subclassed by SVG. private: - void calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&); + void computePreferredLogicalWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&); // Make length() private so that callers that have a RenderText* // will use the more efficient textLength() instead, while diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp index e66e4ed..f48081b 100644 --- a/WebCore/rendering/RenderTextControl.cpp +++ b/WebCore/rendering/RenderTextControl.cpp @@ -401,7 +401,7 @@ int RenderTextControl::scrollbarThickness() const return ScrollbarTheme::nativeTheme()->scrollbarThickness(); } -void RenderTextControl::calcHeight() +void RenderTextControl::computeLogicalHeight() { setHeight(m_innerText->renderBox()->borderTop() + m_innerText->renderBox()->borderBottom() + m_innerText->renderBox()->paddingTop() + m_innerText->renderBox()->paddingBottom() + @@ -414,7 +414,7 @@ void RenderTextControl::calcHeight() if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && m_innerText->renderer()->style()->wordWrap() == NormalWordWrap)) setHeight(height() + scrollbarThickness()); - RenderBlock::calcHeight(); + RenderBlock::computeLogicalHeight(); } void RenderTextControl::hitInnerTextElement(HitTestResult& result, int xPos, int yPos, int tx, int ty) @@ -504,40 +504,40 @@ float RenderTextControl::scaleEmToUnits(int x) const return roundf(style()->font().size() * x / unitsPerEm); } -void RenderTextControl::calcPrefWidths() +void RenderTextControl::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; if (style()->width().isFixed() && style()->width().value() > 0) - m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value()); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else { // Use average character width. Matches IE. AtomicString family = style()->font().family().family(); - m_maxPrefWidth = preferredContentWidth(getAvgCharWidth(family)) + m_innerText->renderBox()->paddingLeft() + m_innerText->renderBox()->paddingRight(); + m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)) + m_innerText->renderBox()->paddingLeft() + m_innerText->renderBox()->paddingRight(); } if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { - m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value())); - m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value())); + m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); + m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value())); } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) { - m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); - m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); + m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value())); } int toAdd = borderAndPaddingWidth(); - m_minPrefWidth += toAdd; - m_maxPrefWidth += toAdd; + m_minPreferredLogicalWidth += toAdd; + m_maxPreferredLogicalWidth += toAdd; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } void RenderTextControl::selectionChanged(bool userTriggered) diff --git a/WebCore/rendering/RenderTextControl.h b/WebCore/rendering/RenderTextControl.h index de0b21b..a33f11d 100644 --- a/WebCore/rendering/RenderTextControl.h +++ b/WebCore/rendering/RenderTextControl.h @@ -85,7 +85,7 @@ protected: virtual RenderStyle* textBaseStyle() const = 0; virtual void updateFromElement(); - virtual void calcHeight(); + virtual void computeLogicalHeight(); friend class TextIterator; HTMLElement* innerTextElement() const; @@ -95,7 +95,7 @@ protected: private: virtual const char* renderName() const { return "RenderTextControl"; } virtual bool isTextControl() const { return true; } - virtual void calcPrefWidths(); + virtual void computePreferredLogicalWidths(); virtual void removeLeftoverAnonymousBlock(RenderBlock*) { } virtual bool canHaveChildren() const { return false; } virtual bool avoidsFloats() const { return true; } diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index e49fa4c..7edbe7f 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -227,10 +227,10 @@ void RenderTextControlSingleLine::addFocusRingRects(Vector<IntRect>& rects, int void RenderTextControlSingleLine::layout() { int oldHeight = height(); - calcHeight(); + computeLogicalHeight(); int oldWidth = width(); - calcWidth(); + computeLogicalWidth(); bool relayoutChildren = oldHeight != height() || oldWidth != width(); @@ -483,23 +483,23 @@ int RenderTextControlSingleLine::textBlockWidth() const int width = RenderTextControl::textBlockWidth(); if (RenderBox* resultsRenderer = m_resultsButton ? m_resultsButton->renderBox() : 0) { - resultsRenderer->calcWidth(); + resultsRenderer->computeLogicalWidth(); width -= resultsRenderer->width() + resultsRenderer->marginLeft() + resultsRenderer->marginRight(); } if (RenderBox* cancelRenderer = m_cancelButton ? m_cancelButton->renderBox() : 0) { - cancelRenderer->calcWidth(); + cancelRenderer->computeLogicalWidth(); width -= cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight(); } if (RenderBox* spinRenderer = m_innerSpinButton ? m_innerSpinButton->renderBox() : 0) { - spinRenderer->calcWidth(); + spinRenderer->computeLogicalWidth(); width -= spinRenderer->width() + spinRenderer->marginLeft() + spinRenderer->marginRight(); } #if ENABLE(INPUT_SPEECH) if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) { - speechRenderer->calcWidth(); + speechRenderer->computeLogicalWidth(); width -= speechRenderer->width() + speechRenderer->marginLeft() + speechRenderer->marginRight(); } #endif @@ -511,7 +511,7 @@ int RenderTextControlSingleLine::decorationWidthRight() const { int width = 0; if (RenderBox* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) { - spinRenderer->calcWidth(); + spinRenderer->computeLogicalWidth(); width += spinRenderer->width() + spinRenderer->marginLeft() + spinRenderer->marginRight(); } if (width > 0) @@ -563,7 +563,7 @@ int RenderTextControlSingleLine::preferredContentWidth(float charWidth) const cancelRenderer->paddingLeft() + cancelRenderer->paddingRight(); if (RenderBox* spinRenderer = m_innerSpinButton ? m_innerSpinButton->renderBox() : 0) - result += spinRenderer->minPrefWidth(); + result += spinRenderer->minPreferredLogicalWidth(); #if ENABLE(INPUT_SPEECH) if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) { @@ -578,8 +578,8 @@ int RenderTextControlSingleLine::preferredDecorationWidthRight() const { int width = 0; if (RenderBox* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) { - spinRenderer->calcWidth(); - width += spinRenderer->minPrefWidth() + spinRenderer->marginLeft() + spinRenderer->marginRight(); + spinRenderer->computeLogicalWidth(); + width += spinRenderer->minPreferredLogicalWidth() + spinRenderer->marginLeft() + spinRenderer->marginRight(); } if (width > 0) width += paddingRight() + borderRight(); @@ -589,7 +589,7 @@ int RenderTextControlSingleLine::preferredDecorationWidthRight() const void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineHeight) { if (RenderBox* resultsRenderer = m_resultsButton ? m_resultsButton->renderBox() : 0) { - toRenderBlock(resultsRenderer)->calcHeight(); + toRenderBlock(resultsRenderer)->computeLogicalHeight(); setHeight(max(height(), resultsRenderer->borderTop() + resultsRenderer->borderBottom() + resultsRenderer->paddingTop() + resultsRenderer->paddingBottom() + @@ -598,7 +598,7 @@ void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineH } if (RenderBox* cancelRenderer = m_cancelButton ? m_cancelButton->renderBox() : 0) { - toRenderBlock(cancelRenderer)->calcHeight(); + toRenderBlock(cancelRenderer)->computeLogicalHeight(); setHeight(max(height(), cancelRenderer->borderTop() + cancelRenderer->borderBottom() + cancelRenderer->paddingTop() + cancelRenderer->paddingBottom() + diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp index e10c2f1..ab6247b 100644 --- a/WebCore/rendering/RenderTreeAsText.cpp +++ b/WebCore/rendering/RenderTreeAsText.cpp @@ -46,7 +46,6 @@ #include "RenderView.h" #include "RenderWidget.h" #include "SelectionController.h" -#include "TextStream.h" #include <wtf/UnusedParam.h> #include <wtf/Vector.h> @@ -75,12 +74,53 @@ using namespace HTMLNames; static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal); -#if !ENABLE(SVG) -static TextStream &operator<<(TextStream& ts, const IntRect& r) +bool hasFractions(double val) +{ + static const double s_epsilon = 0.0001; + int ival = static_cast<int>(val); + double dval = static_cast<double>(ival); + return fabs(val - dval) > s_epsilon; +} + +TextStream& operator<<(TextStream& ts, const IntRect& r) { return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height(); } -#endif + +TextStream& operator<<(TextStream& ts, const IntPoint& p) +{ + return ts << "(" << p.x() << "," << p.y() << ")"; +} + +TextStream& operator<<(TextStream& ts, const FloatPoint& p) +{ + ts << "("; + if (hasFractions(p.x())) + ts << p.x(); + else + ts << int(p.x()); + ts << ","; + if (hasFractions(p.y())) + ts << p.y(); + else + ts << int(p.y()); + return ts << ")"; +} + +TextStream& operator<<(TextStream& ts, const FloatSize& s) +{ + ts << "width="; + if (hasFractions(s.width())) + ts << s.width(); + else + ts << int(s.width()); + ts << " height="; + if (hasFractions(s.height())) + ts << s.height(); + else + ts << int(s.height()); + return ts; +} void writeIndent(TextStream& ts, int indent) { @@ -223,13 +263,13 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, // to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are // captured by the results. const RenderTableCell& cell = *toRenderTableCell(&o); - r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingTop(), cell.width(), cell.height() - cell.intrinsicPaddingTop() - cell.intrinsicPaddingBottom()); + r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingBefore(), cell.width(), cell.height() - cell.intrinsicPaddingBefore() - cell.intrinsicPaddingAfter()); } else if (o.isBox()) r = toRenderBox(&o)->frameRect(); // FIXME: Temporary in order to ensure compatibility with existing layout test results. if (adjustForTableCells) - r.move(0, -toRenderTableCell(o.containingBlock())->intrinsicPaddingTop()); + r.move(0, -toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore()); ts << " " << r; @@ -398,8 +438,8 @@ static void writeTextRun(TextStream& ts, const RenderText& o, const InlineTextBo // FIXME: Table cell adjustment is temporary until results can be updated. int y = run.m_y; if (o.containingBlock()->isTableCell()) - y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingTop(); - ts << "text run at (" << run.m_x << "," << y << ") width " << run.m_width; + y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore(); + ts << "text run at (" << run.m_x << "," << y << ") width " << run.m_logicalWidth; if (run.direction() == RTL || run.m_dirOverride) { ts << (run.direction() == RTL ? " RTL" : " LTR"); if (run.m_dirOverride) diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h index 722736b..59a0abb 100644 --- a/WebCore/rendering/RenderTreeAsText.h +++ b/WebCore/rendering/RenderTreeAsText.h @@ -25,13 +25,19 @@ #ifndef RenderTreeAsText_h #define RenderTreeAsText_h +#include "TextStream.h" #include <wtf/Forward.h> +#include <wtf/MathExtras.h> namespace WebCore { class Element; +class FloatPoint; +class FloatSize; class Frame; +class IntPoint; +class IntRect; class RenderObject; class TextStream; @@ -59,6 +65,27 @@ public: static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior); }; +TextStream& operator<<(TextStream&, const IntPoint&); +TextStream& operator<<(TextStream&, const IntRect&); +TextStream& operator<<(TextStream&, const FloatPoint&); +TextStream& operator<<(TextStream&, const FloatSize&); + +template<typename Item> +TextStream& operator<<(TextStream& ts, const Vector<Item>& vector) +{ + ts << "["; + + unsigned size = vector.size(); + for (unsigned i = 0; i < size; ++i) { + ts << vector[i]; + if (i < size - 1) + ts << ", "; + } + + ts << "]"; + return ts; +} + // Helper function shared with SVGRenderTreeAsText String quoteAndEscapeNonPrintables(const String&); @@ -66,6 +93,8 @@ String counterValueForElement(Element*); String markerTextForListItem(Element*); +bool hasFractions(double val); + } // namespace WebCore #endif // RenderTreeAsText_h diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp index 3dfee7b..470499a 100644 --- a/WebCore/rendering/RenderVideo.cpp +++ b/WebCore/rendering/RenderVideo.cpp @@ -90,7 +90,7 @@ void RenderVideo::updateIntrinsicSize() return; setIntrinsicSize(size); - setPrefWidthsDirty(true); + setPreferredLogicalWidthsDirty(true); setNeedsLayout(true); } @@ -246,14 +246,14 @@ void RenderVideo::updatePlayer() mediaPlayer->setVisible(true); } -int RenderVideo::calcReplacedWidth(bool includeMaxWidth) const +int RenderVideo::computeReplacedWidth(bool includeMaxWidth) const { - return RenderReplaced::calcReplacedWidth(includeMaxWidth); + return RenderReplaced::computeReplacedWidth(includeMaxWidth); } -int RenderVideo::calcReplacedHeight() const +int RenderVideo::computeReplacedHeight() const { - return RenderReplaced::calcReplacedHeight(); + return RenderReplaced::computeReplacedHeight(); } int RenderVideo::minimumReplacedHeight() const diff --git a/WebCore/rendering/RenderVideo.h b/WebCore/rendering/RenderVideo.h index 2c47471..24f473d 100644 --- a/WebCore/rendering/RenderVideo.h +++ b/WebCore/rendering/RenderVideo.h @@ -70,8 +70,8 @@ private: virtual void layout(); - virtual int calcReplacedWidth(bool includeMaxWidth = true) const; - virtual int calcReplacedHeight() const; + virtual int computeReplacedWidth(bool includeMaxWidth = true) const; + virtual int computeReplacedHeight() const; virtual int minimumReplacedHeight() const; void updatePlayer(); diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp index edee4f6..439ed76 100644 --- a/WebCore/rendering/RenderView.cpp +++ b/WebCore/rendering/RenderView.cpp @@ -64,10 +64,10 @@ RenderView::RenderView(Node* node, FrameView* view) // init RenderObject attributes setInline(false); - m_minPrefWidth = 0; - m_maxPrefWidth = 0; + m_minPreferredLogicalWidth = 0; + m_maxPreferredLogicalWidth = 0; - setPrefWidthsDirty(true, false); + setPreferredLogicalWidthsDirty(true, false); setPositioned(true); // to 0,0 :) } @@ -76,15 +76,16 @@ RenderView::~RenderView() { } -void RenderView::calcHeight() +void RenderView::computeLogicalHeight() { if (!printing() && m_frameView) - setHeight(viewHeight()); + setLogicalHeight(viewLogicalHeight()); } -void RenderView::calcWidth() +void RenderView::computeLogicalWidth() { if (!printing() && m_frameView) +<<<<<<< HEAD setWidth(viewWidth()); #ifdef ANDROID_LAYOUT setVisibleWidth(m_frameView->textWrapWidth()); @@ -95,15 +96,18 @@ void RenderView::calcWidth() #endif m_marginLeft = 0; m_marginRight = 0; +======= + setLogicalWidth(viewLogicalWidth()); +>>>>>>> webkit.org at r68651 } -void RenderView::calcPrefWidths() +void RenderView::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); - RenderBlock::calcPrefWidths(); + RenderBlock::computePreferredLogicalWidths(); - m_maxPrefWidth = m_minPrefWidth; + m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth; } void RenderView::layout() @@ -112,14 +116,14 @@ void RenderView::layout() setPageHeight(0); if (printing()) - m_minPrefWidth = m_maxPrefWidth = width(); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width(); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, false); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent()) + if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) child->setChildNeedsLayout(true, false); } } diff --git a/WebCore/rendering/RenderView.h b/WebCore/rendering/RenderView.h index 55aa3b4..b03312f 100644 --- a/WebCore/rendering/RenderView.h +++ b/WebCore/rendering/RenderView.h @@ -47,13 +47,15 @@ public: virtual bool requiresLayer() const { return true; } virtual void layout(); - virtual void calcWidth(); - virtual void calcHeight(); - virtual void calcPrefWidths(); + virtual void computeLogicalWidth(); + virtual void computeLogicalHeight(); + virtual void computePreferredLogicalWidths(); // The same as the FrameView's layoutHeight/layoutWidth but with null check guards. int viewHeight() const; int viewWidth() const; + int viewLogicalWidth() const { return style()->isVerticalBlockFlow() ? viewWidth() : viewHeight(); } + int viewLogicalHeight() const { return style()->isVerticalBlockFlow() ? viewHeight() : viewWidth(); } float zoomFactor() const; diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp index e8f24b5..52586c5 100644 --- a/WebCore/rendering/RootInlineBox.cpp +++ b/WebCore/rendering/RootInlineBox.cpp @@ -39,6 +39,18 @@ namespace WebCore { typedef WTF::HashMap<const RootInlineBox*, EllipsisBox*> EllipsisBoxMap; static EllipsisBoxMap* gEllipsisBoxMap = 0; +RootInlineBox::RootInlineBox(RenderBlock* block) + : InlineFlowBox(block) + , m_lineBreakObj(0) + , m_lineBreakPos(0) + , m_lineTop(0) + , m_lineBottom(0) + , m_paginationStrut(0) +{ + setIsVertical(!block->style()->isVerticalBlockFlow()); +} + + void RootInlineBox::destroy(RenderArena* arena) { detachEllipsisBox(arena); @@ -72,7 +84,7 @@ bool RootInlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxE { // First sanity-check the unoverflowed width of the whole line to see if there is sufficient room. int delta = ltr ? lineBoxEdge - blockEdge : blockEdge - lineBoxEdge; - if (width() - delta < ellipsisWidth) + if (logicalWidth() - delta < ellipsisWidth) return false; // Next iterate over all the line boxes on the line. If we find a replaced element that intersects @@ -85,9 +97,8 @@ void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, in { // Create an ellipsis box. EllipsisBox* ellipsisBox = new (renderer()->renderArena()) EllipsisBox(renderer(), ellipsisStr, this, - ellipsisWidth - (markupBox ? markupBox->width() : 0), height(), - y(), !prevRootBox(), - markupBox); + ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(), + y(), !prevRootBox(), isVertical(), markupBox); if (!gEllipsisBoxMap) gEllipsisBoxMap = new EllipsisBoxMap(); @@ -95,8 +106,8 @@ void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, in setHasEllipsisBox(true); // FIXME: Do we need an RTL version of this? - if (ltr && (x() + width() + ellipsisWidth) <= blockRightEdge) { - ellipsisBox->m_x = x() + width(); + if (ltr && (x() + logicalWidth() + ellipsisWidth) <= blockRightEdge) { + ellipsisBox->m_x = x() + logicalWidth(); return; } @@ -134,10 +145,10 @@ void RootInlineBox::addHighlightOverflow() return; // Highlight acts as a selection inflation. - FloatRect rootRect(0, selectionTop(), width(), selectionHeight()); + FloatRect rootRect(0, selectionTop(), logicalWidth(), selectionHeight()); IntRect inflatedRect = enclosingIntRect(page->chrome()->client()->customHighlightRect(renderer()->node(), renderer()->style()->highlight(), rootRect)); - setHorizontalOverflowPositions(leftLayoutOverflow(), rightLayoutOverflow(), min(leftVisualOverflow(), inflatedRect.x()), max(rightVisualOverflow(), inflatedRect.right())); - setVerticalOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()), height()); + setInlineDirectionOverflowPositions(leftLayoutOverflow(), rightLayoutOverflow(), min(leftVisualOverflow(), inflatedRect.x()), max(rightVisualOverflow(), inflatedRect.right())); + setBlockDirectionOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()), logicalHeight()); } void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType) @@ -153,7 +164,7 @@ void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, c return; // Get the inflated rect so that we can properly hit test. - FloatRect rootRect(tx + x(), ty + selectionTop(), width(), selectionHeight()); + FloatRect rootRect(tx + x(), ty + selectionTop(), logicalWidth(), selectionHeight()); FloatRect inflatedRect = page->chrome()->client()->customHighlightRect(renderer()->node(), highlightType, rootRect); if (inflatedRect.intersects(paintInfo.rect)) page->chrome()->client()->paintCustomHighlight(renderer()->node(), highlightType, rootRect, rootRect, false, true); @@ -202,7 +213,7 @@ void RootInlineBox::childRemoved(InlineBox* box) } } -int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) +int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { #if ENABLE(SVG) // SVG will handle vertical alignment on its own. @@ -226,8 +237,8 @@ int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallb int maxHeight = maxAscent + maxDescent; int lineTop = heightOfBlock; int lineBottom = heightOfBlock; - placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom); - computeVerticalOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap); + placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom); + computeBlockDirectionOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap); setLineTopBottomPositions(lineTop, lineBottom); heightOfBlock += maxHeight; @@ -253,7 +264,7 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl rootBlock, blockX, blockY, tx, ty, paintInfo)); if (rightGap) result.uniteRight(block()->fillRightSelectionGap(lastBox->parent()->renderer(), - lastBox->x() + lastBox->width(), selTop, selHeight, + lastBox->x() + lastBox->logicalWidth(), selTop, selHeight, rootBlock, blockX, blockY, tx, ty, paintInfo)); // When dealing with bidi text, a non-contiguous selection region is possible. @@ -265,7 +276,7 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl // We can see that the |bbb| run is not part of the selection while the runs around it are. if (firstBox && firstBox != lastBox) { // Now fill in any gaps on the line that occurred between two selected elements. - int lastX = firstBox->x() + firstBox->width(); + int lastX = firstBox->x() + firstBox->logicalWidth(); bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone; for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) { if (box->selectionState() != RenderObject::SelectionNone) { @@ -273,7 +284,7 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl result.uniteCenter(block()->fillHorizontalSelectionGap(box->parent()->renderer(), lastX + tx, selTop + ty, box->x() - lastX, selHeight, paintInfo)); - lastX = box->x() + box->width(); + lastX = box->x() + box->logicalWidth(); } if (box == lastBox) break; @@ -342,10 +353,10 @@ int RootInlineBox::selectionTop() const // This line has actually been moved further down, probably from a large line-height, but possibly because the // line was forced to clear floats. If so, let's check the offsets, and only be willing to use the previous // line's bottom overflow if the offsets are greater on both sides. - int prevLeft = block()->leftOffset(prevBottom, !prevRootBox()); - int prevRight = block()->rightOffset(prevBottom, !prevRootBox()); - int newLeft = block()->leftOffset(selectionTop, !prevRootBox()); - int newRight = block()->rightOffset(selectionTop, !prevRootBox()); + int prevLeft = block()->logicalLeftOffsetForLine(prevBottom, !prevRootBox()); + int prevRight = block()->logicalRightOffsetForLine(prevBottom, !prevRootBox()); + int newLeft = block()->logicalLeftOffsetForLine(selectionTop, !prevRootBox()); + int newRight = block()->logicalRightOffsetForLine(selectionTop, !prevRootBox()); if (prevLeft > newLeft || prevRight < newRight) return selectionTop; } @@ -376,7 +387,7 @@ InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves // Return it. return firstLeaf; - if (x >= lastLeaf->m_x + lastLeaf->m_width && !lastLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf))) + if (x >= lastLeaf->m_x + lastLeaf->m_logicalWidth && !lastLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf))) // The x coordinate is greater or equal to right edge of the lastLeaf. // Return it. return lastLeaf; @@ -385,7 +396,7 @@ InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafChild()) { if (!leaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(leaf))) { closestLeaf = leaf; - if (x < leaf->m_x + leaf->m_width) + if (x < leaf->m_x + leaf->m_logicalWidth) // The x coordinate is less than the right edge of the box. // Return it. return leaf; diff --git a/WebCore/rendering/RootInlineBox.h b/WebCore/rendering/RootInlineBox.h index d97d0b1..8c75072 100644 --- a/WebCore/rendering/RootInlineBox.h +++ b/WebCore/rendering/RootInlineBox.h @@ -34,15 +34,7 @@ struct GapRects; class RootInlineBox : public InlineFlowBox { public: - RootInlineBox(RenderObject* obj) - : InlineFlowBox(obj) - , m_lineBreakObj(0) - , m_lineBreakPos(0) - , m_lineTop(0) - , m_lineBottom(0) - , m_paginationStrut(0) - { - } + RootInlineBox(RenderBlock* block); virtual void destroy(RenderArena*); @@ -65,7 +57,7 @@ public: int selectionBottom() const { return lineBottom(); } int selectionHeight() const { return max(0, selectionBottom() - selectionTop()); } - int verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&); + int alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&); void setLineTopBottomPositions(int top, int bottom); virtual RenderLineBoxList* rendererLineBoxes() const; diff --git a/WebCore/rendering/SVGInlineFlowBox.h b/WebCore/rendering/SVGInlineFlowBox.h index ab26297..80600f7 100644 --- a/WebCore/rendering/SVGInlineFlowBox.h +++ b/WebCore/rendering/SVGInlineFlowBox.h @@ -33,12 +33,12 @@ class SVGInlineFlowBox : public InlineFlowBox { public: SVGInlineFlowBox(RenderObject* obj) : InlineFlowBox(obj) - , m_height(0) + , m_logicalHeight(0) { } - virtual int virtualHeight() const { return m_height; } - void setHeight(int h) { m_height = h; } + virtual int virtualLogicalHeight() const { return m_logicalHeight; } + void setLogicalHeight(int h) { m_logicalHeight = h; } virtual void paint(PaintInfo&, int tx, int ty); @@ -46,7 +46,7 @@ public: void layoutFlowBox(); private: - int m_height; + int m_logicalHeight; }; } // namespace WebCore diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index ccba5b4..c367598 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -40,7 +40,7 @@ namespace WebCore { SVGInlineTextBox::SVGInlineTextBox(RenderObject* object) : InlineTextBox(object) - , m_height(0) + , m_logicalHeight(0) , m_paintingResource(0) , m_paintingResourceMode(ApplyToDefaultMode) { diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index 7711db4..24957cf 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -42,11 +42,11 @@ public: virtual bool isSVGInlineTextBox() const { return true; } - virtual int virtualHeight() const { return m_height; } - void setHeight(int height) { m_height = height; } + virtual int virtualLogicalHeight() const { return m_logicalHeight; } + void setLogicalHeight(int height) { m_logicalHeight = height; } virtual int selectionTop() { return m_y; } - virtual int selectionHeight() { return m_height; } + virtual int selectionHeight() { return m_logicalHeight; } virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const; virtual int positionForOffset(int offset) const; @@ -91,7 +91,7 @@ private: FloatRect selectionRectForTextChunkPart(const SVGTextChunkPart&, int partStartPos, int partEndPos, RenderStyle*); private: - int m_height; + int m_logicalHeight; AffineTransform m_chunkTransformation; Vector<SVGTextChunkPart> m_svgTextChunkParts; mutable SVGTextChunkPart m_currentChunkPart; diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index 20d7220..4e26f52 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -124,24 +124,6 @@ static void writeIfNotDefault(TextStream& ts, const char* name, ValueType value, writeNameValuePair(ts, name, value); } -TextStream& operator<<(TextStream& ts, const IntPoint& p) -{ - return ts << "(" << p.x() << "," << p.y() << ")"; -} - -TextStream& operator<<(TextStream& ts, const IntRect& r) -{ - return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height(); -} - -static bool hasFractions(double val) -{ - double epsilon = 0.0001; - int ival = static_cast<int>(val); - double dval = static_cast<double>(ival); - return fabs(val - dval) > epsilon; -} - TextStream& operator<<(TextStream& ts, const FloatRect &r) { ts << "at ("; @@ -167,36 +149,6 @@ TextStream& operator<<(TextStream& ts, const FloatRect &r) return ts; } -TextStream& operator<<(TextStream& ts, const FloatPoint& p) -{ - ts << "("; - if (hasFractions(p.x())) - ts << p.x(); - else - ts << int(p.x()); - ts << ","; - if (hasFractions(p.y())) - ts << p.y(); - else - ts << int(p.y()); - return ts << ")"; -} - -TextStream& operator<<(TextStream& ts, const FloatSize& s) -{ - ts << "width="; - if (hasFractions(s.width())) - ts << s.width(); - else - ts << int(s.width()); - ts << " height="; - if (hasFractions(s.height())) - ts << s.height(); - else - ts << int(s.height()); - return ts; -} - TextStream& operator<<(TextStream& ts, const AffineTransform& transform) { if (transform.isIdentity()) @@ -440,7 +392,7 @@ static void writeRenderSVGTextBox(TextStream& ts, const RenderBlock& text) return; Vector<SVGTextChunk>& chunks = const_cast<Vector<SVGTextChunk>& >(box->svgTextChunks()); - ts << " at (" << text.x() << "," << text.y() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)"; + ts << " at (" << text.x() << "," << text.y() << ") size " << box->logicalWidth() << "x" << box->logicalHeight() << " contains " << chunks.size() << " chunk(s)"; if (text.parent() && (text.parent()->style()->visitedDependentColor(CSSPropertyColor) != text.style()->visitedDependentColor(CSSPropertyColor))) writeNameValuePair(ts, "color", text.style()->visitedDependentColor(CSSPropertyColor).name()); diff --git a/WebCore/rendering/SVGRenderTreeAsText.h b/WebCore/rendering/SVGRenderTreeAsText.h index d4aeaac..e279cfe 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.h +++ b/WebCore/rendering/SVGRenderTreeAsText.h @@ -33,11 +33,8 @@ namespace WebCore { class Color; - class FloatPoint; class FloatRect; class FloatSize; - class IntPoint; - class IntRect; class Node; class RenderBlock; class RenderImage; @@ -63,12 +60,8 @@ void writeResources(TextStream&, const RenderObject&, int indent); // helper operators defined used in various classes to dump the render tree. TextStream& operator<<(TextStream&, const AffineTransform&); -TextStream& operator<<(TextStream&, const IntRect&); TextStream& operator<<(TextStream&, const Color&); -TextStream& operator<<(TextStream&, const IntPoint&); -TextStream& operator<<(TextStream&, const FloatSize&); TextStream& operator<<(TextStream&, const FloatRect&); -TextStream& operator<<(TextStream&, const FloatPoint&); // helper operators specific to dumping the render tree. these are used in various classes to dump the render tree // these could be defined in separate namespace to avoid matching these generic signatures unintentionally. @@ -88,21 +81,6 @@ TextStream& operator<<(TextStream& ts, const Vector<Item*>& v) return ts; } -template<typename Item> -TextStream& operator<<(TextStream& ts, const Vector<Item>& v) -{ - ts << "["; - - for (unsigned i = 0; i < v.size(); i++) { - ts << v[i]; - if (i < v.size() - 1) - ts << ", "; - } - - ts << "]"; - return ts; -} - template<typename Pointer> TextStream& operator<<(TextStream& ts, Pointer* t) { diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp index 6afdd99..715003f 100644 --- a/WebCore/rendering/SVGRootInlineBox.cpp +++ b/WebCore/rendering/SVGRootInlineBox.cpp @@ -196,8 +196,8 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start) IntRect boxRect = textBox->calculateBoundaries(); textBox->setX(boxRect.x()); textBox->setY(boxRect.y()); - textBox->setWidth(boxRect.width()); - textBox->setHeight(boxRect.height()); + textBox->setLogicalWidth(boxRect.width()); + textBox->setLogicalHeight(boxRect.height()); } else { ASSERT(child->isInlineFlowBox()); @@ -211,8 +211,8 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start) IntRect boxRect = flowBox->calculateBoundaries(); flowBox->setX(boxRect.x()); flowBox->setY(boxRect.y()); - flowBox->setWidth(boxRect.width()); - flowBox->setHeight(boxRect.height()); + flowBox->setLogicalWidth(boxRect.width()); + flowBox->setLogicalHeight(boxRect.height()); } } } @@ -251,8 +251,8 @@ void SVGRootInlineBox::layoutRootBox() // Position ourselves. setX(0); setY(0); - setWidth(widthBlock); - setHeight(heightBlock); + setLogicalWidth(widthBlock); + setLogicalHeight(heightBlock); setBlockHeight(heightBlock); setLineTopBottomPositions(0, heightBlock); } diff --git a/WebCore/rendering/SVGRootInlineBox.h b/WebCore/rendering/SVGRootInlineBox.h index 4e61190..77e7fcb 100644 --- a/WebCore/rendering/SVGRootInlineBox.h +++ b/WebCore/rendering/SVGRootInlineBox.h @@ -37,16 +37,16 @@ class SVGInlineTextBox; class SVGRootInlineBox : public RootInlineBox { public: - SVGRootInlineBox(RenderObject* obj) - : RootInlineBox(obj) - , m_height(0) + SVGRootInlineBox(RenderBlock* block) + : RootInlineBox(block) + , m_logicalHeight(0) { } virtual bool isSVGRootInlineBox() const { return true; } - virtual int virtualHeight() const { return m_height; } - void setHeight(int height) { m_height = height; } + virtual int virtualLogicalHeight() const { return m_logicalHeight; } + void setLogicalHeight(int height) { m_logicalHeight = height; } virtual void paint(PaintInfo&, int tx, int ty); @@ -66,7 +66,7 @@ private: void layoutChildBoxes(InlineFlowBox* start); private: - int m_height; + int m_logicalHeight; Vector<SVGChar> m_svgChars; Vector<SVGTextChunk> m_svgTextChunks; }; diff --git a/WebCore/rendering/TableLayout.h b/WebCore/rendering/TableLayout.h index 10d6e26..e0fa8ee 100644 --- a/WebCore/rendering/TableLayout.h +++ b/WebCore/rendering/TableLayout.h @@ -36,7 +36,7 @@ public: virtual ~TableLayout() { } - virtual void calcPrefWidths(int& minWidth, int& maxWidth) = 0; + virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth) = 0; virtual void layout() = 0; protected: diff --git a/WebCore/rendering/TrailingFloatsRootInlineBox.h b/WebCore/rendering/TrailingFloatsRootInlineBox.h index 68bf637..6629857 100644 --- a/WebCore/rendering/TrailingFloatsRootInlineBox.h +++ b/WebCore/rendering/TrailingFloatsRootInlineBox.h @@ -32,15 +32,14 @@ namespace WebCore { class TrailingFloatsRootInlineBox : public RootInlineBox { public: - TrailingFloatsRootInlineBox(RenderObject* object) : RootInlineBox(object) + TrailingFloatsRootInlineBox(RenderBlock* block) + : RootInlineBox(block) { -#if ENABLE(SVG) - setHasVirtualHeight(); -#endif + setHasVirtualLogicalHeight(); } private: - virtual int virtualHeight() const { return 0; } + virtual int virtualLogicalHeight() const { return 0; } }; } // namespace WebCore diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 4b77d6b..623a298 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -323,8 +323,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) { if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m_appearance || - rareNonInheritedData->marginTopCollapse != other->rareNonInheritedData->marginTopCollapse || - rareNonInheritedData->marginBottomCollapse != other->rareNonInheritedData->marginBottomCollapse || + rareNonInheritedData->marginBeforeCollapse != other->rareNonInheritedData->marginBeforeCollapse || + rareNonInheritedData->marginAfterCollapse != other->rareNonInheritedData->marginAfterCollapse || rareNonInheritedData->lineClamp != other->rareNonInheritedData->lineClamp || rareNonInheritedData->textOverflow != other->rareNonInheritedData->textOverflow) return StyleDifferenceLayout; @@ -789,7 +789,7 @@ CounterDirectiveMap& RenderStyle::accessCounterDirectives() const AtomicString& RenderStyle::hyphenString() const { - ASSERT(hyphens() == HyphensAuto); + ASSERT(hyphens() != HyphensNone); const AtomicString& hyphenationString = rareInheritedData.get()->hyphenationString; if (!hyphenationString.isNull()) @@ -1184,6 +1184,38 @@ Length RenderStyle::marginAfter() const return marginBottom(); } +Length RenderStyle::marginBeforeUsing(const RenderStyle* otherStyle) const +{ + switch (otherStyle->blockFlow()) { + case TopToBottomBlockFlow: + return marginTop(); + case BottomToTopBlockFlow: + return marginBottom(); + case LeftToRightBlockFlow: + return marginLeft(); + case RightToLeftBlockFlow: + return marginRight(); + } + ASSERT_NOT_REACHED(); + return marginTop(); +} + +Length RenderStyle::marginAfterUsing(const RenderStyle* otherStyle) const +{ + switch (otherStyle->blockFlow()) { + case TopToBottomBlockFlow: + return marginBottom(); + case BottomToTopBlockFlow: + return marginTop(); + case LeftToRightBlockFlow: + return marginRight(); + case RightToLeftBlockFlow: + return marginLeft(); + } + ASSERT_NOT_REACHED(); + return marginBottom(); +} + Length RenderStyle::marginStart() const { if (isVerticalBlockFlow()) @@ -1198,6 +1230,20 @@ Length RenderStyle::marginEnd() const return direction() == LTR ? marginBottom() : marginTop(); } +Length RenderStyle::marginStartUsing(const RenderStyle* otherStyle) const +{ + if (otherStyle->isVerticalBlockFlow()) + return otherStyle->direction() == LTR ? marginLeft() : marginRight(); + return otherStyle->direction() == LTR ? marginTop() : marginBottom(); +} + +Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const +{ + if (otherStyle->isVerticalBlockFlow()) + return otherStyle->direction() == LTR ? marginRight() : marginLeft(); + return otherStyle->direction() == LTR ? marginBottom() : marginTop(); +} + Length RenderStyle::paddingBefore() const { switch (blockFlow()) { diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index e6e6318..6ecbd56 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -598,6 +598,10 @@ public: Length marginAfter() const; Length marginStart() const; Length marginEnd() const; + Length marginStartUsing(const RenderStyle* otherStyle) const; + Length marginEndUsing(const RenderStyle* otherStyle) const; + Length marginBeforeUsing(const RenderStyle* otherStyle) const; + Length marginAfterUsing(const RenderStyle* otherStyle) const; LengthBox paddingBox() const { return surround->padding; } Length paddingTop() const { return surround->padding.top(); } @@ -661,8 +665,8 @@ public: EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); } EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); } bool textOverflow() const { return rareNonInheritedData->textOverflow; } - EMarginCollapse marginTopCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginTopCollapse); } - EMarginCollapse marginBottomCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBottomCollapse); } + EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); } + EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); } EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); } EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); } ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); } @@ -1018,8 +1022,8 @@ public: void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); } void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); } void setTextOverflow(bool b) { SET_VAR(rareNonInheritedData, textOverflow, b); } - void setMarginTopCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginTopCollapse, c); } - void setMarginBottomCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBottomCollapse, c); } + void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); } + void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); } void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); } void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); } void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); } @@ -1250,8 +1254,8 @@ public: static EUserDrag initialUserDrag() { return DRAG_AUTO; } static EUserSelect initialUserSelect() { return SELECT_TEXT; } static bool initialTextOverflow() { return false; } - static EMarginCollapse initialMarginTopCollapse() { return MCOLLAPSE; } - static EMarginCollapse initialMarginBottomCollapse() { return MCOLLAPSE; } + static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; } + static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; } static EWordBreak initialWordBreak() { return NormalWordBreak; } static EWordWrap initialWordWrap() { return NormalWordWrap; } static ENBSPMode initialNBSPMode() { return NBNORMAL; } diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/WebCore/rendering/style/StyleRareNonInheritedData.cpp index e293984..e0f7f7a 100644 --- a/WebCore/rendering/style/StyleRareNonInheritedData.cpp +++ b/WebCore/rendering/style/StyleRareNonInheritedData.cpp @@ -37,8 +37,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() , m_counterDirectives(0) , userDrag(RenderStyle::initialUserDrag()) , textOverflow(RenderStyle::initialTextOverflow()) - , marginTopCollapse(MCOLLAPSE) - , marginBottomCollapse(MCOLLAPSE) + , marginBeforeCollapse(MCOLLAPSE) + , marginAfterCollapse(MCOLLAPSE) , matchNearestMailBlockquoteColor(RenderStyle::initialMatchNearestMailBlockquoteColor()) , m_appearance(RenderStyle::initialAppearance()) , m_borderFit(RenderStyle::initialBorderFit()) @@ -73,8 +73,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited , m_counterDirectives(0) , userDrag(o.userDrag) , textOverflow(o.textOverflow) - , marginTopCollapse(o.marginTopCollapse) - , marginBottomCollapse(o.marginBottomCollapse) + , marginBeforeCollapse(o.marginBeforeCollapse) + , marginAfterCollapse(o.marginAfterCollapse) , matchNearestMailBlockquoteColor(o.matchNearestMailBlockquoteColor) , m_appearance(o.m_appearance) , m_borderFit(o.m_borderFit) @@ -118,8 +118,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c && m_counterDirectives == o.m_counterDirectives && userDrag == o.userDrag && textOverflow == o.textOverflow - && marginTopCollapse == o.marginTopCollapse - && marginBottomCollapse == o.marginBottomCollapse + && marginBeforeCollapse == o.marginBeforeCollapse + && marginAfterCollapse == o.marginAfterCollapse && matchNearestMailBlockquoteColor == o.matchNearestMailBlockquoteColor && m_appearance == o.m_appearance && m_borderFit == o.m_borderFit diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.h b/WebCore/rendering/style/StyleRareNonInheritedData.h index 6003ea4..3f693f9 100644 --- a/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -98,8 +98,8 @@ public: unsigned userDrag : 2; // EUserDrag bool textOverflow : 1; // Whether or not lines that spill out should be truncated with "..." - unsigned marginTopCollapse : 2; // EMarginCollapse - unsigned marginBottomCollapse : 2; // EMarginCollapse + unsigned marginBeforeCollapse : 2; // EMarginCollapse + unsigned marginAfterCollapse : 2; // EMarginCollapse unsigned matchNearestMailBlockquoteColor : 1; // EMatchNearestMailBlockquoteColor, FIXME: This property needs to be eliminated. It should never have been added. unsigned m_appearance : 6; // EAppearance unsigned m_borderFit : 1; // EBorderFit diff --git a/WebCore/storage/IDBCursorBackendImpl.cpp b/WebCore/storage/IDBCursorBackendImpl.cpp index 3a4dd67..13df5f0 100644 --- a/WebCore/storage/IDBCursorBackendImpl.cpp +++ b/WebCore/storage/IDBCursorBackendImpl.cpp @@ -36,6 +36,7 @@ #include "IDBKeyRange.h" #include "IDBObjectStoreBackendImpl.h" #include "IDBRequest.h" +#include "IDBTransactionBackendInterface.h" #include "SQLiteDatabase.h" #include "SQLiteStatement.h" #include "SerializedScriptValue.h" diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp index 81950d6..0ea7ac2 100644 --- a/WebCore/storage/IDBDatabase.cpp +++ b/WebCore/storage/IDBDatabase.cpp @@ -55,11 +55,12 @@ PassRefPtr<IDBRequest> IDBDatabase::createObjectStore(ScriptExecutionContext* co return request; } +// FIXME: remove this method. PassRefPtr<IDBObjectStore> IDBDatabase::objectStore(const String& name, unsigned short mode) { RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->objectStore(name, mode); ASSERT(objectStore); // FIXME: If this is null, we should raise a NOT_FOUND_ERR. - return IDBObjectStore::create(objectStore.release()); + return IDBObjectStore::create(objectStore.release(), 0); } PassRefPtr<IDBRequest> IDBDatabase::removeObjectStore(ScriptExecutionContext* context, const String& name) diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp index 021f70a..b8fe9b5 100644 --- a/WebCore/storage/IDBDatabaseBackendImpl.cpp +++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp @@ -148,11 +148,12 @@ void IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& callbacks->onSuccess(objectStore.get()); } +// FIXME: Do not expose this method via IDL. PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::objectStore(const String& name, unsigned short mode) { - // FIXME: If no transaction is running, this should implicitly start one. - ASSERT_UNUSED(mode, !mode); // FIXME: Handle non-standard modes. - return m_objectStores.get(name); + ASSERT_UNUSED(mode, !mode); // FIXME: Remove the mode parameter. Transactions have modes, not object stores. + RefPtr<IDBObjectStoreBackendInterface> objectStore = m_objectStores.get(name); + return objectStore.release(); } static void doDelete(SQLiteDatabase& db, const char* sql, int64_t id) diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h index ab055f8..7e08ad6 100644 --- a/WebCore/storage/IDBDatabaseBackendImpl.h +++ b/WebCore/storage/IDBDatabaseBackendImpl.h @@ -62,6 +62,8 @@ public: virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>); virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout); + IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); } + private: IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database, IDBTransactionCoordinator*); diff --git a/WebCore/storage/IDBFactoryBackendImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp index d819c92..6219c2d 100644 --- a/WebCore/storage/IDBFactoryBackendImpl.cpp +++ b/WebCore/storage/IDBFactoryBackendImpl.cpp @@ -62,9 +62,7 @@ static PassOwnPtr<SQLiteDatabase> openSQLiteDatabase(SecurityOrigin* securityOri return 0; } - String databaseIdentifier = securityOrigin->databaseIdentifier(); - String santizedName = encodeForFileName(name); - path = pathByAppendingComponent(pathBase, databaseIdentifier + "_" + santizedName + ".indexeddb"); + path = pathByAppendingComponent(pathBase, IDBFactoryBackendImpl::databaseFileName(name, securityOrigin)); } OwnPtr<SQLiteDatabase> sqliteDatabase = adoptPtr(new SQLiteDatabase()); @@ -142,10 +140,11 @@ void IDBFactoryBackendImpl::open(const String& name, const String& description, m_databaseBackendMap.set(name, databaseBackend.release()); } -void IDBFactoryBackendImpl::abortPendingTransactions(const Vector<int>& pendingIDs) +String IDBFactoryBackendImpl::databaseFileName(const String& name, SecurityOrigin* securityOrigin) { - for (size_t i = 0; i < pendingIDs.size(); ++i) - m_transactionCoordinator->abort(pendingIDs.at(i)); + String databaseIdentifier = securityOrigin->databaseIdentifier(); + String santizedName = encodeForFileName(name); + return databaseIdentifier + "@" + santizedName + ".indexeddb"; } } // namespace WebCore diff --git a/WebCore/storage/IDBFactoryBackendImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h index f2e1af8..76e545e 100644 --- a/WebCore/storage/IDBFactoryBackendImpl.h +++ b/WebCore/storage/IDBFactoryBackendImpl.h @@ -50,7 +50,8 @@ public: virtual ~IDBFactoryBackendImpl(); virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); - virtual void abortPendingTransactions(const Vector<int>& pendingIDs); + + static String databaseFileName(const String& name, SecurityOrigin*); private: IDBFactoryBackendImpl(); diff --git a/WebCore/storage/IDBFactoryBackendInterface.h b/WebCore/storage/IDBFactoryBackendInterface.h index e591271..4914024 100644 --- a/WebCore/storage/IDBFactoryBackendInterface.h +++ b/WebCore/storage/IDBFactoryBackendInterface.h @@ -52,7 +52,6 @@ public: virtual ~IDBFactoryBackendInterface() { } virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; - virtual void abortPendingTransactions(const Vector<int>& ids) = 0; }; } // namespace WebCore diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp index b457cd1..4c5cf34 100644 --- a/WebCore/storage/IDBObjectStore.cpp +++ b/WebCore/storage/IDBObjectStore.cpp @@ -31,6 +31,7 @@ #include "IDBIndex.h" #include "IDBKey.h" #include "IDBKeyRange.h" +#include "IDBTransactionBackendInterface.h" #include "SerializedScriptValue.h" #include <wtf/UnusedParam.h> @@ -38,8 +39,9 @@ namespace WebCore { -IDBObjectStore::IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore) +IDBObjectStore::IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore, IDBTransactionBackendInterface* transaction) : m_objectStore(idbObjectStore) + , m_transaction(transaction) { // We pass a reference to this object before it can be adopted. relaxAdoptionRequirement(); @@ -62,9 +64,9 @@ PassRefPtr<DOMStringList> IDBObjectStore::indexNames() const PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->get(key, request); - return request; + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); + m_objectStore->get(key, request, m_transaction.get()); + return request.release(); } PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key) @@ -97,8 +99,10 @@ PassRefPtr<IDBRequest> IDBObjectStore::createIndex(ScriptExecutionContext* conte PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name) { + // FIXME: If this is null, we should raise a NOT_FOUND_ERR. RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name); - ASSERT(index); // FIXME: If this is null, we should raise a NOT_FOUND_ERR. + if (!index) + return 0; return IDBIndex::create(index.release()); } diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h index 035f5d8..df5b3f7 100644 --- a/WebCore/storage/IDBObjectStore.h +++ b/WebCore/storage/IDBObjectStore.h @@ -43,13 +43,14 @@ class DOMStringList; class IDBAny; class IDBIndexRequest; class IDBKey; +class IDBTransactionBackendInterface; class SerializedScriptValue; class IDBObjectStore : public RefCounted<IDBObjectStore> { public: - static PassRefPtr<IDBObjectStore> create(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore) + static PassRefPtr<IDBObjectStore> create(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore, IDBTransactionBackendInterface* transaction) { - return adoptRef(new IDBObjectStore(idbObjectStore)); + return adoptRef(new IDBObjectStore(idbObjectStore, transaction)); } ~IDBObjectStore() { } @@ -69,9 +70,11 @@ public: PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange> = 0, unsigned short direction = IDBCursor::NEXT); private: - IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface>); + IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface>, IDBTransactionBackendInterface* transaction); + void removeTransactionFromPendingList(); RefPtr<IDBObjectStoreBackendInterface> m_objectStore; + RefPtr<IDBTransactionBackendInterface> m_transaction; }; } // namespace WebCore diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp index e5f81ab..18d6b0c 100644 --- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp +++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp @@ -36,6 +36,8 @@ #include "IDBKeyPath.h" #include "IDBKeyPathBackendImpl.h" #include "IDBKeyRange.h" +#include "IDBTransactionBackendInterface.h" +#include "ScriptExecutionContext.h" #include "SQLiteDatabase.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" @@ -44,6 +46,33 @@ namespace WebCore { +template <class T, class Method, class Param1, class Param2> +class IDBTask : public ScriptExecutionContext::Task { +public: + IDBTask(T* obj, Method method, const Param1& param1, const Param2& param2) + : m_obj(obj), m_method(method), m_param1(param1), m_param2(param2) + { + } + + virtual void performTask(ScriptExecutionContext*) + { + if (m_obj) + (m_obj->*m_method)(m_param1, m_param2); + } + +private: + T* m_obj; + Method m_method; + Param1 m_param1; + Param2 m_param2; +}; + +template <class T, class Method, class Param1, class Param2> +PassOwnPtr<ScriptExecutionContext::Task> createTask(T* object, Method method, const Param1& param1, const Param2& param2) +{ + return adoptPtr(new IDBTask<T, Method, Param1, Param2>(object, method, param1, param2)); +} + IDBObjectStoreBackendImpl::~IDBObjectStoreBackendImpl() { } @@ -77,7 +106,13 @@ static void bindWhereClause(SQLiteStatement& query, int64_t id, IDBKey* key) key->bind(query, 2); } -void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction) +{ + if (!transaction->scheduleTask(createTask(this, &IDBObjectStoreBackendImpl::getInternal, key, callbacks))) + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "Get must be called in the context of a transaction.")); +} + +void IDBObjectStoreBackendImpl::getInternal(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) { SQLiteStatement query(sqliteDatabase(), "SELECT keyString, keyDate, keyNumber, value FROM ObjectStoreData " + whereClause(key.get())); bool ok = query.prepare() == SQLResultOk; diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h index 32ef920..36c0014 100644 --- a/WebCore/storage/IDBObjectStoreBackendImpl.h +++ b/WebCore/storage/IDBObjectStoreBackendImpl.h @@ -36,6 +36,7 @@ namespace WebCore { class IDBDatabaseBackendImpl; class IDBIndexBackendImpl; +class IDBTransactionBackendInterface; class SQLiteDatabase; class IDBObjectStoreBackendImpl : public IDBObjectStoreBackendInterface { @@ -51,7 +52,7 @@ public: String keyPath() const { return m_keyPath; } PassRefPtr<DOMStringList> indexNames() const; - void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); + void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface* transaction); void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>); void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); @@ -69,6 +70,8 @@ private: void loadIndexes(); SQLiteDatabase& sqliteDatabase() const; + void getInternal(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); + RefPtr<IDBDatabaseBackendImpl> m_database; int64_t m_id; diff --git a/WebCore/storage/IDBObjectStoreBackendInterface.h b/WebCore/storage/IDBObjectStoreBackendInterface.h index 200ac29..c19855c 100644 --- a/WebCore/storage/IDBObjectStoreBackendInterface.h +++ b/WebCore/storage/IDBObjectStoreBackendInterface.h @@ -38,6 +38,7 @@ class IDBCallbacks; class IDBIndexBackendInterface; class IDBKey; class IDBKeyRange; +class IDBTransactionBackendInterface; class SerializedScriptValue; class IDBObjectStoreBackendInterface : public ThreadSafeShared<IDBObjectStoreBackendInterface> { @@ -48,7 +49,7 @@ public: virtual String keyPath() const = 0; virtual PassRefPtr<DOMStringList> indexNames() const = 0; - virtual void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0; + virtual void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface* transaction) = 0; virtual void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>) = 0; virtual void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0; diff --git a/WebCore/storage/IDBPendingTransactionMonitor.cpp b/WebCore/storage/IDBPendingTransactionMonitor.cpp index d026099..799200d 100644 --- a/WebCore/storage/IDBPendingTransactionMonitor.cpp +++ b/WebCore/storage/IDBPendingTransactionMonitor.cpp @@ -25,47 +25,48 @@ #include "config.h" #include "IDBPendingTransactionMonitor.h" +#include "IDBTransactionBackendInterface.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -Vector<int>* IDBPendingTransactionMonitor::m_ids = 0; +Vector<IDBTransactionBackendInterface*>* IDBPendingTransactionMonitor::m_transactions = 0; -bool IDBPendingTransactionMonitor::hasPendingTransactions() +void IDBPendingTransactionMonitor::addPendingTransaction(IDBTransactionBackendInterface* transaction) { - return m_ids && m_ids->size(); + if (!m_transactions) + m_transactions = new Vector<IDBTransactionBackendInterface*>(); + m_transactions->append(transaction); } -void IDBPendingTransactionMonitor::addPendingTransaction(int id) +void IDBPendingTransactionMonitor::removePendingTransaction(IDBTransactionBackendInterface* transaction) { - if (!m_ids) - m_ids = new Vector<int>(); - m_ids->append(id); -} + if (!m_transactions) + return; -void IDBPendingTransactionMonitor::removePendingTransaction(int id) -{ - m_ids->remove(id); - if (!m_ids->size()) { - delete m_ids; - m_ids = 0; + size_t pos = m_transactions->find(transaction); + if (pos == notFound) + return; + + m_transactions->remove(pos); + + if (!m_transactions->size()) { + delete m_transactions; + m_transactions = 0; } } -void IDBPendingTransactionMonitor::clearPendingTransactions() +void IDBPendingTransactionMonitor::abortPendingTransactions() { - if (!m_ids) + if (!m_transactions) return; - m_ids->clear(); - delete m_ids; - m_ids = 0; -} + for (size_t i = 0; i < m_transactions->size(); ++i) + m_transactions->at(i)->abort(); -const Vector<int>& IDBPendingTransactionMonitor::pendingTransactions() -{ - return *m_ids; + delete m_transactions; + m_transactions = 0; } }; diff --git a/WebCore/storage/IDBPendingTransactionMonitor.h b/WebCore/storage/IDBPendingTransactionMonitor.h index 00e833a..783a731 100644 --- a/WebCore/storage/IDBPendingTransactionMonitor.h +++ b/WebCore/storage/IDBPendingTransactionMonitor.h @@ -33,27 +33,27 @@ namespace WebCore { +class IDBTransactionBackendInterface; + // This class keeps track of the transactions created during the current // Javascript execution context. A transaction is 'pending' if no asynchronous // operation is currently queued for it (e.g. an IDBObjectStore::put() or similar). // All pending transactions are aborted as soon as execution returns from // the script engine. // -// FIXME: move the vector of transaction IDs to TLS. Keeping it static +// FIXME: move the vector of transactions to TLS. Keeping it static // will not work once we add support for workers. Another possible // solution is to keep the vector in the ScriptExecutionContext. class IDBPendingTransactionMonitor : public Noncopyable { public: - static bool hasPendingTransactions(); - static void addPendingTransaction(int id); - static void removePendingTransaction(int id); - static void clearPendingTransactions(); - static const Vector<int>& pendingTransactions(); + static void addPendingTransaction(IDBTransactionBackendInterface*); + static void removePendingTransaction(IDBTransactionBackendInterface*); + static void abortPendingTransactions(); private: IDBPendingTransactionMonitor(); - static Vector<int>* m_ids; + static Vector<IDBTransactionBackendInterface*>* m_transactions; }; } // namespace WebCore diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp index 6fbda0e..c672642 100644 --- a/WebCore/storage/IDBRequest.cpp +++ b/WebCore/storage/IDBRequest.cpp @@ -40,29 +40,38 @@ #include "IDBIndex.h" #include "IDBErrorEvent.h" #include "IDBObjectStore.h" +#include "IDBPendingTransactionMonitor.h" #include "IDBSuccessEvent.h" #include "ScriptExecutionContext.h" namespace WebCore { -IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> source) +IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> source, IDBTransactionBackendInterface* transaction) : ActiveDOMObject(context, this) , m_source(source) + , m_transaction(transaction) , m_timer(this, &IDBRequest::timerFired) - , m_aborted(false) , m_readyState(LOADING) { + if (transaction) + IDBPendingTransactionMonitor::removePendingTransaction(transaction); } IDBRequest::~IDBRequest() { - abort(); + // The transaction pointer is used to notify the transaction once the JS events were + // dispatched by this request object. If no new tasks were added by the event JS callbacks, + // the transaction can commit. Otherwise, it can continue executing the new tasks. + // It is important to guarantee that the transaction is notified after the events are + // dispatched, as the transaction cannot commit or execute new tasks in the absence + // of these notifications. We clear the transaction pointer once the events have dispatched, + // so having a non-zero pointer at IDBRequest destruction time shows that the events have not + // yet fired and there is a transaction waiting to be notified. This is an error. + ASSERT(!m_transaction); } bool IDBRequest::resetReadyState() { - if (m_aborted) - return false; ASSERT(m_readyState == DONE); m_readyState = LOADING; return true; @@ -100,7 +109,9 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) void IDBRequest::onSuccess(PassRefPtr<IDBObjectStoreBackendInterface> backend) { - scheduleEvent(IDBAny::create(IDBObjectStore::create(backend)), 0); + // FIXME: the transaction pointer should be the one of the setVersion transaction. This is because + // this callback is only executed for operations that neen to run in a setVersion transaction. + scheduleEvent(IDBAny::create(IDBObjectStore::create(backend, 0)), 0); } void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) @@ -108,15 +119,6 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal scheduleEvent(IDBAny::create(serializedScriptValue), 0); } -void IDBRequest::abort() -{ - m_timer.stop(); - m_aborted = true; - m_pendingEvents.clear(); - - // FIXME: This should cancel any pending work being done in the backend. -} - ScriptExecutionContext* IDBRequest::scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); @@ -142,7 +144,6 @@ EventTargetData* IDBRequest::ensureEventTargetData() void IDBRequest::timerFired(Timer<IDBRequest>*) { ASSERT(m_selfRef); - ASSERT(!m_aborted); ASSERT(m_pendingEvents.size()); // We need to keep self-referencing ourself, otherwise it's possible we'll be deleted. @@ -161,6 +162,13 @@ void IDBRequest::timerFired(Timer<IDBRequest>*) dispatchEvent(IDBSuccessEvent::create(m_source, pendingEvents[i].m_result)); } } + if (m_transaction) { + // Now that we processed all pending events, let the transaction monitor check if + // it can commit the current transaction or if there's anything new pending. + // FIXME: Handle the workers case. + m_transaction->didCompleteTaskEvents(); + m_transaction.clear(); + } } void IDBRequest::scheduleEvent(PassRefPtr<IDBAny> result, PassRefPtr<IDBDatabaseError> error) @@ -168,9 +176,6 @@ void IDBRequest::scheduleEvent(PassRefPtr<IDBAny> result, PassRefPtr<IDBDatabase ASSERT(m_readyState < DONE); ASSERT(!!m_selfRef == m_timer.isActive()); - if (m_aborted) - return; - PendingEvent pendingEvent; pendingEvent.m_result = result; pendingEvent.m_error = error; diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h index 9b0ea7e..75cd9a8 100644 --- a/WebCore/storage/IDBRequest.h +++ b/WebCore/storage/IDBRequest.h @@ -42,13 +42,14 @@ namespace WebCore { +class IDBTransactionBackendInterface; + class IDBRequest : public IDBCallbacks, public EventTarget, public ActiveDOMObject { public: - static PassRefPtr<IDBRequest> create(ScriptExecutionContext* context, PassRefPtr<IDBAny> source) { return adoptRef(new IDBRequest(context, source)); } + static PassRefPtr<IDBRequest> create(ScriptExecutionContext* context, PassRefPtr<IDBAny> source, IDBTransactionBackendInterface* transaction = 0) { return adoptRef(new IDBRequest(context, source, transaction)); } virtual ~IDBRequest(); // Defined in the IDL - void abort(); enum ReadyState { LOADING = 1, DONE = 2 @@ -80,7 +81,7 @@ public: using RefCounted<IDBCallbacks>::deref; private: - IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source); + IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source, IDBTransactionBackendInterface* transaction); void timerFired(Timer<IDBRequest>*); void scheduleEvent(PassRefPtr<IDBAny> result, PassRefPtr<IDBDatabaseError>); @@ -92,6 +93,7 @@ private: virtual EventTargetData* ensureEventTargetData(); RefPtr<IDBAny> m_source; + RefPtr<IDBTransactionBackendInterface> m_transaction; struct PendingEvent { RefPtr<IDBAny> m_result; @@ -103,7 +105,6 @@ private: Timer<IDBRequest> m_timer; RefPtr<IDBRequest> m_selfRef; // This is set to us iff there's an event pending. - bool m_aborted; ReadyState m_readyState; EventTargetData m_eventTargetData; }; diff --git a/WebCore/storage/IDBRequest.idl b/WebCore/storage/IDBRequest.idl index 3036b6b..58872f0 100644 --- a/WebCore/storage/IDBRequest.idl +++ b/WebCore/storage/IDBRequest.idl @@ -32,7 +32,6 @@ module storage { Conditional=INDEXED_DATABASE, EventTarget ] IDBRequest { - void abort(); // States const unsigned short LOADING = 1; diff --git a/WebCore/storage/IDBTransaction.cpp b/WebCore/storage/IDBTransaction.cpp index 4e93378..a223b7f 100644 --- a/WebCore/storage/IDBTransaction.cpp +++ b/WebCore/storage/IDBTransaction.cpp @@ -32,6 +32,7 @@ #include "EventException.h" #include "IDBAbortEvent.h" #include "IDBDatabase.h" +#include "IDBDatabaseException.h" #include "IDBObjectStore.h" #include "IDBObjectStoreBackendInterface.h" #include "IDBPendingTransactionMonitor.h" @@ -46,7 +47,7 @@ IDBTransaction::IDBTransaction(ScriptExecutionContext* context, PassRefPtr<IDBTr , m_stopped(false) , m_timer(this, &IDBTransaction::timerFired) { - IDBPendingTransactionMonitor::addPendingTransaction(m_backend->id()); + IDBPendingTransactionMonitor::addPendingTransaction(m_backend.get()); } IDBTransaction::~IDBTransaction() @@ -66,7 +67,11 @@ IDBDatabase* IDBTransaction::db() PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, const ExceptionCode&) { RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->objectStore(name); - RefPtr<IDBObjectStore> objectStore = IDBObjectStore::create(objectStoreBackend); + if (!objectStoreBackend) { + // FIXME: throw IDBDatabaseException::NOT_ALLOWED_ERR. + return 0; + } + RefPtr<IDBObjectStore> objectStore = IDBObjectStore::create(objectStoreBackend, m_backend.get()); return objectStore.release(); } diff --git a/WebCore/storage/IDBTransactionBackendImpl.cpp b/WebCore/storage/IDBTransactionBackendImpl.cpp index 51b33b2..4f18437 100644 --- a/WebCore/storage/IDBTransactionBackendImpl.cpp +++ b/WebCore/storage/IDBTransactionBackendImpl.cpp @@ -29,11 +29,12 @@ #if ENABLE(INDEXED_DATABASE) #include "IDBDatabaseBackendImpl.h" +#include "IDBTransactionCoordinator.h" #include "SQLiteDatabase.h" namespace WebCore { -PassRefPtr<IDBTransactionBackendInterface> IDBTransactionBackendImpl::create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl* database) +PassRefPtr<IDBTransactionBackendImpl> IDBTransactionBackendImpl::create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl* database) { return adoptRef(new IDBTransactionBackendImpl(objectStores, mode, timeout, id, database)); } @@ -43,26 +44,104 @@ IDBTransactionBackendImpl::IDBTransactionBackendImpl(DOMStringList* objectStores , m_mode(mode) , m_timeout(timeout) , m_id(id) - , m_aborted(false) + , m_state(NotStarted) , m_database(database) + , m_transaction(new SQLiteTransaction(database->sqliteDatabase())) + , m_timer(this, &IDBTransactionBackendImpl::timerFired) + , m_pendingEvents(0) { } PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStore(const String& name) { + if (isFinished()) + return 0; return m_database->objectStore(name, 0); // FIXME: remove mode param. } -void IDBTransactionBackendImpl::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) +bool IDBTransactionBackendImpl::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task) { - // FIXME: implement. - ASSERT_NOT_REACHED(); + if (isFinished()) + return false; + + m_taskQueue.append(task); + if (m_state == NotStarted) + start(); + + return true; } void IDBTransactionBackendImpl::abort() { - m_aborted = true; + if (isFinished()) + return; + + m_state = Finished; + m_transaction->rollback(); m_callbacks->onAbort(); + m_database->transactionCoordinator()->didFinishTransaction(this); +} + +void IDBTransactionBackendImpl::didCompleteTaskEvents() +{ + ASSERT(m_state == Started); + ASSERT(m_pendingEvents); + + m_pendingEvents--; + + if (!m_pendingEvents && m_taskQueue.isEmpty()) { + // The last task event has completed and the task + // queue is empty. Commit the transaction. + commit(); + return; + } + + // We are still waiting for other events to complete. However, + // the task queue is non-empty and the timer is inactive. + // We can therfore schedule the timer again. + if (!m_taskQueue.isEmpty() && !m_timer.isActive()) + m_timer.startOneShot(0); +} + +void IDBTransactionBackendImpl::run() +{ + ASSERT(m_state == Started); + ASSERT(!m_timer.isActive()); + + m_timer.startOneShot(0); +} + +void IDBTransactionBackendImpl::start() +{ + ASSERT(m_state == NotStarted); + + m_state = Started; + m_transaction->begin(); + m_database->transactionCoordinator()->didStartTransaction(this); +} + +void IDBTransactionBackendImpl::commit() +{ + ASSERT(m_state == Started); + + m_state = Finished; + m_transaction->commit(); + m_database->transactionCoordinator()->didFinishTransaction(this); +} + +void IDBTransactionBackendImpl::timerFired(Timer<IDBTransactionBackendImpl>*) +{ + ASSERT(!m_taskQueue.isEmpty()); + ASSERT(m_state == Started); + + TaskQueue queue; + queue.swap(m_taskQueue); + while (!queue.isEmpty()) { + OwnPtr<ScriptExecutionContext::Task> task(queue.first().release()); + queue.removeFirst(); + m_pendingEvents++; + task->performTask(0); + } } }; diff --git a/WebCore/storage/IDBTransactionBackendImpl.h b/WebCore/storage/IDBTransactionBackendImpl.h index fb57401..c037a11 100644 --- a/WebCore/storage/IDBTransactionBackendImpl.h +++ b/WebCore/storage/IDBTransactionBackendImpl.h @@ -31,6 +31,9 @@ #include "DOMStringList.h" #include "IDBTransactionBackendInterface.h" #include "IDBTransactionCallbacks.h" +#include "SQLiteTransaction.h" +#include "Timer.h" +#include <wtf/Deque.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -39,26 +42,51 @@ class IDBDatabaseBackendImpl; class IDBTransactionBackendImpl : public IDBTransactionBackendInterface { public: - static PassRefPtr<IDBTransactionBackendInterface> create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl*); - virtual ~IDBTransactionBackendImpl() { } + static PassRefPtr<IDBTransactionBackendImpl> create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl*); + virtual ~IDBTransactionBackendImpl() { abort(); } virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); virtual unsigned short mode() const { return m_mode; } - virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>); + virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>); + virtual void didCompleteTaskEvents(); virtual void abort(); virtual int id() const { return m_id; } virtual void setCallbacks(IDBTransactionCallbacks* callbacks) { m_callbacks = callbacks; } + void run(); + bool isFinished() const { return m_state == Finished; } + private: IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl*); + enum State { + NotStarted, + Started, + Finished, + }; + + void start(); + void commit(); + + void timerFired(Timer<IDBTransactionBackendImpl>*); + RefPtr<DOMStringList> m_objectStoreNames; unsigned short m_mode; unsigned long m_timeout; int m_id; - bool m_aborted; + + State m_state; RefPtr<IDBTransactionCallbacks> m_callbacks; RefPtr<IDBDatabaseBackendImpl> m_database; + + typedef Deque<OwnPtr<ScriptExecutionContext::Task> > TaskQueue; + TaskQueue m_taskQueue; + + OwnPtr<SQLiteTransaction> m_transaction; + + // FIXME: delete the timer once we have threads instead. + Timer<IDBTransactionBackendImpl> m_timer; + int m_pendingEvents; }; } // namespace WebCore diff --git a/WebCore/storage/IDBTransactionBackendInterface.h b/WebCore/storage/IDBTransactionBackendInterface.h index 39651f1..db95d03 100644 --- a/WebCore/storage/IDBTransactionBackendInterface.h +++ b/WebCore/storage/IDBTransactionBackendInterface.h @@ -50,7 +50,8 @@ public: virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name) = 0; virtual unsigned short mode() const = 0; - virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) = 0; + virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) = 0; + virtual void didCompleteTaskEvents() = 0; virtual void abort() = 0; virtual int id() const = 0; virtual void setCallbacks(IDBTransactionCallbacks*) = 0; diff --git a/WebCore/storage/IDBTransactionCoordinator.cpp b/WebCore/storage/IDBTransactionCoordinator.cpp index 9790c1f..0ece309 100644 --- a/WebCore/storage/IDBTransactionCoordinator.cpp +++ b/WebCore/storage/IDBTransactionCoordinator.cpp @@ -47,21 +47,45 @@ IDBTransactionCoordinator::~IDBTransactionCoordinator() PassRefPtr<IDBTransactionBackendInterface> IDBTransactionCoordinator::createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, IDBDatabaseBackendImpl* database) { - RefPtr<IDBTransactionBackendInterface> transaction = IDBTransactionBackendImpl::create(objectStores, mode, timeout, ++m_nextID, database); - m_transactionQueue.add(transaction.get()); - m_idMap.add(m_nextID, transaction); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::create(objectStores, mode, timeout, ++m_nextID, database); + m_transactions.add(m_nextID, transaction); return transaction.release(); } -void IDBTransactionCoordinator::abort(int id) +void IDBTransactionCoordinator::didStartTransaction(IDBTransactionBackendImpl* transaction) { - ASSERT(m_idMap.contains(id)); - RefPtr<IDBTransactionBackendInterface> transaction = m_idMap.get(id); - ASSERT(transaction); - m_transactionQueue.remove(transaction.get()); - m_idMap.remove(id); - transaction->abort(); - // FIXME: this will change once we have transactions actually running. + ASSERT(m_transactions.contains(transaction->id())); + + m_startedTransactions.add(transaction); + processStartedTransactions(); +} + +void IDBTransactionCoordinator::didFinishTransaction(IDBTransactionBackendImpl* transaction) +{ + ASSERT(m_transactions.contains(transaction->id())); + + if (m_startedTransactions.contains(transaction)) { + ASSERT(!m_runningTransactions.contains(transaction)); + m_startedTransactions.remove(transaction); + } else if (m_runningTransactions.contains(transaction)) + m_runningTransactions.remove(transaction); + + m_transactions.remove(transaction->id()); + + processStartedTransactions(); +} + +void IDBTransactionCoordinator::processStartedTransactions() +{ + // FIXME: This should allocate a thread to the next transaction that's + // ready to run. For now we only have a single running transaction. + if (m_startedTransactions.isEmpty() || !m_runningTransactions.isEmpty()) + return; + + IDBTransactionBackendImpl* transaction = *m_startedTransactions.begin(); + m_startedTransactions.remove(transaction); + m_runningTransactions.add(transaction); + transaction->run(); } }; diff --git a/WebCore/storage/IDBTransactionCoordinator.h b/WebCore/storage/IDBTransactionCoordinator.h index 104a956..5e54ab4 100644 --- a/WebCore/storage/IDBTransactionCoordinator.h +++ b/WebCore/storage/IDBTransactionCoordinator.h @@ -35,6 +35,7 @@ namespace WebCore { +class IDBTransactionBackendImpl; class IDBTransactionCallbacks; class IDBDatabaseBackendImpl; @@ -55,14 +56,21 @@ public: virtual ~IDBTransactionCoordinator(); PassRefPtr<IDBTransactionBackendInterface> createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, IDBDatabaseBackendImpl*); - void abort(int transactionId); + + // Called by transactions as they start and finish. + void didStartTransaction(IDBTransactionBackendImpl*); + void didFinishTransaction(IDBTransactionBackendImpl*); private: IDBTransactionCoordinator(); - ListHashSet<IDBTransactionBackendInterface*> m_transactionQueue; - typedef HashMap<int, RefPtr<IDBTransactionBackendInterface> > IdToTransactionMap; - IdToTransactionMap m_idMap; + void processStartedTransactions(); + + // This map owns all transactions known to the coordinator. + HashMap<int, RefPtr<IDBTransactionBackendImpl> > m_transactions; + // Transactions in different states are grouped below. + ListHashSet<IDBTransactionBackendImpl* > m_startedTransactions; + HashSet<IDBTransactionBackendImpl* > m_runningTransactions; int m_nextID; }; diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp index c4d816b..6c5952f 100644 --- a/WebCore/svg/SVGFEBlendElement.cpp +++ b/WebCore/svg/SVGFEBlendElement.cpp @@ -60,6 +60,16 @@ void SVGFEBlendElement::parseMappedAttribute(Attribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } +void SVGFEBlendElement::svgAttributeChanged(const QualifiedName& attrName) +{ + SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); + + if (attrName == SVGNames::modeAttr + || attrName == SVGNames::inAttr + || attrName == SVGNames::in2Attr) + invalidate(); +} + void SVGFEBlendElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); diff --git a/WebCore/svg/SVGFEBlendElement.h b/WebCore/svg/SVGFEBlendElement.h index 41c8307..c8c5deb 100644 --- a/WebCore/svg/SVGFEBlendElement.h +++ b/WebCore/svg/SVGFEBlendElement.h @@ -34,6 +34,7 @@ private: SVGFEBlendElement(const QualifiedName&, Document*); virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*); diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.h b/WebCore/svg/SVGFEConvolveMatrixElement.h index e70b768..b1fe7e2 100644 --- a/WebCore/svg/SVGFEConvolveMatrixElement.h +++ b/WebCore/svg/SVGFEConvolveMatrixElement.h @@ -21,7 +21,7 @@ #define SVGFEConvolveMatrixElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEConvolveMatrix.h" +#include "FEConvolveMatrix.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGNumberList.h" diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp index 4bc1bdb..d2e15f8 100644 --- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp +++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp @@ -23,8 +23,8 @@ #include "SVGFEDiffuseLightingElement.h" #include "Attr.h" +#include "FEDiffuseLighting.h" #include "SVGColor.h" -#include "SVGFEDiffuseLighting.h" #include "SVGFELightElement.h" #include "SVGNames.h" #include "SVGParserUtilities.h" diff --git a/WebCore/svg/SVGFEDisplacementMapElement.h b/WebCore/svg/SVGFEDisplacementMapElement.h index 239c2c7..21fd83f 100644 --- a/WebCore/svg/SVGFEDisplacementMapElement.h +++ b/WebCore/svg/SVGFEDisplacementMapElement.h @@ -21,7 +21,7 @@ #define SVGFEDisplacementMapElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEDisplacementMap.h" +#include "FEDisplacementMap.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEDistantLightElement.cpp b/WebCore/svg/SVGFEDistantLightElement.cpp index 59394d8..43a2868 100644 --- a/WebCore/svg/SVGFEDistantLightElement.cpp +++ b/WebCore/svg/SVGFEDistantLightElement.cpp @@ -21,7 +21,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDistantLightElement.h" -#include "SVGDistantLightSource.h" + +#include "DistantLightSource.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEFloodElement.h b/WebCore/svg/SVGFEFloodElement.h index 2f7d94d..10a418f 100644 --- a/WebCore/svg/SVGFEFloodElement.h +++ b/WebCore/svg/SVGFEFloodElement.h @@ -22,7 +22,7 @@ #define SVGFEFloodElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEFlood.h" +#include "FEFlood.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { diff --git a/WebCore/svg/SVGFELightElement.h b/WebCore/svg/SVGFELightElement.h index b86204d..d594475 100644 --- a/WebCore/svg/SVGFELightElement.h +++ b/WebCore/svg/SVGFELightElement.h @@ -23,8 +23,8 @@ #define SVGFELightElement_h #if ENABLE(SVG) && ENABLE(FILTERS) +#include "LightSource.h" #include "SVGElement.h" -#include "SVGLightSource.h" #include "SVGNames.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEMergeElement.h b/WebCore/svg/SVGFEMergeElement.h index c07be4c..da94ac7 100644 --- a/WebCore/svg/SVGFEMergeElement.h +++ b/WebCore/svg/SVGFEMergeElement.h @@ -22,7 +22,7 @@ #define SVGFEMergeElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEMerge.h" +#include "FEMerge.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEMorphologyElement.cpp b/WebCore/svg/SVGFEMorphologyElement.cpp index b45c6f9..bfd0c0f 100644 --- a/WebCore/svg/SVGFEMorphologyElement.cpp +++ b/WebCore/svg/SVGFEMorphologyElement.cpp @@ -42,9 +42,11 @@ PassRefPtr<SVGFEMorphologyElement> SVGFEMorphologyElement::create(const Qualifie return adoptRef(new SVGFEMorphologyElement(tagName, document)); } -void SVGFEMorphologyElement::setRadius(float, float) +void SVGFEMorphologyElement::setRadius(float x, float y) { - // FIXME: Needs an implementation. + setRadiusXBaseValue(x); + setRadiusYBaseValue(y); + invalidate(); } void SVGFEMorphologyElement::parseMappedAttribute(Attribute* attr) @@ -67,6 +69,16 @@ void SVGFEMorphologyElement::parseMappedAttribute(Attribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } +void SVGFEMorphologyElement::svgAttributeChanged(const QualifiedName& attrName) +{ + SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); + + if (attrName == SVGNames::inAttr + || attrName == SVGNames::operatorAttr + || attrName == SVGNames::radiusAttr) + invalidate(); +} + void SVGFEMorphologyElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); diff --git a/WebCore/svg/SVGFEMorphologyElement.h b/WebCore/svg/SVGFEMorphologyElement.h index 9bf26ee..6bbc20c 100644 --- a/WebCore/svg/SVGFEMorphologyElement.h +++ b/WebCore/svg/SVGFEMorphologyElement.h @@ -21,7 +21,7 @@ #define SVGFEMorphologyElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEMorphology.h" +#include "FEMorphology.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -39,6 +39,7 @@ private: SVGFEMorphologyElement(const QualifiedName&, Document*); virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*); diff --git a/WebCore/svg/SVGFEOffsetElement.h b/WebCore/svg/SVGFEOffsetElement.h index e522ce2..2d522a2 100644 --- a/WebCore/svg/SVGFEOffsetElement.h +++ b/WebCore/svg/SVGFEOffsetElement.h @@ -22,8 +22,8 @@ #define SVGFEOffsetElement_h #if ENABLE(SVG) && ENABLE(FILTERS) +#include "FEOffset.h" #include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGFEOffset.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEPointLightElement.cpp b/WebCore/svg/SVGFEPointLightElement.cpp index 4436ab9..666b744 100644 --- a/WebCore/svg/SVGFEPointLightElement.cpp +++ b/WebCore/svg/SVGFEPointLightElement.cpp @@ -21,7 +21,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEPointLightElement.h" -#include "SVGPointLightSource.h" + +#include "PointLightSource.h" namespace WebCore { diff --git a/WebCore/svg/SVGFESpecularLightingElement.h b/WebCore/svg/SVGFESpecularLightingElement.h index 1fed36f..378bc49 100644 --- a/WebCore/svg/SVGFESpecularLightingElement.h +++ b/WebCore/svg/SVGFESpecularLightingElement.h @@ -23,7 +23,7 @@ #define SVGFESpecularLightingElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFESpecularLighting.h" +#include "FESpecularLighting.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { diff --git a/WebCore/svg/SVGFESpotLightElement.cpp b/WebCore/svg/SVGFESpotLightElement.cpp index 04731f0..528cb5c 100644 --- a/WebCore/svg/SVGFESpotLightElement.cpp +++ b/WebCore/svg/SVGFESpotLightElement.cpp @@ -21,7 +21,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFESpotLightElement.h" -#include "SVGSpotLightSource.h" + +#include "SpotLightSource.h" namespace WebCore { diff --git a/WebCore/svg/SVGFETileElement.h b/WebCore/svg/SVGFETileElement.h index 03dc08d..b943c55 100644 --- a/WebCore/svg/SVGFETileElement.h +++ b/WebCore/svg/SVGFETileElement.h @@ -22,8 +22,8 @@ #define SVGFETileElement_h #if ENABLE(SVG) && ENABLE(FILTERS) +#include "FETile.h" #include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGFETile.h" namespace WebCore { diff --git a/WebCore/svg/SVGFETurbulenceElement.h b/WebCore/svg/SVGFETurbulenceElement.h index 887aacf..20e9ed6 100644 --- a/WebCore/svg/SVGFETurbulenceElement.h +++ b/WebCore/svg/SVGFETurbulenceElement.h @@ -22,7 +22,7 @@ #define SVGFETurbulenceElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFETurbulence.h" +#include "FETurbulence.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { diff --git a/WebCore/svg/SVGLength.cpp b/WebCore/svg/SVGLength.cpp index bdd5b27..a8cfb4e 100644 --- a/WebCore/svg/SVGLength.cpp +++ b/WebCore/svg/SVGLength.cpp @@ -86,28 +86,41 @@ static inline String lengthTypeToString(SVGLengthType type) return String(); } -inline SVGLengthType stringToLengthType(const String& string) +inline SVGLengthType stringToLengthType(const UChar*& ptr, const UChar* end) { - if (string.endsWith("%")) - return LengthTypePercentage; - else if (string.endsWith("em")) + if (ptr == end) + return LengthTypeNumber; + + const UChar firstChar = *ptr; + ++ptr; + + if (firstChar == '%') { + if (ptr == end) + return LengthTypePercentage; + return LengthTypeUnknown; + } + + const UChar secondChar = *ptr; + + if (++ptr != end) + return LengthTypeUnknown; + + if (firstChar == 'e' && secondChar == 'm') return LengthTypeEMS; - else if (string.endsWith("ex")) + if (firstChar == 'e' && secondChar == 'x') return LengthTypeEXS; - else if (string.endsWith("px")) + if (firstChar == 'p' && secondChar == 'x') return LengthTypePX; - else if (string.endsWith("cm")) + if (firstChar == 'c' && secondChar == 'm') return LengthTypeCM; - else if (string.endsWith("mm")) + if (firstChar == 'm' && secondChar == 'm') return LengthTypeMM; - else if (string.endsWith("in")) + if (firstChar == 'i' && secondChar == 'n') return LengthTypeIN; - else if (string.endsWith("pt")) + if (firstChar == 'p' && secondChar == 't') return LengthTypePT; - else if (string.endsWith("pc")) + if (firstChar == 'p' && secondChar == 'c') return LengthTypePC; - else if (!string.isEmpty()) - return LengthTypeNumber; return LengthTypeUnknown; } @@ -260,8 +273,8 @@ bool SVGLength::setValueAsString(const String& s) if (!parseNumber(ptr, end, convertedNumber, false)) return false; - SVGLengthType type = stringToLengthType(s); - if (ptr != end && type == LengthTypeNumber) + SVGLengthType type = stringToLengthType(ptr, end); + if (type == LengthTypeUnknown) return false; m_unit = storeUnit(extractMode(m_unit), type); diff --git a/WebCore/svg/SVGParserUtilities.cpp b/WebCore/svg/SVGParserUtilities.cpp index b8b6d85..c37d207 100644 --- a/WebCore/svg/SVGParserUtilities.cpp +++ b/WebCore/svg/SVGParserUtilities.cpp @@ -113,7 +113,10 @@ template <typename FloatType> static bool genericParseNumber(const UChar*& ptr, } number = integer + decimal; - number *= sign * static_cast<FloatType>(pow(10.0, expsign * exponent)); + number *= sign; + + if (exponent) + number *= static_cast<FloatType>(pow(10.0, expsign * exponent)); if (start == ptr) return false; diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp index a461ec4..7de880c 100644 --- a/WebCore/svg/SVGSVGElement.cpp +++ b/WebCore/svg/SVGSVGElement.cpp @@ -299,7 +299,7 @@ void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) // FIXME: Ugly, ugly hack to around that parseMappedAttribute is not called // when svg.width.baseValue = 100 is evaluated. - // Thus the CSS length value for width is not updated, and width() calcWidth() + // Thus the CSS length value for width is not updated, and width() computeLogicalWidth() // calculations on RenderSVGRoot will be wrong. // https://bugs.webkit.org/show_bug.cgi?id=25387 bool updateRelativeLengths = false; diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h deleted file mode 100644 index 9e17da4..0000000 --- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> - * Copyright (C) 2005 Eric Seidel <eric@webkit.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SVGFEDisplacementMap_h -#define SVGFEDisplacementMap_h - -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "PlatformString.h" -#include "FilterEffect.h" -#include "Filter.h" - -namespace WebCore { - - enum ChannelSelectorType { - CHANNEL_UNKNOWN = 0, - CHANNEL_R = 1, - CHANNEL_G = 2, - CHANNEL_B = 3, - CHANNEL_A = 4 - }; - - class FEDisplacementMap : public FilterEffect { - public: - static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType, ChannelSelectorType, float); - - ChannelSelectorType xChannelSelector() const; - void setXChannelSelector(const ChannelSelectorType); - - ChannelSelectorType yChannelSelector() const; - void setYChannelSelector(const ChannelSelectorType); - - float scale() const; - void setScale(float scale); - - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; - - private: - FEDisplacementMap(ChannelSelectorType, ChannelSelectorType, float); - - ChannelSelectorType m_xChannelSelector; - ChannelSelectorType m_yChannelSelector; - float m_scale; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(FILTERS) - -#endif // SVGFEDisplacementMap_h diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp index a3ac882..c94547b 100644 --- a/WebCore/svg/graphics/filters/SVGFEImage.cpp +++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp @@ -29,18 +29,17 @@ #include "Filter.h" #include "GraphicsContext.h" #include "SVGPreserveAspectRatio.h" -#include "SVGRenderTreeAsText.h" namespace WebCore { -FEImage::FEImage(RefPtr<Image> image, SVGPreserveAspectRatio preserveAspectRatio) +FEImage::FEImage(RefPtr<Image> image, const SVGPreserveAspectRatio& preserveAspectRatio) : FilterEffect() , m_image(image) , m_preserveAspectRatio(preserveAspectRatio) { } -PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, SVGPreserveAspectRatio preserveAspectRatio) +PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, const SVGPreserveAspectRatio& preserveAspectRatio) { return adoptRef(new FEImage(image, preserveAspectRatio)); } @@ -50,7 +49,7 @@ void FEImage::apply(Filter*) if (!m_image.get()) return; - GraphicsContext* filterContext = getEffectContext(); + GraphicsContext* filterContext = effectContext(); if (!filterContext) return; diff --git a/WebCore/svg/graphics/filters/SVGFEImage.h b/WebCore/svg/graphics/filters/SVGFEImage.h index 97a9cda..fe2d8c4 100644 --- a/WebCore/svg/graphics/filters/SVGFEImage.h +++ b/WebCore/svg/graphics/filters/SVGFEImage.h @@ -29,20 +29,21 @@ namespace WebCore { - class FEImage : public FilterEffect { - public: - static PassRefPtr<FEImage> create(RefPtr<Image>, SVGPreserveAspectRatio); - - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; - - private: - FEImage(RefPtr<Image>, SVGPreserveAspectRatio); - - RefPtr<Image> m_image; - SVGPreserveAspectRatio m_preserveAspectRatio; - }; +class FEImage : public FilterEffect { +public: + static PassRefPtr<FEImage> create(RefPtr<Image>, const SVGPreserveAspectRatio&); + + virtual void apply(Filter*); + virtual void dump(); + + virtual TextStream& externalRepresentation(TextStream&, int indention) const; + +private: + FEImage(RefPtr<Image>, const SVGPreserveAspectRatio&); + + RefPtr<Image> m_image; + SVGPreserveAspectRatio m_preserveAspectRatio; +}; } // namespace WebCore diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.h b/WebCore/svg/graphics/filters/SVGFEMorphology.h deleted file mode 100644 index 9743d2b..0000000 --- a/WebCore/svg/graphics/filters/SVGFEMorphology.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> - * Copyright (C) 2005 Eric Seidel <eric@webkit.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SVGFEMorphology_h -#define SVGFEMorphology_h - -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "FilterEffect.h" -#include "Filter.h" - -namespace WebCore { - - enum MorphologyOperatorType { - FEMORPHOLOGY_OPERATOR_UNKNOWN = 0, - FEMORPHOLOGY_OPERATOR_ERODE = 1, - FEMORPHOLOGY_OPERATOR_DILATE = 2 - }; - - class FEMorphology : public FilterEffect { - public: - static PassRefPtr<FEMorphology> create(MorphologyOperatorType, float radiusX, float radiusY); - MorphologyOperatorType morphologyOperator() const; - void setMorphologyOperator(MorphologyOperatorType); - - float radiusX() const; - void setRadiusX(float); - - float radiusY() const; - void setRadiusY(float); - - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; - - private: - FEMorphology(MorphologyOperatorType, float radiusX, float radiusY); - - MorphologyOperatorType m_type; - float m_radiusX; - float m_radiusY; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(FILTERS) - -#endif // SVGFEMorphology_h diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp b/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp index 5a6d0b9..091379e 100644 --- a/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp +++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp @@ -27,15 +27,16 @@ #include "SourceAlpha.h" #include "SourceGraphic.h" -#include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> namespace WebCore { SVGFilterBuilder::SVGFilterBuilder() + : m_lastEffect(0) { m_builtinEffects.add(SourceGraphic::effectName(), SourceGraphic::create()); m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create()); + addBuiltinEffects(); } void SVGFilterBuilder::add(const AtomicString& id, RefPtr<FilterEffect> effect) @@ -67,10 +68,26 @@ FilterEffect* SVGFilterBuilder::getEffectById(const AtomicString& id) const return m_namedEffects.get(id).get(); } +void SVGFilterBuilder::appendEffectToEffectReferences(RefPtr<FilterEffect> effectReference) +{ + // The effect must be a newly created filter effect. + ASSERT(!m_effectReferences.contains(effectReference)); + m_effectReferences.add(effectReference, FilterEffectSet()); + + FilterEffect* effect = effectReference.get(); + unsigned numberOfInputEffects = effect->inputEffects().size(); + + // It is not possible to add the same value to a set twice. + for (unsigned i = 0; i < numberOfInputEffects; ++i) + getEffectReferences(effect->inputEffect(i)).add(effect); +} + void SVGFilterBuilder::clearEffects() { m_lastEffect = 0; m_namedEffects.clear(); + m_effectReferences.clear(); + addBuiltinEffects(); } } // namespace WebCore diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.h b/WebCore/svg/graphics/filters/SVGFilterBuilder.h index 4ef6ffe..320088d 100644 --- a/WebCore/svg/graphics/filters/SVGFilterBuilder.h +++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.h @@ -27,6 +27,7 @@ #include "PlatformString.h" #include <wtf/HashMap.h> +#include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/text/AtomicStringHash.h> @@ -34,6 +35,8 @@ namespace WebCore { class SVGFilterBuilder : public RefCounted<SVGFilterBuilder> { public: + typedef HashSet<FilterEffect*> FilterEffectSet; + static PassRefPtr<SVGFilterBuilder> create() { return adoptRef(new SVGFilterBuilder); } void add(const AtomicString& id, RefPtr<FilterEffect> effect); @@ -41,15 +44,32 @@ namespace WebCore { FilterEffect* getEffectById(const AtomicString& id) const; FilterEffect* lastEffect() const { return m_lastEffect.get(); } - const HashMap<AtomicString, RefPtr<FilterEffect> >& namedEffects() { return m_namedEffects; } + void appendEffectToEffectReferences(RefPtr<FilterEffect>); + + inline FilterEffectSet& getEffectReferences(FilterEffect* effect) + { + // Only allowed for effects belongs to this builder. + ASSERT(m_effectReferences.contains(effect)); + return m_effectReferences.find(effect)->second; + } void clearEffects(); private: SVGFilterBuilder(); + inline void addBuiltinEffects() + { + HashMap<AtomicString, RefPtr<FilterEffect> >::iterator end = m_builtinEffects.end(); + for (HashMap<AtomicString, RefPtr<FilterEffect> >::iterator iterator = m_builtinEffects.begin(); iterator != end; ++iterator) + m_effectReferences.add(iterator->second, FilterEffectSet()); + } + HashMap<AtomicString, RefPtr<FilterEffect> > m_builtinEffects; HashMap<AtomicString, RefPtr<FilterEffect> > m_namedEffects; + // The value is a list, which contains those filter effects, + // which depends on the key filter effect. + HashMap<RefPtr<FilterEffect>, FilterEffectSet> m_effectReferences; RefPtr<FilterEffect> m_lastEffect; }; diff --git a/WebCore/webaudio/AudioContext.cpp b/WebCore/webaudio/AudioContext.cpp new file mode 100644 index 0000000..6ca8ee1 --- /dev/null +++ b/WebCore/webaudio/AudioContext.cpp @@ -0,0 +1,467 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "AudioContext.h" + +#include "AudioBuffer.h" +#include "AudioBufferSourceNode.h" +#include "AudioChannelMerger.h" +#include "AudioChannelSplitter.h" +#include "AudioGainNode.h" +#include "AudioListener.h" +#include "AudioPannerNode.h" +#include "CachedAudio.h" +#include "ConvolverNode.h" +#include "DelayNode.h" +#include "Document.h" +#include "HRTFDatabaseLoader.h" +#include "HRTFPanner.h" +#include "HTMLNames.h" +#include "HighPass2FilterNode.h" +#include "JavaScriptAudioNode.h" +#include "LowPass2FilterNode.h" +#include "PlatformString.h" +#include "RealtimeAnalyserNode.h" + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefCounted.h> + +// FIXME: check the proper way to reference an undefined thread ID +const int UndefinedThreadIdentifier = 0xffffffff; + +namespace WebCore { + +PassRefPtr<CachedAudio> AudioContext::createAudioRequest(const String &url, bool mixToMono) +{ + lazyInitialize(); + + // Convert relative URL to absolute + KURL completedURL = document()->completeURL(url); + String completedURLString = completedURL.string(); + + RefPtr<CachedAudio> cachedAudio = CachedAudio::create(completedURLString, this, document(), sampleRate(), mixToMono); + CachedAudio* c = cachedAudio.get(); + + m_cachedAudioReferences.append(c); + + return cachedAudio; +} + +PassRefPtr<AudioContext> AudioContext::create(Document* document) +{ + return adoptRef(new AudioContext(document)); +} + +AudioContext::AudioContext(Document* document) + : ActiveDOMObject(document, this) + , m_isInitialized(false) + , m_isAudioThreadFinished(false) + , m_document(document) + , m_destinationNode(0) + , m_connectionCount(0) + , m_audioThread(0) + , m_graphOwnerThread(UndefinedThreadIdentifier) +{ + // Note: because adoptRef() won't be called until we leave this constructor, but code in this constructor needs to reference this context, + // relax the check. + relaxAdoptionRequirement(); + + m_destinationNode = AudioDestinationNode::create(this); + m_listener = AudioListener::create(); + m_temporaryMonoBus = adoptPtr(new AudioBus(1, AudioNode::ProcessingSizeInFrames)); + m_temporaryStereoBus = adoptPtr(new AudioBus(2, AudioNode::ProcessingSizeInFrames)); + + // This sets in motion an asynchronous loading mechanism on another thread. + // We can check hrtfDatabaseLoader()->isLoaded() to find out whether or not it has been fully loaded. + // It's not that useful to have a callback function for this since the audio thread automatically starts rendering on the graph + // when this has finished (see AudioDestinationNode). + hrtfDatabaseLoader()->loadAsynchronously(sampleRate()); +} + +AudioContext::~AudioContext() +{ +#if DEBUG_AUDIONODE_REFERENCES + printf("%p: AudioContext::~AudioContext()\n", this); +#endif + // AudioNodes keep a reference to their context, so there should be no way to be in the destructor if there are still AudioNodes around. + ASSERT(!m_nodesToDelete.size()); + ASSERT(!m_referencedNodes.size()); + ASSERT(!m_finishedNodes.size()); +} + +void AudioContext::lazyInitialize() +{ + if (!m_isInitialized) { + // Don't allow the context to initialize a second time after it's already been explicitly uninitialized. + ASSERT(!m_isAudioThreadFinished); + if (!m_isAudioThreadFinished) { + if (m_destinationNode.get()) { + // This starts the audio thread. The destination node's provideInput() method will now be called repeatedly to render audio. + // Each time provideInput() is called, a portion of the audio stream is rendered. Let's call this time period a "render quantum". + m_destinationNode->initialize(); + } + m_isInitialized = true; + } + } +} + +void AudioContext::uninitialize() +{ + if (m_isInitialized) { + // This stops the audio thread and all audio rendering. + m_destinationNode->uninitialize(); + + // Don't allow the context to initialize a second time after it's already been explicitly uninitialized. + m_isAudioThreadFinished = true; + + // We have to release our reference to the destination node before the context will ever be deleted since the destination node holds a reference to the context. + m_destinationNode.clear(); + + // Get rid of the sources which may still be playing. + derefUnfinishedSourceNodes(); + + // Because the AudioBuffers are garbage collected, we can't delete them here. + // Instead, at least release the potentially large amount of allocated memory for the audio data. + // Note that we do this *after* the context is uninitialized and stops processing audio. + for (unsigned i = 0; i < m_allocatedBuffers.size(); ++i) + m_allocatedBuffers[i]->releaseMemory(); + m_allocatedBuffers.clear(); + + m_isInitialized = false; + } +} + +bool AudioContext::isInitialized() const +{ + return m_isInitialized; +} + +bool AudioContext::isRunnable() const +{ + if (!isInitialized()) + return false; + + // Check with the HRTF spatialization system to see if it's finished loading. + return hrtfDatabaseLoader()->isLoaded(); +} + +void AudioContext::stop() +{ + m_document = 0; // document is going away + uninitialize(); +} + +Document* AudioContext::document() +{ + ASSERT(m_document); + return m_document; +} + +bool AudioContext::hasDocument() +{ + return m_document; +} + +void AudioContext::refBuffer(PassRefPtr<AudioBuffer> buffer) +{ + m_allocatedBuffers.append(buffer); +} + +PassRefPtr<AudioBuffer> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, double sampleRate) +{ + return AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate); +} + +PassRefPtr<AudioBufferSourceNode> AudioContext::createBufferSource() +{ + ASSERT(isMainThread()); + lazyInitialize(); + RefPtr<AudioBufferSourceNode> node = AudioBufferSourceNode::create(this, m_destinationNode->sampleRate()); + + refNode(node.get()); // context keeps reference until source has finished playing + return node; +} + +PassRefPtr<JavaScriptAudioNode> AudioContext::createJavaScriptNode(size_t bufferSize) +{ + ASSERT(isMainThread()); + lazyInitialize(); + RefPtr<JavaScriptAudioNode> node = JavaScriptAudioNode::create(this, m_destinationNode->sampleRate(), bufferSize); + + refNode(node.get()); // context keeps reference until we stop making javascript rendering callbacks + return node; +} + +PassRefPtr<LowPass2FilterNode> AudioContext::createLowPass2Filter() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return LowPass2FilterNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<HighPass2FilterNode> AudioContext::createHighPass2Filter() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return HighPass2FilterNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<AudioPannerNode> AudioContext::createPanner() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return AudioPannerNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<ConvolverNode> AudioContext::createConvolver() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return ConvolverNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<RealtimeAnalyserNode> AudioContext::createAnalyser() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return RealtimeAnalyserNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<AudioGainNode> AudioContext::createGainNode() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return AudioGainNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<DelayNode> AudioContext::createDelayNode() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return DelayNode::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<AudioChannelSplitter> AudioContext::createChannelSplitter() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return AudioChannelSplitter::create(this, m_destinationNode->sampleRate()); +} + +PassRefPtr<AudioChannelMerger> AudioContext::createChannelMerger() +{ + ASSERT(isMainThread()); + lazyInitialize(); + return AudioChannelMerger::create(this, m_destinationNode->sampleRate()); +} + +void AudioContext::notifyNodeFinishedProcessing(AudioNode* node) +{ + ASSERT(isAudioThread()); + m_finishedNodes.append(node); +} + +void AudioContext::derefFinishedSourceNodes() +{ + ASSERT(isGraphOwner()); + ASSERT(isAudioThread() || isAudioThreadFinished()); + for (unsigned i = 0; i < m_finishedNodes.size(); i++) + derefNode(m_finishedNodes[i]); + + m_finishedNodes.clear(); +} + +void AudioContext::refNode(AudioNode* node) +{ + ASSERT(isMainThread()); + AutoLocker locker(this); + + node->ref(AudioNode::RefTypeConnection); + m_referencedNodes.append(node); +} + +void AudioContext::derefNode(AudioNode* node) +{ + ASSERT(isGraphOwner()); + + node->deref(AudioNode::RefTypeConnection); + + for (unsigned i = 0; i < m_referencedNodes.size(); ++i) { + if (node == m_referencedNodes[i]) { + m_referencedNodes.remove(i); + break; + } + } +} + +void AudioContext::derefUnfinishedSourceNodes() +{ + ASSERT(isMainThread() && isAudioThreadFinished()); + for (unsigned i = 0; i < m_referencedNodes.size(); ++i) + m_referencedNodes[i]->deref(AudioNode::RefTypeConnection); + + m_referencedNodes.clear(); +} + +void AudioContext::lock(bool& mustReleaseLock) +{ + // Don't allow regular lock in real-time audio thread. + ASSERT(isMainThread()); + + ThreadIdentifier thisThread = currentThread(); + + if (thisThread == m_graphOwnerThread) { + // We already have the lock. + mustReleaseLock = false; + } else { + // Acquire the lock. + m_contextGraphMutex.lock(); + mustReleaseLock = true; + } + + m_graphOwnerThread = thisThread; +} + +bool AudioContext::tryLock(bool& mustReleaseLock) +{ + ThreadIdentifier thisThread = currentThread(); + bool isAudioThread = thisThread == audioThread(); + + // Try to catch cases of using try lock on main thread - it should use regular lock. + ASSERT(isAudioThread || isAudioThreadFinished()); + + if (!isAudioThread) { + // In release build treat tryLock() as lock() (since above ASSERT(isAudioThread) never fires) - this is the best we can do. + lock(mustReleaseLock); + return true; + } + + bool hasLock; + + if (thisThread == m_graphOwnerThread) { + // Thread already has the lock. + hasLock = true; + mustReleaseLock = false; + } else { + // Don't already have the lock - try to acquire it. + hasLock = m_contextGraphMutex.tryLock(); + + if (hasLock) + m_graphOwnerThread = thisThread; + + mustReleaseLock = hasLock; + } + + return hasLock; +} + +void AudioContext::unlock() +{ + ASSERT(currentThread() == m_graphOwnerThread); + + m_graphOwnerThread = UndefinedThreadIdentifier; + m_contextGraphMutex.unlock(); +} + +bool AudioContext::isAudioThread() +{ + return currentThread() == m_audioThread; +} + +bool AudioContext::isGraphOwner() +{ + return currentThread() == m_graphOwnerThread; +} + +void AudioContext::addDeferredFinishDeref(AudioNode* node, AudioNode::RefType refType) +{ + ASSERT(isAudioThread()); + m_deferredFinishDerefList.append(AudioContext::RefInfo(node, refType)); +} + +void AudioContext::handlePostRenderTasks() +{ + ASSERT(isAudioThread()); + + // Must use a tryLock() here too. Don't worry, the lock will very rarely be contended and this method is called frequently. + // The worst that can happen is that there will be some nodes which will take slightly longer than usual to be deleted or removed + // from the render graph (in which case they'll render silence). + bool mustReleaseLock; + if (tryLock(mustReleaseLock)) { + // Take care of finishing any derefs where the tryLock() failed previously. + handleDeferredFinishDerefs(); + + // Dynamically clean up nodes which are no longer needed. + derefFinishedSourceNodes(); + + // Finally actually delete. + deleteMarkedNodes(); + + if (mustReleaseLock) + unlock(); + } +} + +void AudioContext::handleDeferredFinishDerefs() +{ + ASSERT(isAudioThread()); + for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) { + AudioNode* node = m_deferredFinishDerefList[i].m_node; + AudioNode::RefType refType = m_deferredFinishDerefList[i].m_refType; + node->finishDeref(refType); + } + + m_deferredFinishDerefList.clear(); +} + +void AudioContext::markForDeletion(AudioNode* node) +{ + ASSERT(isGraphOwner()); + m_nodesToDelete.append(node); +} + +void AudioContext::deleteMarkedNodes() +{ + ASSERT(isGraphOwner() || isAudioThreadFinished()); + + // Note: deleting an AudioNode can cause m_nodesToDelete to grow. + while (size_t n = m_nodesToDelete.size()) { + AudioNode* node = m_nodesToDelete[n - 1]; + m_nodesToDelete.removeLast(); + delete node; + } +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/webaudio/AudioContext.h b/WebCore/webaudio/AudioContext.h new file mode 100644 index 0000000..f175bfe --- /dev/null +++ b/WebCore/webaudio/AudioContext.h @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AudioContext_h +#define AudioContext_h + +#include "ActiveDOMObject.h" +#include "AudioBus.h" +#include "AudioDestinationNode.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/Threading.h> +#include <wtf/Vector.h> +#include <wtf/text/AtomicStringHash.h> + +namespace WebCore { + +class AudioBuffer; +class AudioBufferSourceNode; +class AudioChannelMerger; +class AudioChannelSplitter; +class AudioGainNode; +class AudioPannerNode; +class AudioListener; +class CachedAudio; +class DelayNode; +class Document; +class LowPass2FilterNode; +class HighPass2FilterNode; +class ConvolverNode; +class RealtimeAnalyserNode; +class JavaScriptAudioNode; + +// AudioContext is the cornerstone of the web audio API and all AudioNodes are created from it. +// For thread safety between the audio thread and the main thread, it has a rendering graph locking mechanism. + +class AudioContext : public ActiveDOMObject, public RefCounted<AudioContext> { +public: + static PassRefPtr<AudioContext> create(Document*); + + virtual ~AudioContext(); + + bool isInitialized() const; + + // Returns true when initialize() was called AND all asynchronous initialization has completed. + bool isRunnable() const; + + // Document notification + virtual void stop(); + + Document* document(); // ASSERTs if document no longer exists. + bool hasDocument(); + + AudioDestinationNode* destination() { return m_destinationNode.get(); } + double currentTime() { return m_destinationNode->currentTime(); } + double sampleRate() { return m_destinationNode->sampleRate(); } + + PassRefPtr<AudioBuffer> createBuffer(unsigned numberOfChannels, size_t numberOfFrames, double sampleRate); + + PassRefPtr<CachedAudio> createAudioRequest(const String &url, bool mixToMono); + + // Keep track of this buffer so we can release memory after the context is shut down... + void refBuffer(PassRefPtr<AudioBuffer> buffer); + + AudioListener* listener() { return m_listener.get(); } + + // The AudioNode create methods are called on the main thread (from JavaScript). + PassRefPtr<AudioBufferSourceNode> createBufferSource(); + PassRefPtr<AudioGainNode> createGainNode(); + PassRefPtr<DelayNode> createDelayNode(); + PassRefPtr<LowPass2FilterNode> createLowPass2Filter(); + PassRefPtr<HighPass2FilterNode> createHighPass2Filter(); + PassRefPtr<AudioPannerNode> createPanner(); + PassRefPtr<ConvolverNode> createConvolver(); + PassRefPtr<RealtimeAnalyserNode> createAnalyser(); + PassRefPtr<JavaScriptAudioNode> createJavaScriptNode(size_t bufferSize); + PassRefPtr<AudioChannelSplitter> createChannelSplitter(); + PassRefPtr<AudioChannelMerger> createChannelMerger(); + + AudioBus* temporaryMonoBus() { return m_temporaryMonoBus.get(); } + AudioBus* temporaryStereoBus() { return m_temporaryStereoBus.get(); } + + // When a source node has no more processing to do (has finished playing), then it tells the context to dereference it. + void notifyNodeFinishedProcessing(AudioNode*); + + // Called at the end of each render quantum. + void handlePostRenderTasks(); + + // Called periodically at the end of each render quantum to dereference finished source nodes. + void derefFinishedSourceNodes(); + + // We reap all marked nodes at the end of each realtime render quantum in deleteMarkedNodes(). + void markForDeletion(AudioNode*); + void deleteMarkedNodes(); + + // Keeps track of the number of connections made. + void incrementConnectionCount() + { + ASSERT(isMainThread()); + m_connectionCount++; + } + + unsigned connectionCount() const { return m_connectionCount; } + + // + // Thread Safety and Graph Locking: + // + + void setAudioThread(ThreadIdentifier thread) { m_audioThread = thread; } // FIXME: check either not initialized or the same + ThreadIdentifier audioThread() const { return m_audioThread; } + bool isAudioThread(); + + // Returns true only after the audio thread has been started and then shutdown. + bool isAudioThreadFinished() { return m_isAudioThreadFinished; } + + // mustReleaseLock is set to true if we acquired the lock in this method call and caller must unlock(), false if it was previously acquired. + void lock(bool& mustReleaseLock); + + // Returns true if we own the lock. + // mustReleaseLock is set to true if we acquired the lock in this method call and caller must unlock(), false if it was previously acquired. + bool tryLock(bool& mustReleaseLock); + + void unlock(); + + // Returns true if this thread owns the context's lock. + bool isGraphOwner(); + + class AutoLocker { + public: + AutoLocker(AudioContext* context) + : m_context(context) + { + ASSERT(context); + context->lock(m_mustReleaseLock); + } + + ~AutoLocker() + { + if (m_mustReleaseLock) + m_context->unlock(); + } + private: + AudioContext* m_context; + bool m_mustReleaseLock; + }; + + // In AudioNode::deref() a tryLock() is used for calling finishDeref(), but if it fails keep track here. + void addDeferredFinishDeref(AudioNode*, AudioNode::RefType); + + // In the audio thread at the start of each render cycle, we'll call handleDeferredFinishDerefs(). + void handleDeferredFinishDerefs(); + +private: + AudioContext(Document*); + void lazyInitialize(); + void uninitialize(); + + bool m_isInitialized; + bool m_isAudioThreadFinished; + bool m_isAudioThreadShutdown; + + Document* m_document; + + // The context itself keeps a reference to all source nodes. The source nodes, then reference all nodes they're connected to. + // In turn, these nodes reference all nodes they're connected to. All nodes are ultimately connected to the AudioDestinationNode. + // When the context dereferences a source node, it will be deactivated from the rendering graph along with all other nodes it is + // uniquely connected to. See the AudioNode::ref() and AudioNode::deref() methods for more details. + void refNode(AudioNode*); + void derefNode(AudioNode*); + + // When the context goes away, there might still be some sources which haven't finished playing. + // Make sure to dereference them here. + void derefUnfinishedSourceNodes(); + + RefPtr<AudioDestinationNode> m_destinationNode; + RefPtr<AudioListener> m_listener; + + // Only accessed in the main thread. + Vector<RefPtr<AudioBuffer> > m_allocatedBuffers; + + // Only accessed in the audio thread. + Vector<AudioNode*> m_finishedNodes; + + // We don't use RefPtr<AudioNode> here because AudioNode has a more complex ref() / deref() implementation + // with an optional argument for refType. We need to use the special refType: RefTypeConnection + // Either accessed when the graph lock is held, or on the main thread when the audio thread has finished. + Vector<AudioNode*> m_referencedNodes; + + // Accumulate nodes which need to be deleted at the end of a render cycle (in realtime thread) here. + Vector<AudioNode*> m_nodesToDelete; + + Vector<RefPtr<CachedAudio> > m_cachedAudioReferences; + + OwnPtr<AudioBus> m_temporaryMonoBus; + OwnPtr<AudioBus> m_temporaryStereoBus; + + unsigned m_connectionCount; + + // Graph locking. + Mutex m_contextGraphMutex; + volatile ThreadIdentifier m_audioThread; + volatile ThreadIdentifier m_graphOwnerThread; // if the lock is held then this is the thread which owns it, otherwise == UndefinedThreadIdentifier + + // Deferred de-referencing. + struct RefInfo { + RefInfo(AudioNode* node, AudioNode::RefType refType) + : m_node(node) + , m_refType(refType) + { + } + AudioNode* m_node; + AudioNode::RefType m_refType; + }; + + // Only accessed in the audio thread. + Vector<RefInfo> m_deferredFinishDerefList; +}; + +} // WebCore + +#endif // AudioContext_h diff --git a/WebCore/webaudio/AudioContext.idl b/WebCore/webaudio/AudioContext.idl new file mode 100644 index 0000000..8951121 --- /dev/null +++ b/WebCore/webaudio/AudioContext.idl @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module webaudio { + interface [ + Conditional=WEB_AUDIO, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor + ] AudioContext { + // All rendered audio ultimately connects to destination, which represents the audio hardware. + readonly attribute AudioDestinationNode destination; + + // All scheduled times are relative to this time in seconds. + readonly attribute float currentTime; + + // All AudioNodes in the context run at this sample-rate (in sample-frames per second). + readonly attribute float sampleRate; + + // All panning is relative to this listener. + readonly attribute AudioListener listener; + + AudioBuffer createBuffer(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate); + + // Source + AudioBufferSourceNode createBufferSource(); + + // Processing nodes + AudioGainNode createGainNode(); + DelayNode createDelayNode(); + LowPass2FilterNode createLowPass2Filter(); + HighPass2FilterNode createHighPass2Filter(); + AudioPannerNode createPanner(); + ConvolverNode createConvolver(); + RealtimeAnalyserNode createAnalyser(); + JavaScriptAudioNode createJavaScriptNode(in unsigned long bufferSize); + + // Channel splitting and merging + AudioChannelSplitter createChannelSplitter(); + AudioChannelMerger createChannelMerger(); + + // FIXME: Temporary - to be replaced with XHR. + CachedAudio createAudioRequest(in DOMString url, in boolean mixToMono); + }; +} diff --git a/WebCore/webaudio/AudioDestinationNode.cpp b/WebCore/webaudio/AudioDestinationNode.cpp new file mode 100644 index 0000000..82f5145 --- /dev/null +++ b/WebCore/webaudio/AudioDestinationNode.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "AudioDestinationNode.h" + +#include "AudioBus.h" +#include "AudioContext.h" +#include "AudioNodeInput.h" +#include "AudioNodeOutput.h" +#include <wtf/Threading.h> + +namespace WebCore { + +AudioDestinationNode::AudioDestinationNode(AudioContext* context) + : AudioNode(context, AudioDestination::hardwareSampleRate()) + , m_currentTime(0.0) +{ + addInput(adoptPtr(new AudioNodeInput(this))); + + setType(NodeTypeDestination); + + initialize(); +} + +AudioDestinationNode::~AudioDestinationNode() +{ + uninitialize(); +} + +void AudioDestinationNode::initialize() +{ + if (isInitialized()) + return; + + double hardwareSampleRate = AudioDestination::hardwareSampleRate(); +#ifndef NDEBUG + fprintf(stderr, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate); +#endif + + m_destination = AudioDestination::create(*this, hardwareSampleRate); + m_destination->start(); + + m_isInitialized = true; +} + +void AudioDestinationNode::uninitialize() +{ + if (!isInitialized()) + return; + + m_destination->stop(); + + m_isInitialized = false; +} + +// The audio hardware calls us back here to gets its input stream. +void AudioDestinationNode::provideInput(AudioBus* destinationBus, size_t numberOfFrames) +{ + context()->setAudioThread(currentThread()); + + if (!context()->isRunnable()) { + destinationBus->zero(); + return; + } + + // This will cause the node(s) connected to us to process, which in turn will pull on their input(s), + // all the way backwards through the rendering graph. + AudioBus* renderedBus = input(0)->pull(destinationBus, numberOfFrames); + + if (!renderedBus) + destinationBus->zero(); + else if (renderedBus != destinationBus) { + // in-place processing was not possible - so copy + destinationBus->copyFrom(*renderedBus); + } + + // Let the context take care of any business at the end of each render quantum. + context()->handlePostRenderTasks(); + + // Advance current time. + m_currentTime += numberOfFrames / sampleRate(); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/webaudio/AudioDestinationNode.h b/WebCore/webaudio/AudioDestinationNode.h new file mode 100644 index 0000000..b130518 --- /dev/null +++ b/WebCore/webaudio/AudioDestinationNode.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AudioDestinationNode_h +#define AudioDestinationNode_h + +#include "AudioDestination.h" +#include "AudioNode.h" +#include "AudioSourceProvider.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +class AudioBus; +class AudioContext; + +class AudioDestinationNode : public AudioNode, public AudioSourceProvider { +public: + static PassRefPtr<AudioDestinationNode> create(AudioContext* context) + { + return adoptRef(new AudioDestinationNode(context)); + } + + virtual ~AudioDestinationNode(); + + // AudioNode + virtual void process(size_t) { }; // we're pulled by hardware so this is never called + virtual void reset() { m_currentTime = 0.0; }; + virtual void initialize(); + virtual void uninitialize(); + + // The audio hardware calls here periodically to gets its input stream. + virtual void provideInput(AudioBus*, size_t numberOfFrames); + + double currentTime() { return m_currentTime; } + + double sampleRate() const { return m_destination->sampleRate(); } + + unsigned numberOfChannels() const { return 2; } // FIXME: update when multi-channel (more than stereo) is supported + +private: + AudioDestinationNode(AudioContext*); + + OwnPtr<AudioDestination> m_destination; + double m_currentTime; +}; + +} // namespace WebCore + +#endif // AudioDestinationNode_h diff --git a/WebCore/webaudio/AudioDestinationNode.idl b/WebCore/webaudio/AudioDestinationNode.idl new file mode 100644 index 0000000..1d2a235 --- /dev/null +++ b/WebCore/webaudio/AudioDestinationNode.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module audio { + interface [ + Conditional=WEB_AUDIO, + GenerateToJS + ] AudioDestinationNode : AudioNode { + readonly attribute long numberOfChannels; + }; +} diff --git a/WebCore/webaudio/AudioGain.h b/WebCore/webaudio/AudioGain.h new file mode 100644 index 0000000..eb3c52d --- /dev/null +++ b/WebCore/webaudio/AudioGain.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AudioGain_h +#define AudioGain_h + +#include "AudioParam.h" +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +class AudioGain : public AudioParam { +public: + static PassRefPtr<AudioGain> create(const char* name, double defaultValue, double minValue, double maxValue) + { + return adoptRef(new AudioGain(name, defaultValue, minValue, maxValue)); + } + +private: + AudioGain(const char* name, double defaultValue, double minValue, double maxValue) + : AudioParam(name, defaultValue, minValue, maxValue) + { + } +}; + +} // namespace WebCore + +#endif // AudioParam_h diff --git a/WebCore/webaudio/AudioGain.idl b/WebCore/webaudio/AudioGain.idl new file mode 100644 index 0000000..ead7c9a --- /dev/null +++ b/WebCore/webaudio/AudioGain.idl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module audio { + interface [ + Conditional=WEB_AUDIO, + GenerateToJS + ] AudioGain : AudioParam { + }; +} diff --git a/WebCore/webaudio/AudioNode.cpp b/WebCore/webaudio/AudioNode.cpp new file mode 100644 index 0000000..497ac95 --- /dev/null +++ b/WebCore/webaudio/AudioNode.cpp @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#include "AudioNode.h" + +#include "AudioContext.h" +#include "AudioNodeInput.h" +#include "AudioNodeOutput.h" +#include <wtf/Atomics.h> + +namespace WebCore { + +AudioNode::AudioNode(AudioContext* context, double sampleRate) + : m_isInitialized(false) + , m_type(NodeTypeUnknown) + , m_context(context) + , m_sampleRate(sampleRate) + , m_lastProcessingTime(-1.0) + , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefCounted class) + , m_connectionRefCount(0) + , m_disabledRefCount(0) + , m_isMarkedForDeletion(false) + , m_isDisabled(false) +{ +#if DEBUG_AUDIONODE_REFERENCES + if (!s_isNodeCountInitialized) { + s_isNodeCountInitialized = true; + atexit(AudioNode::printNodeCounts); + } +#endif +} + +AudioNode::~AudioNode() +{ +#if DEBUG_AUDIONODE_REFERENCES + --s_nodeCount[type()]; + printf("%p: %d: AudioNode::~AudioNode() %d %d %d\n", this, type(), m_normalRefCount, m_connectionRefCount, m_disabledRefCount); +#endif +} + +void AudioNode::setType(NodeType type) +{ + m_type = type; + +#if DEBUG_AUDIONODE_REFERENCES + ++s_nodeCount[type]; +#endif +} + +void AudioNode::lazyInitialize() +{ + if (!isInitialized()) + initialize(); +} + +void AudioNode::addInput(PassOwnPtr<AudioNodeInput> input) +{ + m_inputs.append(input); +} + +void AudioNode::addOutput(PassOwnPtr<AudioNodeOutput> output) +{ + m_outputs.append(output); +} + +AudioNodeInput* AudioNode::input(unsigned i) +{ + return m_inputs[i].get(); +} + +AudioNodeOutput* AudioNode::output(unsigned i) +{ + return m_outputs[i].get(); +} + +bool AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex) +{ + ASSERT(isMainThread()); + AudioContext::AutoLocker locker(context()); + + // Sanity check input and output indices. + if (outputIndex >= numberOfOutputs()) + return false; + if (destination && inputIndex >= destination->numberOfInputs()) + return false; + + AudioNodeOutput* output = this->output(outputIndex); + if (!destination) { + // Disconnect output from any inputs it may be currently connected to. + output->disconnectAllInputs(); + return true; + } + + AudioNodeInput* input = destination->input(inputIndex); + input->connect(output); + + // Let context know that a connection has been made. + context()->incrementConnectionCount(); + + return true; +} + +bool AudioNode::disconnect(unsigned outputIndex) +{ + ASSERT(isMainThread()); + AudioContext::AutoLocker locker(context()); + + return connect(0, outputIndex); +} + +void AudioNode::processIfNecessary(size_t framesToProcess) +{ + ASSERT(context()->isAudioThread()); + + if (!isInitialized()) + return; + + // Ensure that we only process once per rendering quantum. + // This handles the "fanout" problem where an output is connected to multiple inputs. + // The first time we're called during this time slice we process, but after that we don't want to re-process, + // instead our output(s) will already have the results cached in their bus; + double currentTime = context()->currentTime(); + if (m_lastProcessingTime != currentTime) { + m_lastProcessingTime = currentTime; // important to first update this time because of feedback loops in the rendering graph + pullInputs(framesToProcess); + process(framesToProcess); + } +} + +void AudioNode::pullInputs(size_t framesToProcess) +{ + ASSERT(context()->isAudioThread()); + + // Process all of the AudioNodes connected to our inputs. + for (unsigned i = 0; i < m_inputs.size(); ++i) + input(i)->pull(0, framesToProcess); +} + +void AudioNode::ref(RefType refType) +{ + switch (refType) { + case RefTypeNormal: + atomicIncrement(&m_normalRefCount); + break; + case RefTypeConnection: + atomicIncrement(&m_connectionRefCount); + break; + case RefTypeDisabled: + atomicIncrement(&m_disabledRefCount); + break; + default: + ASSERT_NOT_REACHED(); + } + +#if DEBUG_AUDIONODE_REFERENCES + printf("%p: %d: AudioNode::ref(%d) %d %d %d\n", this, type(), refType, m_normalRefCount, m_connectionRefCount, m_disabledRefCount); +#endif + + if (m_connectionRefCount == 1 && refType == RefTypeConnection) { + // FIXME: implement wake-up - this is an advanced feature and is not necessary in a simple implementation. + // We should not be "actively" connected to anything, but now we're "waking up" + // For example, a note which has finished playing, but is now being played again. + // Note that if this is considered a worthwhile feature to add, then an evaluation of the locking considerations must be made. + } +} + +void AudioNode::deref(RefType refType) +{ + // The actually work for deref happens completely within the audio context's graph lock. + // In the case of the audio thread, we must use a tryLock to avoid glitches. + bool hasLock = false; + bool mustReleaseLock = false; + + if (context()->isAudioThread()) { + // Real-time audio thread must not contend lock (to avoid glitches). + hasLock = context()->tryLock(mustReleaseLock); + } else { + context()->lock(mustReleaseLock); + hasLock = true; + } + + if (hasLock) { + // This is where the real deref work happens. + finishDeref(refType); + + if (mustReleaseLock) + context()->unlock(); + } else { + // We were unable to get the lock, so put this in a list to finish up later. + ASSERT(context()->isAudioThread()); + context()->addDeferredFinishDeref(this, refType); + } + + // Once AudioContext::uninitialize() is called there's no more chances for deleteMarkedNodes() to get called, so we call here. + // We can't call in AudioContext::~AudioContext() since it will never be called as long as any AudioNode is alive + // because AudioNodes keep a reference to the context. + if (context()->isAudioThreadFinished()) + context()->deleteMarkedNodes(); +} + +void AudioNode::finishDeref(RefType refType) +{ + ASSERT(context()->isGraphOwner()); + + switch (refType) { + case RefTypeNormal: + ASSERT(m_normalRefCount > 0); + atomicDecrement(&m_normalRefCount); + break; + case RefTypeConnection: + ASSERT(m_connectionRefCount > 0); + atomicDecrement(&m_connectionRefCount); + break; + case RefTypeDisabled: + ASSERT(m_disabledRefCount > 0); + atomicDecrement(&m_disabledRefCount); + break; + default: + ASSERT_NOT_REACHED(); + } + +#if DEBUG_AUDIONODE_REFERENCES + printf("%p: %d: AudioNode::deref(%d) %d %d %d\n", this, type(), refType, m_normalRefCount, m_connectionRefCount, m_disabledRefCount); +#endif + + if (!m_connectionRefCount) { + if (!m_normalRefCount && !m_disabledRefCount) { + if (!m_isMarkedForDeletion) { + // All references are gone - we need to go away. + for (unsigned i = 0; i < m_outputs.size(); ++i) + output(i)->disconnectAllInputs(); // this will deref() nodes we're connected to... + + // Mark for deletion at end of each render quantum or when context shuts down. + context()->markForDeletion(this); + m_isMarkedForDeletion = true; + } + } else if (refType == RefTypeConnection) { + if (!m_isDisabled) { + // Still may have JavaScript references, but no more "active" connection references, so put all of our outputs in a "dormant" disabled state. + // Garbage collection may take a very long time after this time, so the "dormant" disabled nodes should not bog down the rendering... + + // As far as JavaScript is concerned, our outputs must still appear to be connected. + // But internally our outputs should be disabled from the inputs they're connected to. + // disable() can recursively deref connections (and call disable()) down a whole chain of connected nodes. + + // FIXME: we special case the convolver and delay since they have a significant tail-time and shouldn't be disconnected simply + // because they no longer have any input connections. This needs to be handled more generally where AudioNodes have + // a tailTime attribute. Then the AudioNode only needs to remain "active" for tailTime seconds after there are no + // longer any active connections. + if (type() != NodeTypeConvolver && type() != NodeTypeDelay) { + m_isDisabled = true; + for (unsigned i = 0; i < m_outputs.size(); ++i) + output(i)->disable(); + } + } + } + } +} + +#if DEBUG_AUDIONODE_REFERENCES + +bool AudioNode::s_isNodeCountInitialized = false; +int AudioNode::s_nodeCount[NodeTypeEnd]; + +void AudioNode::printNodeCounts() +{ + printf("\n\n"); + printf("===========================\n"); + printf("AudioNode: reference counts\n"); + printf("===========================\n"); + + for (unsigned i = 0; i < NodeTypeEnd; ++i) + printf("%d: %d\n", i, s_nodeCount[i]); + + printf("===========================\n\n\n"); +} + +#endif // DEBUG_AUDIONODE_REFERENCES + +} // namespace WebCore + +#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/webaudio/AudioNode.h b/WebCore/webaudio/AudioNode.h new file mode 100644 index 0000000..b697457 --- /dev/null +++ b/WebCore/webaudio/AudioNode.h @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AudioNode_h +#define AudioNode_h + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +#define DEBUG_AUDIONODE_REFERENCES 0 + +namespace WebCore { + +class AudioContext; +class AudioNodeInput; +class AudioNodeOutput; + +// An AudioNode is the basic building block for handling audio within an AudioContext. +// It may be an audio source, an intermediate processing module, or an audio destination. +// Each AudioNode can have inputs and/or outputs. An AudioSourceNode has no inputs and a single output. +// An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware. +// Most processing nodes such as filters will have one input and one output, although multiple inputs and outputs are possible. + +class AudioNode { +public: + enum { ProcessingSizeInFrames = 128 }; + + AudioNode(AudioContext*, double sampleRate); + virtual ~AudioNode(); + + AudioContext* context() { return m_context.get(); } + + enum NodeType { + NodeTypeUnknown, + NodeTypeDestination, + NodeTypeAudioBufferSource, + NodeTypeJavaScript, + NodeTypeLowPass2Filter, + NodeTypeHighPass2Filter, + NodeTypePanner, + NodeTypeConvolver, + NodeTypeDelay, + NodeTypeGain, + NodeTypeChannelSplitter, + NodeTypeChannelMerger, + NodeTypeAnalyser, + NodeTypeEnd + }; + + NodeType type() const { return m_type; } + void setType(NodeType); + + // We handle our own ref-counting because of the threading issues and subtle nature of + // how AudioNodes can continue processing (playing one-shot sound) after there are no more + // JavaScript references to the object. + enum RefType { RefTypeNormal, RefTypeConnection, RefTypeDisabled }; + + // Can be called from main thread or context's audio thread. + void ref(RefType refType = RefTypeNormal); + void deref(RefType refType = RefTypeNormal); + + // Can be called from main thread or context's audio thread. It must be called while the context's graph lock is held. + void finishDeref(RefType refType); + + // The AudioNodeInput(s) (if any) will already have their input data available when process() is called. + // Subclasses will take this input data and put the results in the AudioBus(s) of its AudioNodeOutput(s) (if any). + // Called from context's audio thread. + virtual void process(size_t framesToProcess) = 0; + + // Resets DSP processing state (clears delay lines, filter memory, etc.) + // Called from context's audio thread. + virtual void reset() = 0; + + // No significant resources should be allocated until initialize() is called. + // Processing may not occur until a node is initialized. + virtual void initialize() = 0; + virtual void uninitialize() = 0; + + bool isInitialized() const { return m_isInitialized; } + void lazyInitialize(); + + unsigned numberOfInputs() const { return m_inputs.size(); } + unsigned numberOfOutputs() const { return m_outputs.size(); } + + AudioNodeInput* input(unsigned); + AudioNodeOutput* output(unsigned); + + // connect() / disconnect() return true on success. + // Called from main thread by corresponding JavaScript methods. + bool connect(AudioNode* destination, unsigned outputIndex = 0, unsigned inputIndex = 0); + bool disconnect(unsigned outputIndex = 0); + + double sampleRate() const { return m_sampleRate; } + + // processIfNecessary() is called by our output(s) when the rendering graph needs this AudioNode to process. + // This method ensures that the AudioNode will only process once per rendering time quantum even if it's called repeatedly. + // This handles the case of "fanout" where an output is connected to multiple AudioNode inputs. + // Called from context's audio thread. + void processIfNecessary(size_t framesToProcess); + + // Called when a new connection has been made to one of our inputs or the connection number of channels has changed. + // This potentially gives us enough information to perform a lazy initialization or, if necessary, a re-initialization. + // Called from main thread. + virtual void checkNumberOfChannelsForInput(AudioNodeInput*) { } + +#if DEBUG_AUDIONODE_REFERENCES + static void printNodeCounts(); +#endif + +protected: + // Inputs and outputs must be created before the AudioNode is initialized. + void addInput(PassOwnPtr<AudioNodeInput>); + void addOutput(PassOwnPtr<AudioNodeOutput>); + + // Called by processIfNecessary() to cause all parts of the rendering graph connected to us to process. + // Each rendering quantum, the audio data for each of the AudioNode's inputs will be available after this method is called. + // Called from context's audio thread. + virtual void pullInputs(size_t framesToProcess); + + bool m_isInitialized; + +private: + NodeType m_type; + RefPtr<AudioContext> m_context; + double m_sampleRate; + Vector<OwnPtr<AudioNodeInput> > m_inputs; + Vector<OwnPtr<AudioNodeOutput> > m_outputs; + + double m_lastProcessingTime; + + // Ref-counting + volatile int m_normalRefCount; + volatile int m_connectionRefCount; + volatile int m_disabledRefCount; + + bool m_isMarkedForDeletion; + bool m_isDisabled; + +#if DEBUG_AUDIONODE_REFERENCES + static bool s_isNodeCountInitialized; + static int s_nodeCount[NodeTypeEnd]; +#endif +}; + +} // namespace WebCore + +#endif // AudioNode_h diff --git a/WebCore/webaudio/AudioNode.idl b/WebCore/webaudio/AudioNode.idl new file mode 100644 index 0000000..5ed47cb --- /dev/null +++ b/WebCore/webaudio/AudioNode.idl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module audio { + interface [ + Conditional=WEB_AUDIO + ] AudioNode { + readonly attribute AudioContext context; + readonly attribute unsigned long numberOfInputs; + readonly attribute unsigned long numberOfOutputs; + + [Custom] void connect(in AudioNode destination, in unsigned long output, in unsigned long input); + [Custom] void disconnect(in unsigned long output); + }; +} diff --git a/WebCore/webaudio/AudioParam.h b/WebCore/webaudio/AudioParam.h index 2fbd805..7643cf3 100644 --- a/WebCore/webaudio/AudioParam.h +++ b/WebCore/webaudio/AudioParam.h @@ -60,7 +60,14 @@ public: } float value() const { return static_cast<float>(m_value); } - void setValue(float value) { m_value = value; } + + void setValue(float value) + { + // Check against JavaScript giving us bogus floating-point values. + // Don't ASSERT, since this can happen if somebody writes bad JS. + if (!isnan(value) && !isinf(value)) + m_value = value; + } String name() const { return m_name; } diff --git a/WebCore/wml/WMLElement.cpp b/WebCore/wml/WMLElement.cpp index 5c8a94c..9b0be47 100644 --- a/WebCore/wml/WMLElement.cpp +++ b/WebCore/wml/WMLElement.cpp @@ -26,6 +26,7 @@ #include "Attribute.h" #include "CSSPropertyNames.h" #include "HTMLNames.h" +#include "HTMLParserIdioms.h" #include "RenderObject.h" #include "WMLErrorHandling.h" #include "WMLNames.h" @@ -73,7 +74,7 @@ void WMLElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == HTMLNames::tabindexAttr) { String indexstring = attr->value(); int tabindex = 0; - if (parseHTMLInteger(tabindex)) { + if (parseHTMLInteger(indexstring, tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } diff --git a/WebCore/workers/WorkerContext.cpp b/WebCore/workers/WorkerContext.cpp index b52b285..6cee246 100644 --- a/WebCore/workers/WorkerContext.cpp +++ b/WebCore/workers/WorkerContext.cpp @@ -63,6 +63,16 @@ #include "NotificationCenter.h" #endif +#if ENABLE(FILE_SYSTEM) +#include "AsyncFileSystem.h" +#include "DOMFileSystem.h" +#include "ErrorCallback.h" +#include "FileError.h" +#include "FileSystemCallback.h" +#include "FileSystemCallbacks.h" +#include "LocalFileSystem.h" +#endif + namespace WebCore { class CloseWorkerContextTask : public ScriptExecutionContext::Task { @@ -100,6 +110,10 @@ WorkerContext::~WorkerContext() #if ENABLE(NOTIFICATIONS) m_notifications.clear(); #endif + + // Make sure we have no observers. + notifyObserversOfStop(); + // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this. thread()->workerReportingProxy().workerContextDestroyed(); } @@ -335,6 +349,74 @@ void WorkerContext::revokeBlobURL(const String& blobURLString) } #endif +#if ENABLE(FILE_SYSTEM) +void WorkerContext::requestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +{ + if (!AsyncFileSystem::isAvailable() || !securityOrigin()->canAccessFileSystem()) { + DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(SECURITY_ERR)); + return; + } + + AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type); + if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) { + DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(INVALID_MODIFICATION_ERR)); + return; + } + + LocalFileSystem::localFileSystem().requestFileSystem(this, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, this)); +} + +COMPILE_ASSERT(static_cast<int>(WorkerContext::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch); +COMPILE_ASSERT(static_cast<int>(WorkerContext::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch); +#endif + +WorkerContext::Observer::Observer(WorkerContext* context) + : m_context(context) +{ + ASSERT(m_context && m_context->isContextThread()); + m_context->registerObserver(this); +} + +WorkerContext::Observer::~Observer() +{ + if (!m_context) + return; + ASSERT(m_context->isContextThread()); + m_context->unregisterObserver(this); +} + +void WorkerContext::Observer::stopObserving() +{ + if (!m_context) + return; + ASSERT(m_context->isContextThread()); + m_context->unregisterObserver(this); + m_context = 0; +} + +void WorkerContext::registerObserver(Observer* observer) +{ + ASSERT(observer); + m_workerObservers.add(observer); +} + +void WorkerContext::unregisterObserver(Observer* observer) +{ + ASSERT(observer); + m_workerObservers.remove(observer); +} + +void WorkerContext::notifyObserversOfStop() +{ + HashSet<Observer*>::iterator iter = m_workerObservers.begin(); + while (iter != m_workerObservers.end()) { + WorkerContext::Observer* observer = *iter; + observer->stopObserving(); + observer->notifyStop(); + iter = m_workerObservers.begin(); + } +} + } // namespace WebCore #endif // ENABLE(WORKERS) diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index 7fb8b46..4128a56 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -35,6 +35,7 @@ #include "ScriptExecutionContext.h" #include "WorkerScriptController.h" #include <wtf/Assertions.h> +#include <wtf/HashMap.h> #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -47,6 +48,8 @@ namespace WebCore { class Database; class DatabaseCallback; class DatabaseSync; + class ErrorCallback; + class FileSystemCallback; class NotificationCenter; class ScheduledAction; class WorkerLocation; @@ -121,6 +124,14 @@ namespace WebCore { void revokeBlobURL(const String&); #endif +#if ENABLE(FILE_SYSTEM) + enum FileSystemType { + TEMPORARY, + PERSISTENT, + }; + void requestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>); +#endif + // These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in // JSWorkerContextCustom.cpp. WorkerNavigator* optionalNavigator() const { return m_navigator.get(); } @@ -131,6 +142,21 @@ namespace WebCore { bool isClosing() { return m_closing; } + // An observer interface to be notified when the worker thread is getting stopped. + class Observer : public Noncopyable { + public: + Observer(WorkerContext*); + virtual ~Observer(); + virtual void notifyStop() = 0; + void stopObserving(); + private: + WorkerContext* m_context; + }; + friend class Observer; + void registerObserver(Observer*); + void unregisterObserver(Observer*); + void notifyObserversOfStop(); + protected: WorkerContext(const KURL&, const String&, WorkerThread*); @@ -161,6 +187,8 @@ namespace WebCore { bool m_closing; bool m_reportingException; EventTargetData m_eventTargetData; + + HashSet<Observer*> m_workerObservers; }; } // namespace WebCore diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl index 02aa4ad..3e185c0 100644 --- a/WebCore/workers/WorkerContext.idl +++ b/WebCore/workers/WorkerContext.idl @@ -104,6 +104,14 @@ module threads { DOMString createBlobURL(in Blob blob); void revokeBlobURL(in DOMString blobURL); #endif + +#if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM + const unsigned short TEMPORARY = 0; + const unsigned short PERSISTENT = 1; + [EnabledAtRuntime] void requestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + + attribute [EnabledAtRuntime=FileSystem] FlagsConstructor Flags; +#endif }; } diff --git a/WebCore/workers/WorkerThread.cpp b/WebCore/workers/WorkerThread.cpp index d6a1e05..f61120e 100644 --- a/WebCore/workers/WorkerThread.cpp +++ b/WebCore/workers/WorkerThread.cpp @@ -202,6 +202,8 @@ public: workerContext->stopActiveDOMObjects(); + workerContext->notifyObserversOfStop(); + // Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects, // which become dangling once Heap is destroyed. workerContext->removeAllEventListeners(); diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index 9c7d076..07a816d 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -115,7 +115,7 @@ static bool isValidToken(const String& name) return false; } - return true; + return length > 0; } static bool isValidHeaderValue(const String& name) diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h index ac18828..481b51f 100644 --- a/WebCore/xml/XMLHttpRequest.h +++ b/WebCore/xml/XMLHttpRequest.h @@ -65,6 +65,7 @@ public: virtual ScriptExecutionContext* scriptExecutionContext() const; + const KURL& url() const { return m_url; } String statusText(ExceptionCode&) const; int status(ExceptionCode&) const; State readyState() const; |