Changeset 207521 in webkit
- Timestamp:
- Oct 18, 2016 10:25:06 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207519 r207521 1 2016-10-18 Darin Adler <darin@apple.com> 2 3 Move internal testing classes from ExceptionCode to Exception 4 https://bugs.webkit.org/show_bug.cgi?id=163553 5 6 Reviewed by Ryosuke Niwa. 7 8 * bindings/js/JSDOMBinding.h: Added toJSArray. Also exported a function that 9 is now needed in the testing library. 10 * bindings/scripts/CodeGeneratorJS.pm: 11 (NativeToJSValue): Added code to handle the jsArray case with an exception. 12 13 * css/parser/CSSPropertyParser.cpp: Fix #if to make code compile when 14 CSS_SCROLL_SNAP is not enabled. 15 16 * dom/Element.cpp: 17 (WebCore::Element::createShadowRoot): Changed return type to a raw pointer. 18 There is no reason it needs to be a RefPtr. 19 * dom/Element.h: Updated for above change. 20 21 * svg/SVGPathStringBuilder.h: Exported class and made more public so it can 22 be used in test code. 23 24 * svg/SVGPathUtilities.cpp: 25 (WebCore::pathIteratorForBuildingString): Deleted. Needed only for test code, 26 so moved into there. 27 (WebCore::buildStringFromPath): Deleted. Ditto. 28 * svg/SVGPathUtilities.h: Removed buildStringFromPath. 29 30 * testing/InternalSettings.cpp: Simplified the guard macro and used the all 31 capitals style that our style guide prescribes for non-function-like macros. 32 (WebCore::InternalSettings::create): Moved here, no longer inline Use m_page. 33 (WebCore::InternalSettings::resetToConsistentState): Updated since settings 34 returns a reference. 35 (WebCore::InternalSettings::settings): Changed to return a reference and 36 assert that m_page is not null; functions all check m_page for null first. 37 (WebCore::InternalSettings::setTouchEventEmulationEnabled): Updated to use 38 ExceptionOr, do an m_page check, and use settings that returns a reference. 39 (WebCore::InternalSettings::setStandardFontFamily): Ditto. 40 (WebCore::InternalSettings::setSerifFontFamily): Ditto. 41 (WebCore::InternalSettings::setSansSerifFontFamily): Ditto. 42 (WebCore::InternalSettings::setFixedFontFamily): Ditto. 43 (WebCore::InternalSettings::setCursiveFontFamily): Ditto. 44 (WebCore::InternalSettings::setFantasyFontFamily): Ditto. 45 (WebCore::InternalSettings::setPictographFontFamily): Ditto. 46 (WebCore::InternalSettings::setTextAutosizingEnabled): Ditto. 47 (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride): Ditto. 48 (WebCore::InternalSettings::setMediaTypeOverride): Ditto. 49 (WebCore::InternalSettings::setCanStartMedia): Ditto. 50 (WebCore::InternalSettings::setAllowsAirPlayForMediaPlayback): Ditto. 51 (WebCore::InternalSettings::setEditingBehavior): Ditto. 52 (WebCore::InternalSettings::setShouldDisplayTrackKind): Ditto. 53 (WebCore::InternalSettings::shouldDisplayTrackKind): Ditto. 54 (WebCore::InternalSettings::setStorageBlockingPolicy): Ditto. 55 (WebCore::InternalSettings::setPreferMIMETypeForImages): Ditto. 56 (WebCore::InternalSettings::setImagesEnabled): Ditto. 57 (WebCore::InternalSettings::setPDFImageCachingPolicy): Ditto. 58 (WebCore::InternalSettings::setMinimumTimerInterval): Ditto. 59 (WebCore::InternalSettings::setDefaultVideoPosterURL): Ditto. 60 (WebCore::InternalSettings::setForcePendingWebGLPolicy): Ditto. 61 (WebCore::InternalSettings::setTimeWithoutMouseMovementBeforeHidingControls): Ditto. 62 (WebCore::InternalSettings::setUseLegacyBackgroundSizeShorthandBehavior): Ditto. 63 (WebCore::InternalSettings::setAutoscrollForDragAndDropEnabled): Ditto. 64 (WebCore::InternalSettings::setFontFallbackPrefersPictographs): Ditto. 65 (WebCore::InternalSettings::setWebFontsAlwaysFallBack): Ditto. 66 (WebCore::InternalSettings::setQuickTimePluginReplacementEnabled): Ditto. 67 (WebCore::InternalSettings::setYouTubeFlashPluginReplacementEnabled): Ditto. 68 (WebCore::InternalSettings::setBackgroundShouldExtendBeyondPage): Ditto. 69 (WebCore::InternalSettings::setShouldConvertPositionStyleOnCopy): Ditto. 70 (WebCore::InternalSettings::setScrollingTreeIncludesFrames): Ditto. 71 (WebCore::InternalSettings::setAllowsInlineMediaPlayback): Ditto. 72 (WebCore::InternalSettings::setAllowsInlineMediaPlaybackAfterFullscreen): Ditto. 73 (WebCore::InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute): Ditto. 74 (WebCore::InternalSettings::setIndexedDBWorkersEnabled): Ditto. 75 (WebCore::InternalSettings::userInterfaceDirectionPolicy): Ditto. 76 (WebCore::InternalSettings::setUserInterfaceDirectionPolicy): Ditto. 77 (WebCore::InternalSettings::systemLayoutDirection): Ditto. 78 (WebCore::InternalSettings::setSystemLayoutDirection): Ditto. 79 (WebCore::InternalSettings::variationFontsEnabled): Ditto. 80 (WebCore::InternalSettings::setVariationFontsEnabled): Ditto. 81 (WebCore::InternalSettings::forcedPrefersReducedMotionValue): Ditto. 82 (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): Ditto. 83 * testing/InternalSettings.h: Updated for above changes. Also moved Backup to make 84 it private instead of public. 85 * testing/InternalSettings.idl: Use non-legacy execption. Also removed unneeded 86 exception for setIndexedDBWorkersEnabled. 87 88 * testing/Internals.cpp: Marked InspectorStubFrontend final and made everything private. 89 (WebCore::Internals::setCanShowModalDialogOverride): Use ExceptionOr. 90 (WebCore::Internals::lastSpatialNavigationCandidateCount): Ditto. 91 (WebCore::Internals::animationsAreSuspended): Ditto. 92 (WebCore::Internals::suspendAnimations): Ditto. 93 (WebCore::Internals::resumeAnimations): Ditto. 94 (WebCore::Internals::pauseAnimationAtTimeOnElement): Ditto. 95 (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement): Ditto. 96 (WebCore::Internals::pauseTransitionAtTimeOnElement): Ditto. 97 (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement): Ditto. 98 (WebCore::Internals::elementRenderTreeAsText): Ditto. 99 (WebCore::Internals::ensureShadowRoot): Ditto. 100 (WebCore::Internals::createShadowRoot): Ditto. 101 (WebCore::Internals::shadowRootType): Ditto. 102 (WebCore::Internals::isTimerThrottled): Ditto. 103 (WebCore::Internals::formControlStateOfPreviousHistoryItem): Ditto. 104 (WebCore::Internals::setFormControlStateOfPreviousHistoryItem): Ditto. 105 (WebCore::Internals::absoluteCaretBounds): Ditto. 106 (WebCore::Internals::inspectorHighlightRects): Ditto. 107 (WebCore::Internals::inspectorHighlightObject): Ditto. 108 (WebCore::Internals::markerCountForNode): Ditto. 109 (WebCore::Internals::markerAt): Ditto. 110 (WebCore::Internals::markerRangeForNode): Ditto. 111 (WebCore::Internals::markerDescriptionForNode): Ditto. 112 (WebCore::Internals::dumpMarkerRects): Ditto. 113 (WebCore::Internals::setMarkedTextMatchesAreHighlighted): Ditto. 114 (WebCore::Internals::setScrollViewPosition): Ditto. 115 (WebCore::Internals::setViewBaseBackgroundColor): Ditto. 116 (WebCore::Internals::setPagination): Ditto. 117 (WebCore::Internals::setPaginationLineGridEnabled): Ditto. 118 (WebCore::Internals::configurationForViewport): Ditto. 119 (WebCore::Internals::wasLastChangeUserEdit): Ditto. 120 (WebCore::Internals::scrollElementToRect): Ditto. 121 (WebCore::Internals::autofillFieldName): Ditto. 122 (WebCore::Internals::paintControlTints): Ditto. 123 (WebCore::Internals::rangeForDictionaryLookupAtLocation): Ditto. 124 (WebCore::Internals::setDelegatesScrolling): Ditto. 125 (WebCore::Internals::lastSpellCheckRequestSequence): Ditto. 126 (WebCore::Internals::lastSpellCheckProcessedSequence): Ditto. 127 (WebCore::Internals::wheelEventHandlerCount): Ditto. 128 (WebCore::Internals::touchEventHandlerCount): Ditto. 129 (WebCore::Internals::nodesFromRect): Ditto. 130 (WebCore::Internals::setBatteryStatus): Ditto. 131 (WebCore::Internals::setDeviceProximity): Ditto. 132 (WebCore::Internals::hasSpellingMarker): Ditto. 133 (WebCore::Internals::hasAutocorrectedMarker): Ditto. 134 (WebCore::Internals::handleAcceptedCandidate): Ditto. 135 (WebCore::Internals::isOverwriteModeEnabled): Ditto. 136 (WebCore::Internals::toggleOverwriteModeEnabled): Ditto. 137 (WebCore::Internals::countMatchesForText): Ditto. 138 (WebCore::Internals::countFindMatches): Ditto. 139 (WebCore::Internals::setInspectorIsUnderTest): Ditto. 140 (WebCore::Internals::hasGrammarMarker): Ditto. 141 (WebCore::Internals::numberOfScrollableAreas): Ditto. 142 (WebCore::Internals::isPageBoxVisible): Ditto. 143 (WebCore::Internals::layerTreeAsText): Ditto. 144 (WebCore::Internals::repaintRectsAsText): Ditto. 145 (WebCore::Internals::scrollingStateTreeAsText): Ditto. 146 (WebCore::Internals::mainThreadScrollingReasons): Ditto. 147 (WebCore::Internals::nonFastScrollableRects): Ditto. 148 (WebCore::Internals::setElementUsesDisplayListDrawing): Ditto. 149 (WebCore::Internals::setElementTracksDisplayListReplay): Ditto. 150 (WebCore::Internals::displayListForElement): Ditto. 151 (WebCore::Internals::replayDisplayListForElement): Ditto. 152 (WebCore::Internals::garbageCollectDocumentResources): Ditto. 153 (WebCore::Internals::insertAuthorCSS): Ditto. 154 (WebCore::Internals::insertUserCSS): Ditto. 155 (WebCore::Internals::pageProperty): Ditto. 156 (WebCore::Internals::pageSizeAndMarginsInPixels): Ditto. 157 (WebCore::Internals::setPageScaleFactor): Ditto. 158 (WebCore::Internals::setPageZoomFactor): Ditto. 159 (WebCore::Internals::setTextZoomFactor): Ditto. 160 (WebCore::Internals::setUseFixedLayout): Ditto. 161 (WebCore::Internals::setFixedLayoutSize): Ditto. 162 (WebCore::Internals::setViewExposedRect): Ditto. 163 (WebCore::Internals::setHeaderHeight): Ditto. 164 (WebCore::Internals::setFooterHeight): Ditto. 165 (WebCore::Internals::setTopContentInset): Ditto. 166 (WebCore::Internals::setApplicationCacheOriginQuota): Ditto. 167 (WebCore::Internals::startTrackingRepaints): Ditto. 168 (WebCore::Internals::stopTrackingRepaints): Ditto. 169 (WebCore::Internals::startTrackingLayerFlushes): Ditto. 170 (WebCore::Internals::layerFlushCount): Ditto. 171 (WebCore::Internals::startTrackingStyleRecalcs): Ditto. 172 (WebCore::Internals::styleRecalcCount): Ditto. 173 (WebCore::Internals::startTrackingCompositingUpdates): Ditto. 174 (WebCore::Internals::compositingUpdateCount): Ditto. 175 (WebCore::Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks): Ditto. 176 (WebCore::Internals::getCurrentCursorInfo): Ditto. 177 (WebCore::Internals::mediaElementHasCharacteristic): Ditto. 178 (WebCore::Internals::captionsStyleSheetOverride): Ditto. 179 (WebCore::Internals::setCaptionsStyleSheetOverride): Ditto. 180 (WebCore::Internals::setPrimaryAudioTrackLanguageOverride): Ditto. 181 (WebCore::Internals::setCaptionDisplayMode): Ditto. 182 (WebCore::Internals::selectionBounds): Ditto. 183 (WebCore::Internals::isVibrating): Ditto. 184 (WebCore::Internals::isPluginUnavailabilityIndicatorObscured): Ditto. 185 (WebCore::Internals::beginMediaSessionInterruption): Ditto. 186 (WebCore::Internals::setMediaSessionRestrictions): Ditto. 187 (WebCore::Internals::postRemoteControlCommand): Ditto. 188 (WebCore::Internals::setMockMediaPlaybackTargetPickerState): Ditto. 189 (WebCore::Internals::installMockPageOverlay): Ditto. 190 (WebCore::Internals::pageOverlayLayerTreeAsText): Ditto. 191 (WebCore::Internals::scrollSnapOffsets): Ditto. 192 (WebCore::Internals::pathStringWithShrinkWrappedRects): Moved the code that builds 193 the path string in here for now since it's only used for this testing. 194 (WebCore::Internals::resourceLoadStatisticsForOrigin): Take a const String&. 195 196 * testing/Internals.h: Updated for above changes. 197 * testing/Internals.idl: Use non-legacy exceptions. 198 1 199 2016-10-18 Chris Dumez <cdumez@apple.com> 2 200 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r207396 r207521 197 197 198 198 // Implementation details of the above. 199 void propagateExceptionSlowPath(JSC::ExecState&, JSC::ThrowScope&, Exception&&);199 WEBCORE_EXPORT void propagateExceptionSlowPath(JSC::ExecState&, JSC::ThrowScope&, Exception&&); 200 200 WEBCORE_EXPORT void setDOMExceptionSlow(JSC::ExecState*, JSC::ThrowScope&, ExceptionCode); 201 201 … … 413 413 void propagateException(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<void>&&); 414 414 template<typename T> JSC::JSValue toJS(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<T>&&); 415 template<typename T> JSC::JSValue toJSArray(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<T>&&); 415 416 JSC::JSValue toJSBoolean(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<bool>&&); 416 417 JSC::JSValue toJSDate(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<double>&&); … … 930 931 } 931 932 932 inline JSC::JSValue toJSBoolean(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<bool>&& value)933 template<typename T> inline JSC::JSValue toJSArray(JSC::ExecState& state, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, ExceptionOr<T>&& value) 933 934 { 934 935 if (UNLIKELY(value.hasException())) { … … 936 937 return { }; 937 938 } 938 return JSC::jsBoolean(value.releaseReturnValue());939 } 940 941 template<typename T> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState& state, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, ExceptionOr<T>&& value)939 return jsArray(&state, &globalObject, value.releaseReturnValue()); 940 } 941 942 inline JSC::JSValue toJSBoolean(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<bool>&& value) 942 943 { 943 944 if (UNLIKELY(value.hasException())) { … … 945 946 return { }; 946 947 } 947 return toJSNewlyCreated(&state, &globalObject,value.releaseReturnValue());948 } 949 950 inline JSC::JSValue toJSNullableString(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<String>&& value)948 return JSC::jsBoolean(value.releaseReturnValue()); 949 } 950 951 template<typename T> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState& state, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, ExceptionOr<T>&& value) 951 952 { 952 953 if (UNLIKELY(value.hasException())) { … … 954 955 return { }; 955 956 } 956 return jsStringOrNull(&state, value.releaseReturnValue());957 } 958 959 template<typename T> inline JSC::JSValue toJSNumber(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<T>&& value)957 return toJSNewlyCreated(&state, &globalObject, value.releaseReturnValue()); 958 } 959 960 inline JSC::JSValue toJSNullableString(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<String>&& value) 960 961 { 961 962 if (UNLIKELY(value.hasException())) { … … 963 964 return { }; 964 965 } 965 return JSC::jsNumber(value.releaseReturnValue());966 } 967 968 inline JSC::JSValue toJSString(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<String>&& value)966 return jsStringOrNull(&state, value.releaseReturnValue()); 967 } 968 969 template<typename T> inline JSC::JSValue toJSNumber(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<T>&& value) 969 970 { 970 971 if (UNLIKELY(value.hasException())) { … … 972 973 return { }; 973 974 } 975 return JSC::jsNumber(value.releaseReturnValue()); 976 } 977 978 inline JSC::JSValue toJSString(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<String>&& value) 979 { 980 if (UNLIKELY(value.hasException())) { 981 propagateException(state, throwScope, value.releaseException()); 982 return { }; 983 } 974 984 return JSC::jsStringWithCache(&state, value.releaseReturnValue()); 975 985 } -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r207519 r207521 5254 5254 my $innerType = $codeGenerator->GetSequenceOrFrozenArrayInnerType($type); 5255 5255 AddToImplIncludes("JS${innerType}.h", $conditional) if $codeGenerator->IsRefPtrType($innerType); 5256 return "jsArray($statePointer, $globalObject, $value)" if $codeGenerator->IsSequenceType($type); 5257 return "jsFrozenArray($statePointer, $globalObject, $value)" if $codeGenerator->IsFrozenArrayType($type); 5256 my $isSequence = $codeGenerator->IsSequenceType($type); 5257 return "toJSArray($stateReference, *$globalObject, throwScope, $value)" if $isSequence && $mayThrowException; 5258 return "jsArray($statePointer, $globalObject, $value)" if $isSequence; 5259 return "jsFrozenArray($statePointer, $globalObject, $value)";; 5258 5260 } 5259 5261 -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r207513 r207521 1892 1892 } 1893 1893 1894 #if ENABLE(CSS_SCROLL_SNAP) 1895 1894 1896 static RefPtr<CSSValueList> consumePositionList(CSSParserTokenRange& range, CSSParserMode cssParserMode) 1895 1897 { … … 1904 1906 } 1905 1907 1906 #if ENABLE(CSS_SCROLL_SNAP)1907 1908 static RefPtr<CSSValue> consumeScrollSnapCoordinate(CSSParserTokenRange& range, CSSParserMode cssParserMode) 1908 1909 { … … 1927 1928 return nullptr; 1928 1929 } 1930 1929 1931 #endif 1930 1932 -
trunk/Source/WebCore/dom/Element.cpp
r207458 r207521 1801 1801 } 1802 1802 1803 RefPtr<ShadowRoot>Element::createShadowRoot(ExceptionCode& ec)1803 ShadowRoot* Element::createShadowRoot(ExceptionCode& ec) 1804 1804 { 1805 1805 if (alwaysCreateUserAgentShadowRoot()) 1806 ensureUserAgentShadowRoot();1806 return &ensureUserAgentShadowRoot(); 1807 1807 1808 1808 ec = HIERARCHY_REQUEST_ERR; -
trunk/Source/WebCore/dom/Element.h
r207458 r207521 268 268 269 269 WEBCORE_EXPORT ShadowRoot* shadowRoot() const; 270 WEBCORE_EXPORT RefPtr<ShadowRoot>createShadowRoot(ExceptionCode&);270 WEBCORE_EXPORT ShadowRoot* createShadowRoot(ExceptionCode&); 271 271 272 272 enum class ShadowRootMode { Open, Closed }; -
trunk/Source/WebCore/svg/SVGPathStringBuilder.h
r197563 r207521 19 19 */ 20 20 21 #ifndef SVGPathStringBuilder_h 22 #define SVGPathStringBuilder_h 21 #pragma once 23 22 24 23 #include "SVGPathConsumer.h" … … 29 28 class SVGPathStringBuilder final : public SVGPathConsumer { 30 29 public: 31 SVGPathStringBuilder();32 ~SVGPathStringBuilder();30 WEBCORE_EXPORT SVGPathStringBuilder(); 31 WEBCORE_EXPORT virtual ~SVGPathStringBuilder(); 33 32 34 String result(); 33 WEBCORE_EXPORT String result(); 34 35 void incrementPathSegmentCount() final; 36 bool continueConsuming() final; 37 38 // Used in UnalteredParsing/NormalizedParsing modes. 39 WEBCORE_EXPORT void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) final; 40 WEBCORE_EXPORT void lineTo(const FloatPoint&, PathCoordinateMode) final; 41 WEBCORE_EXPORT void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode) final; 42 WEBCORE_EXPORT void closePath() final; 43 44 // Only used in UnalteredParsing mode. 45 void lineToHorizontal(float, PathCoordinateMode) final; 46 void lineToVertical(float, PathCoordinateMode) final; 47 void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) final; 48 WEBCORE_EXPORT void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) final; 49 void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) final; 50 void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode) final; 35 51 36 52 private: 37 void incrementPathSegmentCount() override;38 bool continueConsuming() override;39 40 // Used in UnalteredParsing/NormalizedParsing modes.41 void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) override;42 void lineTo(const FloatPoint&, PathCoordinateMode) override;43 void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode) override;44 void closePath() override;45 46 // Only used in UnalteredParsing mode.47 void lineToHorizontal(float, PathCoordinateMode) override;48 void lineToVertical(float, PathCoordinateMode) override;49 void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) override;50 void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) override;51 void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) override;52 void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode) override;53 54 53 StringBuilder m_stringBuilder; 55 54 }; 56 55 57 56 } // namespace WebCore 58 59 #endif // SVGPathStringBuilder_h -
trunk/Source/WebCore/svg/SVGPathUtilities.cpp
r194496 r207521 208 208 } 209 209 210 static void pathIteratorForBuildingString(SVGPathConsumer& consumer, const PathElement& pathElement) 211 { 212 switch (pathElement.type) { 213 case PathElementMoveToPoint: 214 consumer.moveTo(pathElement.points[0], false, AbsoluteCoordinates); 215 break; 216 case PathElementAddLineToPoint: 217 consumer.lineTo(pathElement.points[0], AbsoluteCoordinates); 218 break; 219 case PathElementAddQuadCurveToPoint: 220 consumer.curveToQuadratic(pathElement.points[0], pathElement.points[1], AbsoluteCoordinates); 221 break; 222 case PathElementAddCurveToPoint: 223 consumer.curveToCubic(pathElement.points[0], pathElement.points[1], pathElement.points[2], AbsoluteCoordinates); 224 break; 225 case PathElementCloseSubpath: 226 consumer.closePath(); 227 break; 228 229 default: 230 ASSERT_NOT_REACHED(); 231 break; 232 } 233 } 234 235 bool buildStringFromPath(const Path& path, String& string) 236 { 237 // Ideally we would have a SVGPathPlatformPathSource, but it's not possible to manually iterate 238 // a path, only apply a function to all path elements at once. 239 240 SVGPathStringBuilder builder; 241 path.apply([&builder](const PathElement& pathElement) { 242 pathIteratorForBuildingString(builder, pathElement); 243 }); 244 string = builder.result(); 245 246 return true; 247 } 248 249 } 210 } -
trunk/Source/WebCore/svg/SVGPathUtilities.h
r191551 r207521 19 19 */ 20 20 21 #ifndef SVGPathUtilities_h 22 #define SVGPathUtilities_h 21 #pragma once 23 22 24 23 #include "SVGPathConsumer.h" … … 59 58 bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&, float length, SVGPoint&); 60 59 61 // Path -> String62 WEBCORE_EXPORT bool buildStringFromPath(const Path&, String&);63 64 60 } // namespace WebCore 65 66 #endif // SVGPathUtilities_h -
trunk/Source/WebCore/testing/InternalSettings.cpp
r207183 r207521 46 46 #endif 47 47 48 #define InternalSettingsGuardForSettingsReturn(returnValue) \49 if (!settings()) { \50 ec = INVALID_ACCESS_ERR; \51 return returnValue; \52 }53 54 #define InternalSettingsGuardForSettings() \55 if (!settings()) { \56 ec = INVALID_ACCESS_ERR; \57 return; \58 }59 60 #define InternalSettingsGuardForPage() \61 if (!page()) { \62 ec = INVALID_ACCESS_ERR; \63 return; \64 }65 66 48 namespace WebCore { 67 49 … … 226 208 } 227 209 228 InternalSettings::~InternalSettings() 229 { 210 void InternalSettings::hostDestroyed() 211 { 212 m_page = nullptr; 230 213 } 231 214 … … 240 223 } 241 224 225 Ref<InternalSettings> InternalSettings::create(Page* page) 226 { 227 return adoptRef(*new InternalSettings(page)); 228 } 229 242 230 void InternalSettings::resetToConsistentState() 243 231 { 244 page()->setPageScaleFactor(1, { 0, 0 }); 245 page()->mainFrame().setPageAndTextZoomFactors(1, 1); 246 page()->setCanStartMedia(true); 247 page()->settings().setForcePendingWebGLPolicy(false); 232 m_page->setPageScaleFactor(1, { 0, 0 }); 233 m_page->mainFrame().setPageAndTextZoomFactors(1, 1); 234 m_page->setCanStartMedia(true); 235 236 settings().setForcePendingWebGLPolicy(false); 248 237 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 249 set AllowsAirPlayForMediaPlayback(false);250 #endif 251 252 m_backup.restoreTo( *settings());253 m_backup = Backup (*settings());238 settings().setAllowsAirPlayForMediaPlayback(false); 239 #endif 240 241 m_backup.restoreTo(settings()); 242 m_backup = Backup { settings() }; 254 243 255 244 InternalSettingsGenerated::resetToConsistentState(); 256 245 } 257 246 258 Settings* InternalSettings::settings() const 259 { 260 if (!page()) 261 return 0; 262 return &page()->settings(); 263 } 264 265 void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec) 266 { 247 Settings& InternalSettings::settings() const 248 { 249 ASSERT(m_page); 250 return m_page->settings(); 251 } 252 253 ExceptionOr<void> InternalSettings::setTouchEventEmulationEnabled(bool enabled) 254 { 255 if (!m_page) 256 return Exception { INVALID_ACCESS_ERR }; 267 257 #if ENABLE(TOUCH_EVENTS) 268 InternalSettingsGuardForSettings(); 269 settings()->setTouchEventEmulationEnabled(enabled); 258 settings().setTouchEventEmulationEnabled(enabled); 270 259 #else 271 260 UNUSED_PARAM(enabled); 272 UNUSED_PARAM(ec); 273 #endif 274 } 275 276 void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionCode& ec) 277 { 278 InternalSettingsGuardForSettings(); 261 #endif 262 return { }; 263 } 264 265 ExceptionOr<void> InternalSettings::setStandardFontFamily(const String& family, const String& script) 266 { 267 if (!m_page) 268 return Exception { INVALID_ACCESS_ERR }; 279 269 UScriptCode code = scriptNameToCode(script); 280 270 if (code == USCRIPT_INVALID_CODE) 281 return; 282 m_backup.m_standardFontFamilies.add(code, settings()->standardFontFamily(code)); 283 settings()->setStandardFontFamily(family, code); 284 } 285 286 void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionCode& ec) 287 { 288 InternalSettingsGuardForSettings(); 271 return { }; 272 m_backup.m_standardFontFamilies.add(code, settings().standardFontFamily(code)); 273 settings().setStandardFontFamily(family, code); 274 return { }; 275 } 276 277 ExceptionOr<void> InternalSettings::setSerifFontFamily(const String& family, const String& script) 278 { 279 if (!m_page) 280 return Exception { INVALID_ACCESS_ERR }; 289 281 UScriptCode code = scriptNameToCode(script); 290 282 if (code == USCRIPT_INVALID_CODE) 291 return; 292 m_backup.m_serifFontFamilies.add(code, settings()->serifFontFamily(code)); 293 settings()->setSerifFontFamily(family, code); 294 } 295 296 void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionCode& ec) 297 { 298 InternalSettingsGuardForSettings(); 283 return { }; 284 m_backup.m_serifFontFamilies.add(code, settings().serifFontFamily(code)); 285 settings().setSerifFontFamily(family, code); 286 return { }; 287 } 288 289 ExceptionOr<void> InternalSettings::setSansSerifFontFamily(const String& family, const String& script) 290 { 291 if (!m_page) 292 return Exception { INVALID_ACCESS_ERR }; 299 293 UScriptCode code = scriptNameToCode(script); 300 294 if (code == USCRIPT_INVALID_CODE) 301 return; 302 m_backup.m_sansSerifFontFamilies.add(code, settings()->sansSerifFontFamily(code)); 303 settings()->setSansSerifFontFamily(family, code); 304 } 305 306 void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionCode& ec) 307 { 308 InternalSettingsGuardForSettings(); 295 return { }; 296 m_backup.m_sansSerifFontFamilies.add(code, settings().sansSerifFontFamily(code)); 297 settings().setSansSerifFontFamily(family, code); 298 return { }; 299 } 300 301 ExceptionOr<void> InternalSettings::setFixedFontFamily(const String& family, const String& script) 302 { 303 if (!m_page) 304 return Exception { INVALID_ACCESS_ERR }; 309 305 UScriptCode code = scriptNameToCode(script); 310 306 if (code == USCRIPT_INVALID_CODE) 311 return; 312 m_backup.m_fixedFontFamilies.add(code, settings()->fixedFontFamily(code)); 313 settings()->setFixedFontFamily(family, code); 314 } 315 316 void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionCode& ec) 317 { 318 InternalSettingsGuardForSettings(); 307 return { }; 308 m_backup.m_fixedFontFamilies.add(code, settings().fixedFontFamily(code)); 309 settings().setFixedFontFamily(family, code); 310 return { }; 311 } 312 313 ExceptionOr<void> InternalSettings::setCursiveFontFamily(const String& family, const String& script) 314 { 315 if (!m_page) 316 return Exception { INVALID_ACCESS_ERR }; 319 317 UScriptCode code = scriptNameToCode(script); 320 318 if (code == USCRIPT_INVALID_CODE) 321 return; 322 m_backup.m_cursiveFontFamilies.add(code, settings()->cursiveFontFamily(code)); 323 settings()->setCursiveFontFamily(family, code); 324 } 325 326 void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionCode& ec) 327 { 328 InternalSettingsGuardForSettings(); 319 return { }; 320 m_backup.m_cursiveFontFamilies.add(code, settings().cursiveFontFamily(code)); 321 settings().setCursiveFontFamily(family, code); 322 return { }; 323 } 324 325 ExceptionOr<void> InternalSettings::setFantasyFontFamily(const String& family, const String& script) 326 { 327 if (!m_page) 328 return Exception { INVALID_ACCESS_ERR }; 329 329 UScriptCode code = scriptNameToCode(script); 330 330 if (code == USCRIPT_INVALID_CODE) 331 return; 332 m_backup.m_fantasyFontFamilies.add(code, settings()->fantasyFontFamily(code)); 333 settings()->setFantasyFontFamily(family, code); 334 } 335 336 void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec) 337 { 338 InternalSettingsGuardForSettings(); 331 return { }; 332 m_backup.m_fantasyFontFamilies.add(code, settings().fantasyFontFamily(code)); 333 settings().setFantasyFontFamily(family, code); 334 return { }; 335 } 336 337 ExceptionOr<void> InternalSettings::setPictographFontFamily(const String& family, const String& script) 338 { 339 if (!m_page) 340 return Exception { INVALID_ACCESS_ERR }; 339 341 UScriptCode code = scriptNameToCode(script); 340 342 if (code == USCRIPT_INVALID_CODE) 341 return; 342 m_backup.m_pictographFontFamilies.add(code, settings()->pictographFontFamily(code)); 343 settings()->setPictographFontFamily(family, code); 344 } 345 346 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec) 347 { 343 return { }; 344 m_backup.m_pictographFontFamilies.add(code, settings().pictographFontFamily(code)); 345 settings().setPictographFontFamily(family, code); 346 return { }; 347 } 348 349 ExceptionOr<void> InternalSettings::setTextAutosizingEnabled(bool enabled) 350 { 351 if (!m_page) 352 return Exception { INVALID_ACCESS_ERR }; 348 353 #if ENABLE(TEXT_AUTOSIZING) 349 InternalSettingsGuardForSettings(); 350 settings()->setTextAutosizingEnabled(enabled); 354 settings().setTextAutosizingEnabled(enabled); 351 355 #else 352 356 UNUSED_PARAM(enabled); 353 UNUSED_PARAM(ec); 354 #endif 355 } 356 357 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec) 358 { 357 #endif 358 return { }; 359 } 360 361 ExceptionOr<void> InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height) 362 { 363 if (!m_page) 364 return Exception { INVALID_ACCESS_ERR }; 359 365 #if ENABLE(TEXT_AUTOSIZING) 360 InternalSettingsGuardForSettings(); 361 settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height)); 366 settings().setTextAutosizingWindowSizeOverride(IntSize(width, height)); 362 367 #else 363 368 UNUSED_PARAM(width); 364 369 UNUSED_PARAM(height); 365 UNUSED_PARAM(ec); 366 #endif 367 } 368 369 void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionCode& ec) 370 { 371 InternalSettingsGuardForSettings(); 372 settings()->setMediaTypeOverride(mediaType); 373 } 374 375 void InternalSettings::setCanStartMedia(bool enabled, ExceptionCode& ec) 376 { 377 InternalSettingsGuardForSettings(); 370 #endif 371 return { }; 372 } 373 374 ExceptionOr<void> InternalSettings::setMediaTypeOverride(const String& mediaType) 375 { 376 if (!m_page) 377 return Exception { INVALID_ACCESS_ERR }; 378 settings().setMediaTypeOverride(mediaType); 379 return { }; 380 } 381 382 ExceptionOr<void> InternalSettings::setCanStartMedia(bool enabled) 383 { 384 if (!m_page) 385 return Exception { INVALID_ACCESS_ERR }; 378 386 m_page->setCanStartMedia(enabled); 379 } 380 381 void InternalSettings::setAllowsAirPlayForMediaPlayback(bool allows) 382 { 387 return { }; 388 } 389 390 ExceptionOr<void> InternalSettings::setAllowsAirPlayForMediaPlayback(bool allows) 391 { 392 if (!m_page) 393 return Exception { INVALID_ACCESS_ERR }; 383 394 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 384 m_page->settings().setAllowsAirPlayForMediaPlayback(allows);395 settings().setAllowsAirPlayForMediaPlayback(allows); 385 396 #else 386 397 UNUSED_PARAM(allows); 387 398 #endif 388 } 389 390 void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec) 391 { 392 InternalSettingsGuardForSettings(); 399 return { }; 400 } 401 402 ExceptionOr<void> InternalSettings::setEditingBehavior(const String& editingBehavior) 403 { 404 if (!m_page) 405 return Exception { INVALID_ACCESS_ERR }; 393 406 if (equalLettersIgnoringASCIICase(editingBehavior, "win")) 394 settings() ->setEditingBehaviorType(EditingWindowsBehavior);407 settings().setEditingBehaviorType(EditingWindowsBehavior); 395 408 else if (equalLettersIgnoringASCIICase(editingBehavior, "mac")) 396 settings() ->setEditingBehaviorType(EditingMacBehavior);409 settings().setEditingBehaviorType(EditingMacBehavior); 397 410 else if (equalLettersIgnoringASCIICase(editingBehavior, "unix")) 398 settings() ->setEditingBehaviorType(EditingUnixBehavior);411 settings().setEditingBehaviorType(EditingUnixBehavior); 399 412 else if (equalLettersIgnoringASCIICase(editingBehavior, "ios")) 400 settings() ->setEditingBehaviorType(EditingIOSBehavior);413 settings().setEditingBehaviorType(EditingIOSBehavior); 401 414 else 402 ec = SYNTAX_ERR; 403 } 404 405 void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec) 406 { 407 InternalSettingsGuardForSettings(); 408 415 return Exception { SYNTAX_ERR }; 416 return { }; 417 } 418 419 ExceptionOr<void> InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled) 420 { 421 if (!m_page) 422 return Exception { INVALID_ACCESS_ERR }; 409 423 #if ENABLE(VIDEO_TRACK) 410 if (!page()) 411 return; 412 413 auto& captionPreferences = page()->group().captionPreferences(); 424 auto& captionPreferences = m_page->group().captionPreferences(); 414 425 if (equalLettersIgnoringASCIICase(kind, "subtitles")) 415 426 captionPreferences.setUserPrefersSubtitles(enabled); … … 419 430 captionPreferences.setUserPrefersTextDescriptions(enabled); 420 431 else 421 ec = SYNTAX_ERR;432 return Exception { SYNTAX_ERR }; 422 433 #else 423 434 UNUSED_PARAM(kind); 424 435 UNUSED_PARAM(enabled); 425 436 #endif 426 } 427 428 bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec) 429 { 430 InternalSettingsGuardForSettingsReturn(false); 431 437 return { }; 438 } 439 440 ExceptionOr<bool> InternalSettings::shouldDisplayTrackKind(const String& kind) 441 { 442 if (!m_page) 443 return Exception { INVALID_ACCESS_ERR }; 432 444 #if ENABLE(VIDEO_TRACK) 433 if (!page()) 434 return false; 435 436 auto& captionPreferences = page()->group().captionPreferences(); 445 auto& captionPreferences = m_page->group().captionPreferences(); 437 446 if (equalLettersIgnoringASCIICase(kind, "subtitles")) 438 447 return captionPreferences.userPrefersSubtitles(); … … 442 451 return captionPreferences.userPrefersTextDescriptions(); 443 452 444 ec = SYNTAX_ERR; 445 return false; 453 return Exception { SYNTAX_ERR }; 446 454 #else 447 455 UNUSED_PARAM(kind); … … 450 458 } 451 459 452 void InternalSettings::setStorageBlockingPolicy(const String& mode, ExceptionCode& ec)453 { 454 InternalSettingsGuardForSettings();455 460 ExceptionOr<void> InternalSettings::setStorageBlockingPolicy(const String& mode) 461 { 462 if (!m_page) 463 return Exception { INVALID_ACCESS_ERR }; 456 464 if (mode == "AllowAll") 457 settings() ->setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage);465 settings().setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage); 458 466 else if (mode == "BlockThirdParty") 459 settings() ->setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage);467 settings().setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage); 460 468 else if (mode == "BlockAll") 461 settings() ->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage);469 settings().setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage); 462 470 else 463 ec = SYNTAX_ERR; 471 return Exception { SYNTAX_ERR }; 472 return { }; 464 473 } 465 474 … … 469 478 } 470 479 471 void InternalSettings::setPreferMIMETypeForImages(bool preferMIMETypeForImages, ExceptionCode &ec) 472 { 473 InternalSettingsGuardForSettings(); 474 settings()->setPreferMIMETypeForImages(preferMIMETypeForImages); 475 } 476 477 void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec) 478 { 479 InternalSettingsGuardForSettings(); 480 settings()->setImagesEnabled(enabled); 481 } 482 483 void InternalSettings::setPDFImageCachingPolicy(const String& policy, ExceptionCode& ec) 484 { 485 InternalSettingsGuardForSettings(); 480 ExceptionOr<void> InternalSettings::setPreferMIMETypeForImages(bool preferMIMETypeForImages) 481 { 482 if (!m_page) 483 return Exception { INVALID_ACCESS_ERR }; 484 settings().setPreferMIMETypeForImages(preferMIMETypeForImages); 485 return { }; 486 } 487 488 ExceptionOr<void> InternalSettings::setImagesEnabled(bool enabled) 489 { 490 if (!m_page) 491 return Exception { INVALID_ACCESS_ERR }; 492 settings().setImagesEnabled(enabled); 493 return { }; 494 } 495 496 ExceptionOr<void> InternalSettings::setPDFImageCachingPolicy(const String& policy) 497 { 498 if (!m_page) 499 return Exception { INVALID_ACCESS_ERR }; 486 500 if (equalLettersIgnoringASCIICase(policy, "disabled")) 487 settings() ->setPdfImageCachingPolicy(PDFImageCachingDisabled);501 settings().setPdfImageCachingPolicy(PDFImageCachingDisabled); 488 502 else if (equalLettersIgnoringASCIICase(policy, "belowmemorylimit")) 489 settings() ->setPdfImageCachingPolicy(PDFImageCachingBelowMemoryLimit);503 settings().setPdfImageCachingPolicy(PDFImageCachingBelowMemoryLimit); 490 504 else if (equalLettersIgnoringASCIICase(policy, "clipboundsonly")) 491 settings() ->setPdfImageCachingPolicy(PDFImageCachingClipBoundsOnly);505 settings().setPdfImageCachingPolicy(PDFImageCachingClipBoundsOnly); 492 506 else if (equalLettersIgnoringASCIICase(policy, "enabled")) 493 settings() ->setPdfImageCachingPolicy(PDFImageCachingEnabled);507 settings().setPdfImageCachingPolicy(PDFImageCachingEnabled); 494 508 else 495 ec = SYNTAX_ERR; 496 } 497 498 void InternalSettings::setMinimumTimerInterval(double intervalInSeconds, ExceptionCode& ec) 499 { 500 InternalSettingsGuardForSettings(); 501 settings()->setMinimumDOMTimerInterval(std::chrono::milliseconds((std::chrono::milliseconds::rep)(intervalInSeconds * 1000))); 502 } 503 504 void InternalSettings::setDefaultVideoPosterURL(const String& url, ExceptionCode& ec) 505 { 506 InternalSettingsGuardForSettings(); 507 settings()->setDefaultVideoPosterURL(url); 508 } 509 510 void InternalSettings::setForcePendingWebGLPolicy(bool forced, ExceptionCode& ec) 511 { 512 InternalSettingsGuardForSettings(); 513 settings()->setForcePendingWebGLPolicy(forced); 514 } 515 516 void InternalSettings::setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode& ec) 517 { 518 InternalSettingsGuardForSettings(); 519 settings()->setTimeWithoutMouseMovementBeforeHidingControls(time); 520 } 521 522 void InternalSettings::setUseLegacyBackgroundSizeShorthandBehavior(bool enabled, ExceptionCode& ec) 523 { 524 InternalSettingsGuardForSettings(); 525 settings()->setUseLegacyBackgroundSizeShorthandBehavior(enabled); 526 } 527 528 void InternalSettings::setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode& ec) 529 { 530 InternalSettingsGuardForSettings(); 531 settings()->setAutoscrollForDragAndDropEnabled(enabled); 532 } 533 534 void InternalSettings::setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode& ec) 535 { 536 InternalSettingsGuardForSettings(); 537 settings()->setFontFallbackPrefersPictographs(preferPictographs); 538 } 539 540 void InternalSettings::setWebFontsAlwaysFallBack(bool enable, ExceptionCode& ec) 541 { 542 InternalSettingsGuardForSettings(); 543 settings()->setWebFontsAlwaysFallBack(enable); 544 } 545 546 void InternalSettings::setQuickTimePluginReplacementEnabled(bool enabled, ExceptionCode& ec) 547 { 548 InternalSettingsGuardForSettings(); 549 settings()->setQuickTimePluginReplacementEnabled(enabled); 550 } 551 552 void InternalSettings::setYouTubeFlashPluginReplacementEnabled(bool enabled, ExceptionCode& ec) 553 { 554 InternalSettingsGuardForSettings(); 555 settings()->setYouTubeFlashPluginReplacementEnabled(enabled); 556 } 557 558 void InternalSettings::setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode& ec) 559 { 560 InternalSettingsGuardForSettings(); 561 settings()->setBackgroundShouldExtendBeyondPage(hasExtendedBackground); 562 } 563 564 void InternalSettings::setShouldConvertPositionStyleOnCopy(bool convert, ExceptionCode& ec) 565 { 566 InternalSettingsGuardForSettings(); 567 settings()->setShouldConvertPositionStyleOnCopy(convert); 568 } 569 570 void InternalSettings::setScrollingTreeIncludesFrames(bool enabled, ExceptionCode& ec) 571 { 572 InternalSettingsGuardForSettings(); 573 settings()->setScrollingTreeIncludesFrames(enabled); 574 } 575 576 void InternalSettings::setAllowsInlineMediaPlayback(bool allows, ExceptionCode& ec) 577 { 578 InternalSettingsGuardForSettings(); 579 settings()->setAllowsInlineMediaPlayback(allows); 580 } 581 582 void InternalSettings::setAllowsInlineMediaPlaybackAfterFullscreen(bool allows, ExceptionCode& ec) 583 { 584 InternalSettingsGuardForSettings(); 585 settings()->setAllowsInlineMediaPlaybackAfterFullscreen(allows); 586 } 587 588 void InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute(bool requires, ExceptionCode& ec) 589 { 590 InternalSettingsGuardForSettings(); 591 settings()->setInlineMediaPlaybackRequiresPlaysInlineAttribute(requires); 592 } 593 594 void InternalSettings::setIndexedDBWorkersEnabled(bool enabled, ExceptionCode&) 509 return Exception { SYNTAX_ERR }; 510 return { }; 511 } 512 513 ExceptionOr<void> InternalSettings::setMinimumTimerInterval(double intervalInSeconds) 514 { 515 if (!m_page) 516 return Exception { INVALID_ACCESS_ERR }; 517 settings().setMinimumDOMTimerInterval(std::chrono::milliseconds((std::chrono::milliseconds::rep)(intervalInSeconds * 1000))); 518 return { }; 519 } 520 521 ExceptionOr<void> InternalSettings::setDefaultVideoPosterURL(const String& url) 522 { 523 if (!m_page) 524 return Exception { INVALID_ACCESS_ERR }; 525 settings().setDefaultVideoPosterURL(url); 526 return { }; 527 } 528 529 ExceptionOr<void> InternalSettings::setForcePendingWebGLPolicy(bool forced) 530 { 531 if (!m_page) 532 return Exception { INVALID_ACCESS_ERR }; 533 settings().setForcePendingWebGLPolicy(forced); 534 return { }; 535 } 536 537 ExceptionOr<void> InternalSettings::setTimeWithoutMouseMovementBeforeHidingControls(double time) 538 { 539 if (!m_page) 540 return Exception { INVALID_ACCESS_ERR }; 541 settings().setTimeWithoutMouseMovementBeforeHidingControls(time); 542 return { }; 543 } 544 545 ExceptionOr<void> InternalSettings::setUseLegacyBackgroundSizeShorthandBehavior(bool enabled) 546 { 547 if (!m_page) 548 return Exception { INVALID_ACCESS_ERR }; 549 settings().setUseLegacyBackgroundSizeShorthandBehavior(enabled); 550 return { }; 551 } 552 553 ExceptionOr<void> InternalSettings::setAutoscrollForDragAndDropEnabled(bool enabled) 554 { 555 if (!m_page) 556 return Exception { INVALID_ACCESS_ERR }; 557 settings().setAutoscrollForDragAndDropEnabled(enabled); 558 return { }; 559 } 560 561 ExceptionOr<void> InternalSettings::setFontFallbackPrefersPictographs(bool preferPictographs) 562 { 563 if (!m_page) 564 return Exception { INVALID_ACCESS_ERR }; 565 settings().setFontFallbackPrefersPictographs(preferPictographs); 566 return { }; 567 } 568 569 ExceptionOr<void> InternalSettings::setWebFontsAlwaysFallBack(bool enable) 570 { 571 if (!m_page) 572 return Exception { INVALID_ACCESS_ERR }; 573 settings().setWebFontsAlwaysFallBack(enable); 574 return { }; 575 } 576 577 ExceptionOr<void> InternalSettings::setQuickTimePluginReplacementEnabled(bool enabled) 578 { 579 if (!m_page) 580 return Exception { INVALID_ACCESS_ERR }; 581 settings().setQuickTimePluginReplacementEnabled(enabled); 582 return { }; 583 } 584 585 ExceptionOr<void> InternalSettings::setYouTubeFlashPluginReplacementEnabled(bool enabled) 586 { 587 if (!m_page) 588 return Exception { INVALID_ACCESS_ERR }; 589 settings().setYouTubeFlashPluginReplacementEnabled(enabled); 590 return { }; 591 } 592 593 ExceptionOr<void> InternalSettings::setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground) 594 { 595 if (!m_page) 596 return Exception { INVALID_ACCESS_ERR }; 597 settings().setBackgroundShouldExtendBeyondPage(hasExtendedBackground); 598 return { }; 599 } 600 601 ExceptionOr<void> InternalSettings::setShouldConvertPositionStyleOnCopy(bool convert) 602 { 603 if (!m_page) 604 return Exception { INVALID_ACCESS_ERR }; 605 settings().setShouldConvertPositionStyleOnCopy(convert); 606 return { }; 607 } 608 609 ExceptionOr<void> InternalSettings::setScrollingTreeIncludesFrames(bool enabled) 610 { 611 if (!m_page) 612 return Exception { INVALID_ACCESS_ERR }; 613 settings().setScrollingTreeIncludesFrames(enabled); 614 return { }; 615 } 616 617 ExceptionOr<void> InternalSettings::setAllowsInlineMediaPlayback(bool allows) 618 { 619 if (!m_page) 620 return Exception { INVALID_ACCESS_ERR }; 621 settings().setAllowsInlineMediaPlayback(allows); 622 return { }; 623 } 624 625 ExceptionOr<void> InternalSettings::setAllowsInlineMediaPlaybackAfterFullscreen(bool allows) 626 { 627 if (!m_page) 628 return Exception { INVALID_ACCESS_ERR }; 629 settings().setAllowsInlineMediaPlaybackAfterFullscreen(allows); 630 return { }; 631 } 632 633 ExceptionOr<void> InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute(bool requires) 634 { 635 if (!m_page) 636 return Exception { INVALID_ACCESS_ERR }; 637 settings().setInlineMediaPlaybackRequiresPlaysInlineAttribute(requires); 638 return { }; 639 } 640 641 void InternalSettings::setIndexedDBWorkersEnabled(bool enabled) 595 642 { 596 643 #if ENABLE(INDEXED_DATABASE_IN_WORKERS) … … 601 648 } 602 649 603 String InternalSettings::userInterfaceDirectionPolicy(ExceptionCode& ec) 604 { 605 InternalSettingsGuardForSettingsReturn(""); 606 switch (settings()->userInterfaceDirectionPolicy()) { 650 ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy() 651 { 652 if (!m_page) 653 return Exception { INVALID_ACCESS_ERR }; 654 switch (settings().userInterfaceDirectionPolicy()) { 607 655 case UserInterfaceDirectionPolicy::Content: 608 return ASCIILiteral("Content");656 return String { ASCIILiteral { "Content" } }; 609 657 case UserInterfaceDirectionPolicy::System: 610 return ASCIILiteral("View");658 return String { ASCIILiteral { "View" } }; 611 659 } 612 660 ASSERT_NOT_REACHED(); 613 return String(); 614 } 615 616 void InternalSettings::setUserInterfaceDirectionPolicy(const String& policy, ExceptionCode& ec) 617 { 618 InternalSettingsGuardForSettings(); 661 return Exception { INVALID_ACCESS_ERR }; 662 } 663 664 ExceptionOr<void> InternalSettings::setUserInterfaceDirectionPolicy(const String& policy) 665 { 666 if (!m_page) 667 return Exception { INVALID_ACCESS_ERR }; 619 668 if (equalLettersIgnoringASCIICase(policy, "content")) { 620 settings() ->setUserInterfaceDirectionPolicy(UserInterfaceDirectionPolicy::Content);621 return ;669 settings().setUserInterfaceDirectionPolicy(UserInterfaceDirectionPolicy::Content); 670 return { }; 622 671 } 623 672 if (equalLettersIgnoringASCIICase(policy, "view")) { 624 settings() ->setUserInterfaceDirectionPolicy(UserInterfaceDirectionPolicy::System);625 return ;673 settings().setUserInterfaceDirectionPolicy(UserInterfaceDirectionPolicy::System); 674 return { }; 626 675 } 627 ec = INVALID_ACCESS_ERR; 628 } 629 630 String InternalSettings::systemLayoutDirection(ExceptionCode& ec) 631 { 632 InternalSettingsGuardForSettingsReturn(""); 633 switch (settings()->systemLayoutDirection()) { 676 return Exception { INVALID_ACCESS_ERR }; 677 } 678 679 ExceptionOr<String> InternalSettings::systemLayoutDirection() 680 { 681 if (!m_page) 682 return Exception { INVALID_ACCESS_ERR }; 683 switch (settings().systemLayoutDirection()) { 634 684 case LTR: 635 return ASCIILiteral("LTR");685 return String { ASCIILiteral { "LTR" } }; 636 686 case RTL: 637 return ASCIILiteral("RTL");687 return String { ASCIILiteral { "RTL" } }; 638 688 } 639 689 ASSERT_NOT_REACHED(); 640 return String(); 641 } 642 643 void InternalSettings::setSystemLayoutDirection(const String& direction, ExceptionCode& ec) 644 { 645 InternalSettingsGuardForSettings(); 690 return Exception { INVALID_ACCESS_ERR }; 691 } 692 693 ExceptionOr<void> InternalSettings::setSystemLayoutDirection(const String& direction) 694 { 695 if (!m_page) 696 return Exception { INVALID_ACCESS_ERR }; 646 697 if (equalLettersIgnoringASCIICase(direction, "ltr")) { 647 settings() ->setSystemLayoutDirection(LTR);648 return ;698 settings().setSystemLayoutDirection(LTR); 699 return { }; 649 700 } 650 701 if (equalLettersIgnoringASCIICase(direction, "rtl")) { 651 settings() ->setSystemLayoutDirection(RTL);652 return ;702 settings().setSystemLayoutDirection(RTL); 703 return { }; 653 704 } 654 ec = INVALID_ACCESS_ERR;705 return Exception { INVALID_ACCESS_ERR }; 655 706 } 656 707 … … 660 711 } 661 712 662 bool InternalSettings::variationFontsEnabled(ExceptionCode& ec) 663 { 713 ExceptionOr<bool> InternalSettings::variationFontsEnabled() 714 { 715 if (!m_page) 716 return Exception { INVALID_ACCESS_ERR }; 664 717 #if ENABLE(VARIATION_FONTS) 665 InternalSettingsGuardForSettingsReturn(true); 666 return settings()->variationFontsEnabled(); 667 #else 668 UNUSED_PARAM(ec); 718 return settings().variationFontsEnabled(); 719 #else 669 720 return false; 670 721 #endif 671 722 } 672 723 673 void InternalSettings::setVariationFontsEnabled(bool enabled, ExceptionCode& ec) 674 { 724 ExceptionOr<void> InternalSettings::setVariationFontsEnabled(bool enabled) 725 { 726 if (!m_page) 727 return Exception { INVALID_ACCESS_ERR }; 675 728 #if ENABLE(VARIATION_FONTS) 676 InternalSettingsGuardForSettings(); 677 settings()->setVariationFontsEnabled(enabled); 729 settings().setVariationFontsEnabled(enabled); 678 730 #else 679 731 UNUSED_PARAM(enabled); 680 UNUSED_PARAM(ec); 681 #endif 732 #endif 733 return { }; 682 734 } 683 735 684 736 InternalSettings::ForcedPrefersReducedMotionValue InternalSettings::forcedPrefersReducedMotionValue() const 685 737 { 686 switch (settings() ->forcedPrefersReducedMotionValue()) {738 switch (settings().forcedPrefersReducedMotionValue()) { 687 739 case Settings::ForcedPrefersReducedMotionValue::System: 688 740 return InternalSettings::ForcedPrefersReducedMotionValue::System; … … 701 753 switch (value) { 702 754 case InternalSettings::ForcedPrefersReducedMotionValue::System: 703 settings() ->setForcedPrefersReducedMotionValue(Settings::ForcedPrefersReducedMotionValue::System);704 break;755 settings().setForcedPrefersReducedMotionValue(Settings::ForcedPrefersReducedMotionValue::System); 756 return; 705 757 case InternalSettings::ForcedPrefersReducedMotionValue::On: 706 settings() ->setForcedPrefersReducedMotionValue(Settings::ForcedPrefersReducedMotionValue::On);707 break;758 settings().setForcedPrefersReducedMotionValue(Settings::ForcedPrefersReducedMotionValue::On); 759 return; 708 760 case InternalSettings::ForcedPrefersReducedMotionValue::Off: 709 settings() ->setForcedPrefersReducedMotionValue(Settings::ForcedPrefersReducedMotionValue::Off);710 break;761 settings().setForcedPrefersReducedMotionValue(Settings::ForcedPrefersReducedMotionValue::Off); 762 return; 711 763 } 712 } 713 714 // If you add to this list, make sure that you update the Backup class for test reproducability! 715 716 } 764 765 ASSERT_NOT_REACHED(); 766 } 767 768 // If you add to this class, make sure that you update the Backup class for test reproducability! 769 770 } -
trunk/Source/WebCore/testing/InternalSettings.h
r207173 r207521 31 31 32 32 #include "EditingBehaviorTypes.h" 33 #include "ExceptionOr.h" 33 34 #include "FontGenericFamilies.h" 34 35 #include "IntSize.h" … … 40 41 namespace WebCore { 41 42 42 typedef int ExceptionCode;43 44 class Frame;45 class Document;46 43 class Page; 47 44 class Settings; … … 49 46 class InternalSettings : public InternalSettingsGenerated { 50 47 public: 48 static Ref<InternalSettings> create(Page*); 49 static InternalSettings* from(Page*); 50 void hostDestroyed(); 51 void resetToConsistentState(); 52 53 ExceptionOr<void> setUsesOverlayScrollbars(bool); 54 ExceptionOr<void> setTouchEventEmulationEnabled(bool); 55 ExceptionOr<void> setStandardFontFamily(const String& family, const String& script); 56 ExceptionOr<void> setSerifFontFamily(const String& family, const String& script); 57 ExceptionOr<void> setSansSerifFontFamily(const String& family, const String& script); 58 ExceptionOr<void> setFixedFontFamily(const String& family, const String& script); 59 ExceptionOr<void> setCursiveFontFamily(const String& family, const String& script); 60 ExceptionOr<void> setFantasyFontFamily(const String& family, const String& script); 61 ExceptionOr<void> setPictographFontFamily(const String& family, const String& script); 62 ExceptionOr<void> setTextAutosizingEnabled(bool); 63 ExceptionOr<void> setTextAutosizingWindowSizeOverride(int width, int height); 64 ExceptionOr<void> setTextAutosizingFontScaleFactor(float); 65 ExceptionOr<void> setMediaTypeOverride(const String&); 66 ExceptionOr<void> setCanStartMedia(bool); 67 ExceptionOr<void> setAllowsAirPlayForMediaPlayback(bool); 68 ExceptionOr<void> setEditingBehavior(const String&); 69 ExceptionOr<void> setPreferMIMETypeForImages(bool); 70 ExceptionOr<void> setPDFImageCachingPolicy(const String&); 71 ExceptionOr<void> setShouldDisplayTrackKind(const String& kind, bool enabled); 72 ExceptionOr<bool> shouldDisplayTrackKind(const String& kind); 73 ExceptionOr<void> setStorageBlockingPolicy(const String&); 74 static void setLangAttributeAwareFormControlUIEnabled(bool); 75 ExceptionOr<void> setImagesEnabled(bool); 76 ExceptionOr<void> setMinimumTimerInterval(double intervalInSeconds); 77 ExceptionOr<void> setDefaultVideoPosterURL(const String&); 78 ExceptionOr<void> setForcePendingWebGLPolicy(bool); 79 ExceptionOr<void> setTimeWithoutMouseMovementBeforeHidingControls(double); 80 ExceptionOr<void> setUseLegacyBackgroundSizeShorthandBehavior(bool); 81 ExceptionOr<void> setAutoscrollForDragAndDropEnabled(bool); 82 ExceptionOr<void> setFontFallbackPrefersPictographs(bool); 83 ExceptionOr<void> setWebFontsAlwaysFallBack(bool); 84 ExceptionOr<void> setQuickTimePluginReplacementEnabled(bool); 85 ExceptionOr<void> setYouTubeFlashPluginReplacementEnabled(bool); 86 ExceptionOr<void> setBackgroundShouldExtendBeyondPage(bool); 87 ExceptionOr<void> setShouldConvertPositionStyleOnCopy(bool); 88 ExceptionOr<void> setScrollingTreeIncludesFrames(bool); 89 ExceptionOr<void> setAllowsInlineMediaPlayback(bool); 90 ExceptionOr<void> setAllowsInlineMediaPlaybackAfterFullscreen(bool); 91 ExceptionOr<void> setInlineMediaPlaybackRequiresPlaysInlineAttribute(bool); 92 static void setIndexedDBWorkersEnabled(bool); 93 ExceptionOr<String> userInterfaceDirectionPolicy(); 94 ExceptionOr<void> setUserInterfaceDirectionPolicy(const String&); 95 ExceptionOr<String> systemLayoutDirection(); 96 ExceptionOr<void> setSystemLayoutDirection(const String&); 97 ExceptionOr<bool> variationFontsEnabled(); 98 ExceptionOr<void> setVariationFontsEnabled(bool); 99 100 enum class ForcedPrefersReducedMotionValue { System, On, Off }; 101 ForcedPrefersReducedMotionValue forcedPrefersReducedMotionValue() const; 102 void setForcedPrefersReducedMotionValue(ForcedPrefersReducedMotionValue); 103 104 static void setAllowsAnySSLCertificate(bool); 105 106 private: 107 explicit InternalSettings(Page*); 108 109 Settings& settings() const; 110 static const char* supplementName(); 111 51 112 class Backup { 52 113 public: … … 119 180 }; 120 181 121 static Ref<InternalSettings> create(Page* page)122 {123 return adoptRef(*new InternalSettings(page));124 }125 static InternalSettings* from(Page*);126 void hostDestroyed() { m_page = 0; }127 128 virtual ~InternalSettings();129 void resetToConsistentState();130 131 void setUsesOverlayScrollbars(bool, ExceptionCode&);132 void setTouchEventEmulationEnabled(bool, ExceptionCode&);133 void setStandardFontFamily(const String& family, const String& script, ExceptionCode&);134 void setSerifFontFamily(const String& family, const String& script, ExceptionCode&);135 void setSansSerifFontFamily(const String& family, const String& script, ExceptionCode&);136 void setFixedFontFamily(const String& family, const String& script, ExceptionCode&);137 void setCursiveFontFamily(const String& family, const String& script, ExceptionCode&);138 void setFantasyFontFamily(const String& family, const String& script, ExceptionCode&);139 void setPictographFontFamily(const String& family, const String& script, ExceptionCode&);140 void setTextAutosizingEnabled(bool enabled, ExceptionCode&);141 void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&);142 void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&);143 void setMediaTypeOverride(const String& mediaType, ExceptionCode&);144 void setCanStartMedia(bool, ExceptionCode&);145 void setAllowsAirPlayForMediaPlayback(bool);146 void setEditingBehavior(const String&, ExceptionCode&);147 void setPreferMIMETypeForImages(bool, ExceptionCode&);148 void setPDFImageCachingPolicy(const String&, ExceptionCode&);149 void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&);150 bool shouldDisplayTrackKind(const String& kind, ExceptionCode&);151 void setStorageBlockingPolicy(const String&, ExceptionCode&);152 void setLangAttributeAwareFormControlUIEnabled(bool);153 void setImagesEnabled(bool, ExceptionCode&);154 void setMinimumTimerInterval(double intervalInSeconds, ExceptionCode&);155 void setDefaultVideoPosterURL(const String& url, ExceptionCode&);156 void setForcePendingWebGLPolicy(bool, ExceptionCode&);157 void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&);158 void setUseLegacyBackgroundSizeShorthandBehavior(bool, ExceptionCode&);159 void setAutoscrollForDragAndDropEnabled(bool, ExceptionCode&);160 void setFontFallbackPrefersPictographs(bool, ExceptionCode&);161 void setWebFontsAlwaysFallBack(bool, ExceptionCode&);162 void setQuickTimePluginReplacementEnabled(bool, ExceptionCode&);163 void setYouTubeFlashPluginReplacementEnabled(bool, ExceptionCode&);164 void setBackgroundShouldExtendBeyondPage(bool, ExceptionCode&);165 void setShouldConvertPositionStyleOnCopy(bool, ExceptionCode&);166 void setScrollingTreeIncludesFrames(bool, ExceptionCode&);167 void setAllowsInlineMediaPlayback(bool, ExceptionCode&);168 void setAllowsInlineMediaPlaybackAfterFullscreen(bool, ExceptionCode&);169 void setInlineMediaPlaybackRequiresPlaysInlineAttribute(bool, ExceptionCode&);170 void setIndexedDBWorkersEnabled(bool, ExceptionCode&);171 String userInterfaceDirectionPolicy(ExceptionCode&);172 void setUserInterfaceDirectionPolicy(const String& policy, ExceptionCode&);173 String systemLayoutDirection(ExceptionCode&);174 void setSystemLayoutDirection(const String& direction, ExceptionCode&);175 bool variationFontsEnabled(ExceptionCode&);176 void setVariationFontsEnabled(bool, ExceptionCode&);177 178 enum class ForcedPrefersReducedMotionValue { System, On, Off };179 ForcedPrefersReducedMotionValue forcedPrefersReducedMotionValue() const;180 void setForcedPrefersReducedMotionValue(ForcedPrefersReducedMotionValue);181 182 static void setAllowsAnySSLCertificate(bool);183 184 private:185 explicit InternalSettings(Page*);186 187 Settings* settings() const;188 Page* page() const { return m_page; }189 static const char* supplementName();190 191 182 Page* m_page; 192 183 Backup m_backup; -
trunk/Source/WebCore/testing/InternalSettings.idl
r207173 r207521 32 32 ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, 33 33 ] interface InternalSettings : InternalSettingsGenerated { 34 [MayThrow LegacyException] void setTouchEventEmulationEnabled(boolean enabled);34 [MayThrowException] void setTouchEventEmulationEnabled(boolean enabled); 35 35 36 36 // Fonts, text 37 [MayThrow LegacyException] void setStandardFontFamily(DOMString family, DOMString script);38 [MayThrow LegacyException] void setSerifFontFamily(DOMString family, DOMString script);39 [MayThrow LegacyException] void setSansSerifFontFamily(DOMString family, DOMString script);40 [MayThrow LegacyException] void setFixedFontFamily(DOMString family, DOMString script);41 [MayThrow LegacyException] void setCursiveFontFamily(DOMString family, DOMString script);42 [MayThrow LegacyException] void setFantasyFontFamily(DOMString family, DOMString script);43 [MayThrow LegacyException] void setPictographFontFamily(DOMString family, DOMString script);44 [MayThrow LegacyException] void setFontFallbackPrefersPictographs(boolean preferPictographs);45 [MayThrow LegacyException] void setWebFontsAlwaysFallBack(boolean enable);37 [MayThrowException] void setStandardFontFamily(DOMString family, DOMString script); 38 [MayThrowException] void setSerifFontFamily(DOMString family, DOMString script); 39 [MayThrowException] void setSansSerifFontFamily(DOMString family, DOMString script); 40 [MayThrowException] void setFixedFontFamily(DOMString family, DOMString script); 41 [MayThrowException] void setCursiveFontFamily(DOMString family, DOMString script); 42 [MayThrowException] void setFantasyFontFamily(DOMString family, DOMString script); 43 [MayThrowException] void setPictographFontFamily(DOMString family, DOMString script); 44 [MayThrowException] void setFontFallbackPrefersPictographs(boolean preferPictographs); 45 [MayThrowException] void setWebFontsAlwaysFallBack(boolean enable); 46 46 47 [MayThrow LegacyException] void setTextAutosizingEnabled(boolean enabled);48 [MayThrow LegacyException] void setTextAutosizingWindowSizeOverride(long width, long height);47 [MayThrowException] void setTextAutosizingEnabled(boolean enabled); 48 [MayThrowException] void setTextAutosizingWindowSizeOverride(long width, long height); 49 49 50 50 // Media 51 [MayThrow LegacyException] void setCanStartMedia(boolean enabled);52 [Conditional=VIDEO_TRACK, MayThrow LegacyException] void setShouldDisplayTrackKind(DOMString kind, boolean enabled);53 [Conditional=VIDEO_TRACK, MayThrow LegacyException] boolean shouldDisplayTrackKind(DOMString trackKind);54 [MayThrow LegacyException] void setDefaultVideoPosterURL(DOMString poster);55 [MayThrow LegacyException] void setTimeWithoutMouseMovementBeforeHidingControls(unrestricted double time);56 [MayThrow LegacyException] void setMediaTypeOverride(DOMString mediaTypeOverride);51 [MayThrowException] void setCanStartMedia(boolean enabled); 52 [Conditional=VIDEO_TRACK, MayThrowException] void setShouldDisplayTrackKind(DOMString kind, boolean enabled); 53 [Conditional=VIDEO_TRACK, MayThrowException] boolean shouldDisplayTrackKind(DOMString trackKind); 54 [MayThrowException] void setDefaultVideoPosterURL(DOMString poster); 55 [MayThrowException] void setTimeWithoutMouseMovementBeforeHidingControls(unrestricted double time); 56 [MayThrowException] void setMediaTypeOverride(DOMString mediaTypeOverride); 57 57 void setAllowsAirPlayForMediaPlayback(boolean available); 58 58 59 [MayThrow LegacyException] void setForcePendingWebGLPolicy(boolean forced);59 [MayThrowException] void setForcePendingWebGLPolicy(boolean forced); 60 60 61 [MayThrow LegacyException] void setQuickTimePluginReplacementEnabled(boolean enabled);62 [MayThrow LegacyException] void setYouTubeFlashPluginReplacementEnabled(boolean enabled);61 [MayThrowException] void setQuickTimePluginReplacementEnabled(boolean enabled); 62 [MayThrowException] void setYouTubeFlashPluginReplacementEnabled(boolean enabled); 63 63 64 64 // Editing, forms 65 [MayThrow LegacyException] void setEditingBehavior(DOMString behavior);66 [MayThrow LegacyException] void setShouldConvertPositionStyleOnCopy(boolean convertPosition);65 [MayThrowException] void setEditingBehavior(DOMString behavior); 66 [MayThrowException] void setShouldConvertPositionStyleOnCopy(boolean convertPosition); 67 67 void setLangAttributeAwareFormControlUIEnabled(boolean enabled); 68 [MayThrow LegacyException] void setPreferMIMETypeForImages(boolean preferMimeTypeForImage);68 [MayThrowException] void setPreferMIMETypeForImages(boolean preferMimeTypeForImage); 69 69 70 70 // Other switches 71 [MayThrow LegacyException] void setStorageBlockingPolicy(DOMString policy);72 [MayThrow LegacyException] void setImagesEnabled(boolean enabled);73 [MayThrow LegacyException] void setPDFImageCachingPolicy(DOMString policy);74 [MayThrow LegacyException] void setUseLegacyBackgroundSizeShorthandBehavior(boolean enabled);75 [MayThrow LegacyException] void setAutoscrollForDragAndDropEnabled(boolean enabled);76 [MayThrow LegacyException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground);77 [MayThrow LegacyException] void setScrollingTreeIncludesFrames(boolean enabled);71 [MayThrowException] void setStorageBlockingPolicy(DOMString policy); 72 [MayThrowException] void setImagesEnabled(boolean enabled); 73 [MayThrowException] void setPDFImageCachingPolicy(DOMString policy); 74 [MayThrowException] void setUseLegacyBackgroundSizeShorthandBehavior(boolean enabled); 75 [MayThrowException] void setAutoscrollForDragAndDropEnabled(boolean enabled); 76 [MayThrowException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground); 77 [MayThrowException] void setScrollingTreeIncludesFrames(boolean enabled); 78 78 79 [MayThrow LegacyException] void setMinimumTimerInterval(unrestricted double intervalInSeconds);80 [MayThrow LegacyException] void setAllowsInlineMediaPlayback(boolean allows);81 [MayThrow LegacyException] void setAllowsInlineMediaPlaybackAfterFullscreen(boolean allows);82 [MayThrow LegacyException] void setInlineMediaPlaybackRequiresPlaysInlineAttribute(boolean requires);79 [MayThrowException] void setMinimumTimerInterval(unrestricted double intervalInSeconds); 80 [MayThrowException] void setAllowsInlineMediaPlayback(boolean allows); 81 [MayThrowException] void setAllowsInlineMediaPlaybackAfterFullscreen(boolean allows); 82 [MayThrowException] void setInlineMediaPlaybackRequiresPlaysInlineAttribute(boolean requires); 83 83 84 [MayThrowLegacyException]void setIndexedDBWorkersEnabled(boolean requires);84 void setIndexedDBWorkersEnabled(boolean requires); 85 85 86 [MayThrow LegacyException] DOMString userInterfaceDirectionPolicy();87 [MayThrow LegacyException] void setUserInterfaceDirectionPolicy(DOMString policy);88 [MayThrow LegacyException] DOMString systemLayoutDirection();89 [MayThrow LegacyException] void setSystemLayoutDirection(DOMString direction);86 [MayThrowException] DOMString userInterfaceDirectionPolicy(); 87 [MayThrowException] void setUserInterfaceDirectionPolicy(DOMString policy); 88 [MayThrowException] DOMString systemLayoutDirection(); 89 [MayThrowException] void setSystemLayoutDirection(DOMString direction); 90 90 91 [MayThrow LegacyException] boolean variationFontsEnabled();92 [MayThrow LegacyException] void setVariationFontsEnabled(boolean enabled);91 [MayThrowException] boolean variationFontsEnabled(); 92 [MayThrowException] void setVariationFontsEnabled(boolean enabled); 93 93 94 94 attribute ForcedPrefersReducedMotionValue forcedPrefersReducedMotionValue; -
trunk/Source/WebCore/testing/Internals.cpp
r207458 r207521 109 109 #include "ResourceLoadObserver.h" 110 110 #include "RuntimeEnabledFeatures.h" 111 #include "SVGPathStringBuilder.h" 111 112 #include "SchemeRegistry.h" 112 113 #include "ScriptedAnimationController.h" … … 233 234 using namespace HTMLNames; 234 235 235 class InspectorStubFrontend : public InspectorFrontendClientLocal, public FrontendChannel {236 class InspectorStubFrontend final : public InspectorFrontendClientLocal, public FrontendChannel { 236 237 public: 237 238 InspectorStubFrontend(Page& inspectedPage, RefPtr<DOMWindow>&& frontendWindow); 238 239 virtual ~InspectorStubFrontend(); 239 240 240 // InspectorFrontendClient API241 void attachWindow(DockSide) override { }242 void detachWindow() override { }243 void closeWindow() override;244 void bringToFront() override { }245 String localizedStringsURL() override { return String(); }246 void inspectedURLChanged(const String&) override { }247 protected:248 void setAttachedWindowHeight(unsigned) override { }249 void setAttachedWindowWidth(unsigned) override { }250 251 public:252 // Inspector::FrontendChannel API253 bool sendMessageToFrontend(const String& message) override;254 ConnectionType connectionType() const override { return ConnectionType::Local; }255 256 241 private: 242 void attachWindow(DockSide) final { } 243 void detachWindow() final { } 244 void closeWindow() final; 245 void bringToFront() final { } 246 String localizedStringsURL() final { return String(); } 247 void inspectedURLChanged(const String&) final { } 248 void setAttachedWindowHeight(unsigned) final { } 249 void setAttachedWindowWidth(unsigned) final { } 250 251 bool sendMessageToFrontend(const String& message) final; 252 ConnectionType connectionType() const final { return ConnectionType::Local; } 253 257 254 Page* frontendPage() const 258 255 { … … 587 584 } 588 585 589 void Internals::setCanShowModalDialogOverride(bool allow, ExceptionCode& ec) 590 { 591 if (!contextDocument() || !contextDocument()->domWindow()) { 592 ec = INVALID_ACCESS_ERR; 593 return; 594 } 586 ExceptionOr<void> Internals::setCanShowModalDialogOverride(bool allow) 587 { 588 if (!contextDocument() || !contextDocument()->domWindow()) 589 return Exception { INVALID_ACCESS_ERR }; 595 590 596 591 contextDocument()->domWindow()->setCanShowModalDialogOverride(allow); 592 return { }; 597 593 } 598 594 … … 672 668 } 673 669 674 unsigned Internals::lastSpatialNavigationCandidateCount(ExceptionCode& ec) const 675 { 676 if (!contextDocument() || !contextDocument()->page()) { 677 ec = INVALID_ACCESS_ERR; 678 return 0; 679 } 670 ExceptionOr<unsigned> Internals::lastSpatialNavigationCandidateCount() const 671 { 672 if (!contextDocument() || !contextDocument()->page()) 673 return Exception { INVALID_ACCESS_ERR }; 680 674 681 675 return contextDocument()->page()->lastSpatialNavigationCandidateCount(); … … 687 681 } 688 682 689 bool Internals::animationsAreSuspended(ExceptionCode& ec) const 690 { 691 Document* document = contextDocument(); 692 if (!document || !document->frame()) { 693 ec = INVALID_ACCESS_ERR; 694 return false; 695 } 683 ExceptionOr<bool> Internals::animationsAreSuspended() const 684 { 685 Document* document = contextDocument(); 686 if (!document || !document->frame()) 687 return Exception { INVALID_ACCESS_ERR }; 696 688 697 689 return document->frame()->animation().isSuspended(); 698 690 } 699 691 700 void Internals::suspendAnimations(ExceptionCode& ec) const 701 { 702 Document* document = contextDocument(); 703 if (!document || !document->frame()) { 704 ec = INVALID_ACCESS_ERR; 705 return; 706 } 692 ExceptionOr<void> Internals::suspendAnimations() const 693 { 694 Document* document = contextDocument(); 695 if (!document || !document->frame()) 696 return Exception { INVALID_ACCESS_ERR }; 707 697 708 698 document->frame()->animation().suspendAnimations(); 709 } 710 711 void Internals::resumeAnimations(ExceptionCode& ec) const 712 { 713 Document* document = contextDocument(); 714 if (!document || !document->frame()) { 715 ec = INVALID_ACCESS_ERR; 716 return; 717 } 699 return { }; 700 } 701 702 ExceptionOr<void> Internals::resumeAnimations() const 703 { 704 Document* document = contextDocument(); 705 if (!document || !document->frame()) 706 return Exception { INVALID_ACCESS_ERR }; 718 707 719 708 document->frame()->animation().resumeAnimations(); 720 } 721 722 bool Internals::pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element& element, ExceptionCode& ec) 723 { 724 if (pauseTime < 0) { 725 ec = INVALID_ACCESS_ERR; 726 return false; 727 } 709 return { }; 710 } 711 712 ExceptionOr<bool> Internals::pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element& element) 713 { 714 if (pauseTime < 0) 715 return Exception { INVALID_ACCESS_ERR }; 728 716 return frame()->animation().pauseAnimationAtTime(element.renderer(), AtomicString(animationName), pauseTime); 729 717 } 730 718 731 bool Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element& element, const String& pseudoId, ExceptionCode& ec) 732 { 733 if (pauseTime < 0) { 734 ec = INVALID_ACCESS_ERR; 735 return false; 736 } 737 738 if (pseudoId != "before" && pseudoId != "after") { 739 ec = INVALID_ACCESS_ERR; 740 return false; 741 } 719 ExceptionOr<bool> Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element& element, const String& pseudoId) 720 { 721 if (pauseTime < 0) 722 return Exception { INVALID_ACCESS_ERR }; 723 724 if (pseudoId != "before" && pseudoId != "after") 725 return Exception { INVALID_ACCESS_ERR }; 742 726 743 727 PseudoElement* pseudoElement = pseudoId == "before" ? element.beforePseudoElement() : element.afterPseudoElement(); 744 if (!pseudoElement) { 745 ec = INVALID_ACCESS_ERR; 746 return false; 747 } 728 if (!pseudoElement) 729 return Exception { INVALID_ACCESS_ERR }; 748 730 749 731 return frame()->animation().pauseAnimationAtTime(pseudoElement->renderer(), AtomicString(animationName), pauseTime); 750 732 } 751 733 752 bool Internals::pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element& element, ExceptionCode& ec) 753 { 754 if (pauseTime < 0) { 755 ec = INVALID_ACCESS_ERR; 756 return false; 757 } 734 ExceptionOr<bool> Internals::pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element& element) 735 { 736 if (pauseTime < 0) 737 return Exception { INVALID_ACCESS_ERR }; 758 738 return frame()->animation().pauseTransitionAtTime(element.renderer(), propertyName, pauseTime); 759 739 } 760 740 761 bool Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element& element, const String& pseudoId, ExceptionCode& ec) 762 { 763 if (pauseTime < 0) { 764 ec = INVALID_ACCESS_ERR; 765 return false; 766 } 767 768 if (pseudoId != "before" && pseudoId != "after") { 769 ec = INVALID_ACCESS_ERR; 770 return false; 771 } 741 ExceptionOr<bool> Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element& element, const String& pseudoId) 742 { 743 if (pauseTime < 0) 744 return Exception { INVALID_ACCESS_ERR }; 745 746 if (pseudoId != "before" && pseudoId != "after") 747 return Exception { INVALID_ACCESS_ERR }; 772 748 773 749 PseudoElement* pseudoElement = pseudoId == "before" ? element.beforePseudoElement() : element.afterPseudoElement(); 774 if (!pseudoElement) { 775 ec = INVALID_ACCESS_ERR; 776 return false; 777 } 750 if (!pseudoElement) 751 return Exception { INVALID_ACCESS_ERR }; 778 752 779 753 return frame()->animation().pauseTransitionAtTime(pseudoElement->renderer(), property, pauseTime); 780 754 } 781 755 782 String Internals::elementRenderTreeAsText(Element& element, ExceptionCode& ec)756 ExceptionOr<String> Internals::elementRenderTreeAsText(Element& element) 783 757 { 784 758 element.document().updateStyleIfNeeded(); 785 759 786 760 String representation = externalRepresentation(&element); 787 if (representation.isEmpty()) { 788 ec = INVALID_ACCESS_ERR; 789 return String(); 790 } 791 792 return representation; 761 if (representation.isEmpty()) 762 return Exception { INVALID_ACCESS_ERR }; 763 764 return WTFMove(representation); 793 765 } 794 766 … … 804 776 } 805 777 806 Node* Internals::ensureShadowRoot(Element& host, ExceptionCode& ec)778 ExceptionOr<Node*> Internals::ensureShadowRoot(Element& host) 807 779 { 808 780 if (ShadowRoot* shadowRoot = host.shadowRoot()) 809 781 return shadowRoot; 810 782 811 return host.createShadowRoot(ec).get(); 783 ExceptionCode ec = 0; 784 auto result = host.createShadowRoot(ec); 785 if (ec) 786 return Exception { ec }; 787 return result; 812 788 } 813 789 … … 817 793 } 818 794 819 Node* Internals::createShadowRoot(Element& host, ExceptionCode& ec) 820 { 821 return host.createShadowRoot(ec).get(); 795 ExceptionOr<Node*> Internals::createShadowRoot(Element& host) 796 { 797 ExceptionCode ec = 0; 798 auto result = host.createShadowRoot(ec); 799 if (ec) 800 return Exception { ec }; 801 return result; 822 802 } 823 803 … … 827 807 } 828 808 829 String Internals::shadowRootType(const Node& root, ExceptionCode& ec) const 830 { 831 if (!is<ShadowRoot>(root)) { 832 ec = INVALID_ACCESS_ERR; 833 return String(); 834 } 809 ExceptionOr<String> Internals::shadowRootType(const Node& root) const 810 { 811 if (!is<ShadowRoot>(root)) 812 return Exception { INVALID_ACCESS_ERR }; 835 813 836 814 switch (downcast<ShadowRoot>(root).mode()) { … … 857 835 } 858 836 859 bool Internals::isTimerThrottled(int timeoutId, ExceptionCode& ec)837 ExceptionOr<bool> Internals::isTimerThrottled(int timeoutId) 860 838 { 861 839 DOMTimer* timer = scriptExecutionContext()->findTimeout(timeoutId); 862 if (!timer) { 863 ec = NOT_FOUND_ERR; 864 return false; 865 } 840 if (!timer) 841 return Exception { NOT_FOUND_ERR }; 866 842 return timer->m_throttleState == DOMTimer::ShouldThrottle; 867 843 } … … 902 878 } 903 879 904 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)880 ExceptionOr<Vector<String>> Internals::formControlStateOfPreviousHistoryItem() 905 881 { 906 882 HistoryItem* mainItem = frame()->loader().history().previousItem(); 907 if (!mainItem) { 908 ec = INVALID_ACCESS_ERR; 909 return Vector<String>(); 910 } 883 if (!mainItem) 884 return Exception { INVALID_ACCESS_ERR }; 911 885 String uniqueName = frame()->tree().uniqueName(); 912 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) { 913 ec = INVALID_ACCESS_ERR; 914 return Vector<String>(); 915 } 916 return mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState(); 917 } 918 919 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& state, ExceptionCode& ec) 886 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) 887 return Exception { INVALID_ACCESS_ERR }; 888 return Vector<String> { mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState() }; 889 } 890 891 ExceptionOr<void> Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& state) 920 892 { 921 893 HistoryItem* mainItem = frame()->loader().history().previousItem(); 922 if (!mainItem) { 923 ec = INVALID_ACCESS_ERR; 924 return; 925 } 894 if (!mainItem) 895 return Exception { INVALID_ACCESS_ERR }; 926 896 String uniqueName = frame()->tree().uniqueName(); 927 897 if (mainItem->target() == uniqueName) … … 930 900 subItem->setDocumentState(state); 931 901 else 932 ec = INVALID_ACCESS_ERR; 902 return Exception { INVALID_ACCESS_ERR }; 903 return { }; 933 904 } 934 905 935 906 #if ENABLE(SPEECH_SYNTHESIS) 907 936 908 void Internals::enableMockSpeechSynthesizer() 937 909 { … … 945 917 synthesis->setPlatformSynthesizer(std::make_unique<PlatformSpeechSynthesizerMock>(synthesis)); 946 918 } 919 947 920 #endif 948 921 949 922 #if ENABLE(WEB_RTC) 923 950 924 void Internals::enableMockMediaEndpoint() 951 925 { … … 962 936 connection.emulatePlatformEvent(action); 963 937 } 938 964 939 #endif 965 940 966 941 #if ENABLE(MEDIA_STREAM) 942 967 943 void Internals::setMockMediaCaptureDevicesEnabled(bool enabled) 968 944 { 969 945 WebCore::Settings::setMockCaptureDevicesEnabled(enabled); 970 946 } 971 #endif 972 973 Ref<ClientRect> Internals::absoluteCaretBounds(ExceptionCode& ec) 974 { 975 Document* document = contextDocument(); 976 if (!document || !document->frame()) { 977 ec = INVALID_ACCESS_ERR; 978 return ClientRect::create(); 979 } 947 948 #endif 949 950 ExceptionOr<Ref<ClientRect>> Internals::absoluteCaretBounds() 951 { 952 Document* document = contextDocument(); 953 if (!document || !document->frame()) 954 return Exception { INVALID_ACCESS_ERR }; 980 955 981 956 return ClientRect::create(document->frame()->selection().absoluteCaretBounds()); … … 991 966 } 992 967 993 Ref<ClientRectList> Internals::inspectorHighlightRects(ExceptionCode& ec) 994 { 995 Document* document = contextDocument(); 996 if (!document || !document->page()) { 997 ec = INVALID_ACCESS_ERR; 998 return ClientRectList::create(); 999 } 968 ExceptionOr<Ref<ClientRectList>> Internals::inspectorHighlightRects() 969 { 970 Document* document = contextDocument(); 971 if (!document || !document->page()) 972 return Exception { INVALID_ACCESS_ERR }; 1000 973 1001 974 Highlight highlight; … … 1004 977 } 1005 978 1006 String Internals::inspectorHighlightObject(ExceptionCode& ec) 1007 { 1008 Document* document = contextDocument(); 1009 if (!document || !document->page()) { 1010 ec = INVALID_ACCESS_ERR; 1011 return String(); 1012 } 979 ExceptionOr<String> Internals::inspectorHighlightObject() 980 { 981 Document* document = contextDocument(); 982 if (!document || !document->page()) 983 return Exception { INVALID_ACCESS_ERR }; 1013 984 1014 985 return document->page()->inspectorController().buildObjectForHighlightedNodes()->toJSONString(); 1015 986 } 1016 987 1017 unsigned Internals::markerCountForNode(Node& node, const String& markerType, ExceptionCode& ec)988 ExceptionOr<unsigned> Internals::markerCountForNode(Node& node, const String& markerType) 1018 989 { 1019 990 DocumentMarker::MarkerTypes markerTypes = 0; 1020 if (!markerTypesFrom(markerType, markerTypes)) { 1021 ec = SYNTAX_ERR; 1022 return 0; 1023 } 991 if (!markerTypesFrom(markerType, markerTypes)) 992 return Exception { SYNTAX_ERR }; 1024 993 1025 994 node.document().frame()->editor().updateEditorUINowIfScheduled(); … … 1027 996 } 1028 997 1029 RenderedDocumentMarker* Internals::markerAt(Node& node, const String& markerType, unsigned index, ExceptionCode& ec)998 ExceptionOr<RenderedDocumentMarker*> Internals::markerAt(Node& node, const String& markerType, unsigned index) 1030 999 { 1031 1000 node.document().updateLayoutIgnorePendingStylesheets(); 1032 1001 1033 1002 DocumentMarker::MarkerTypes markerTypes = 0; 1034 if (!markerTypesFrom(markerType, markerTypes)) { 1035 ec = SYNTAX_ERR; 1036 return nullptr; 1037 } 1003 if (!markerTypesFrom(markerType, markerTypes)) 1004 return Exception { SYNTAX_ERR }; 1038 1005 1039 1006 node.document().frame()->editor().updateEditorUINowIfScheduled(); … … 1045 1012 } 1046 1013 1047 RefPtr<Range> Internals::markerRangeForNode(Node& node, const String& markerType, unsigned index, ExceptionCode& ec) 1048 { 1049 RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec); 1014 ExceptionOr<RefPtr<Range>> Internals::markerRangeForNode(Node& node, const String& markerType, unsigned index) 1015 { 1016 auto result = markerAt(node, markerType, index); 1017 if (result.hasException()) 1018 return result.releaseException(); 1019 auto marker = result.releaseReturnValue(); 1050 1020 if (!marker) 1051 1021 return nullptr; 1052 return Range::create(node.document(), &node, marker->startOffset(), &node, marker->endOffset()); 1053 } 1054 1055 String Internals::markerDescriptionForNode(Node& node, const String& markerType, unsigned index, ExceptionCode& ec) 1056 { 1057 RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec); 1022 return RefPtr<Range> { Range::create(node.document(), &node, marker->startOffset(), &node, marker->endOffset()) }; 1023 } 1024 1025 ExceptionOr<String> Internals::markerDescriptionForNode(Node& node, const String& markerType, unsigned index) 1026 { 1027 auto result = markerAt(node, markerType, index); 1028 if (result.hasException()) 1029 return result.releaseException(); 1030 auto marker = result.releaseReturnValue(); 1058 1031 if (!marker) 1059 1032 return String(); 1060 return marker->description();1061 } 1062 1063 String Internals::dumpMarkerRects(const String& markerTypeString, ExceptionCode& ec)1033 return String { marker->description() }; 1034 } 1035 1036 ExceptionOr<String> Internals::dumpMarkerRects(const String& markerTypeString) 1064 1037 { 1065 1038 DocumentMarker::MarkerType markerType; 1066 if (!markerTypeFrom(markerTypeString, markerType)) { 1067 ec = SYNTAX_ERR; 1068 return String(); 1069 } 1039 if (!markerTypeFrom(markerTypeString, markerType)) 1040 return Exception { SYNTAX_ERR }; 1070 1041 1071 1042 contextDocument()->markers().updateRectsForInvalidatedMarkersOfType(markerType); … … 1094 1065 } 1095 1066 1096 void Internals::setMarkedTextMatchesAreHighlighted(bool flag, ExceptionCode& ec) 1097 { 1098 Document* document = contextDocument(); 1099 if (!document || !document->frame()) { 1100 ec = INVALID_ACCESS_ERR; 1101 return; 1102 } 1067 ExceptionOr<void> Internals::setMarkedTextMatchesAreHighlighted(bool flag) 1068 { 1069 Document* document = contextDocument(); 1070 if (!document || !document->frame()) 1071 return Exception { INVALID_ACCESS_ERR }; 1103 1072 document->frame()->editor().setMarkedTextMatchesAreHighlighted(flag); 1073 return { }; 1104 1074 } 1105 1075 … … 1109 1079 } 1110 1080 1111 void Internals::setScrollViewPosition(int x, int y, ExceptionCode& ec) 1112 { 1113 Document* document = contextDocument(); 1114 if (!document || !document->view()) { 1115 ec = INVALID_ACCESS_ERR; 1116 return; 1117 } 1118 1119 FrameView* frameView = document->view(); 1120 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrollingToContentEdge(); 1121 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); 1122 1123 frameView->setConstrainsScrollingToContentEdge(false); 1124 frameView->setScrollbarsSuppressed(false); 1125 frameView->setScrollOffsetFromInternals({ x, y }); 1126 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); 1127 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue); 1128 } 1129 1130 void Internals::setViewBaseBackgroundColor(const String& colorValue, ExceptionCode& ec) 1131 { 1132 Document* document = contextDocument(); 1133 if (!document || !document->view()) { 1134 ec = INVALID_ACCESS_ERR; 1135 return; 1136 } 1081 ExceptionOr<void> Internals::setScrollViewPosition(int x, int y) 1082 { 1083 Document* document = contextDocument(); 1084 if (!document || !document->view()) 1085 return Exception { INVALID_ACCESS_ERR }; 1086 1087 auto& frameView = *document->view(); 1088 bool constrainsScrollingToContentEdgeOldValue = frameView.constrainsScrollingToContentEdge(); 1089 bool scrollbarsSuppressedOldValue = frameView.scrollbarsSuppressed(); 1090 1091 frameView.setConstrainsScrollingToContentEdge(false); 1092 frameView.setScrollbarsSuppressed(false); 1093 frameView.setScrollOffsetFromInternals({ x, y }); 1094 frameView.setScrollbarsSuppressed(scrollbarsSuppressedOldValue); 1095 frameView.setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue); 1096 1097 return { }; 1098 } 1099 1100 ExceptionOr<void> Internals::setViewBaseBackgroundColor(const String& colorValue) 1101 { 1102 Document* document = contextDocument(); 1103 if (!document || !document->view()) 1104 return Exception { INVALID_ACCESS_ERR }; 1137 1105 1138 1106 document->view()->setBaseBackgroundColor(Color(colorValue)); 1139 } 1140 1141 void Internals::setPagination(const String& mode, int gap, int pageLength, ExceptionCode& ec) 1142 { 1143 Document* document = contextDocument(); 1144 if (!document || !document->page()) { 1145 ec = INVALID_ACCESS_ERR; 1146 return; 1147 } 1148 Page* page = document->page(); 1107 return { }; 1108 } 1109 1110 ExceptionOr<void> Internals::setPagination(const String& mode, int gap, int pageLength) 1111 { 1112 Document* document = contextDocument(); 1113 if (!document || !document->page()) 1114 return Exception { INVALID_ACCESS_ERR }; 1149 1115 1150 1116 Pagination pagination; … … 1159 1125 else if (mode == "BottomToTopPaginated") 1160 1126 pagination.mode = Pagination::BottomToTopPaginated; 1161 else { 1162 ec = SYNTAX_ERR; 1163 return; 1164 } 1127 else 1128 return Exception { SYNTAX_ERR }; 1165 1129 1166 1130 pagination.gap = gap; 1167 1131 pagination.pageLength = pageLength; 1168 page->setPagination(pagination); 1169 } 1170 1171 void Internals::setPaginationLineGridEnabled(bool enabled, ExceptionCode& ec) 1172 { 1173 Document* document = contextDocument(); 1174 if (!document || !document->page()) { 1175 ec = INVALID_ACCESS_ERR; 1176 return; 1177 } 1178 Page* page = document->page(); 1179 page->setPaginationLineGridEnabled(enabled); 1180 } 1181 1182 String Internals::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) 1183 { 1184 Document* document = contextDocument(); 1185 if (!document || !document->page()) { 1186 ec = INVALID_ACCESS_ERR; 1187 return String(); 1188 } 1189 Page* page = document->page(); 1132 document->page()->setPagination(pagination); 1133 1134 return { }; 1135 } 1136 1137 ExceptionOr<void> Internals::setPaginationLineGridEnabled(bool enabled) 1138 { 1139 Document* document = contextDocument(); 1140 if (!document || !document->page()) 1141 return Exception { INVALID_ACCESS_ERR }; 1142 document->page()->setPaginationLineGridEnabled(enabled); 1143 return { }; 1144 } 1145 1146 ExceptionOr<String> Internals::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight) 1147 { 1148 Document* document = contextDocument(); 1149 if (!document || !document->page()) 1150 return Exception { INVALID_ACCESS_ERR }; 1190 1151 1191 1152 const int defaultLayoutWidthForNonMobilePages = 980; 1192 1153 1193 ViewportArguments arguments = page->viewportArguments();1154 ViewportArguments arguments = document->page()->viewportArguments(); 1194 1155 ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); 1195 1156 restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio); 1196 1157 restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); 1197 1158 1198 return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");1199 } 1200 1201 bool Internals::wasLastChangeUserEdit(Element& textField, ExceptionCode& ec)1159 return String { "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false") }; 1160 } 1161 1162 ExceptionOr<bool> Internals::wasLastChangeUserEdit(Element& textField) 1202 1163 { 1203 1164 if (is<HTMLInputElement>(textField)) … … 1207 1168 return downcast<HTMLTextAreaElement>(textField).lastChangeWasUserEdit(); 1208 1169 1209 ec = INVALID_NODE_TYPE_ERR; 1210 return false; 1170 return Exception { INVALID_NODE_TYPE_ERR }; 1211 1171 } 1212 1172 … … 1245 1205 } 1246 1206 1247 void Internals::scrollElementToRect(Element& element, int x, int y, int w, int h, ExceptionCode& ec)1207 ExceptionOr<void> Internals::scrollElementToRect(Element& element, int x, int y, int w, int h) 1248 1208 { 1249 1209 FrameView* frameView = element.document().view(); 1250 if (!frameView) { 1251 ec = INVALID_ACCESS_ERR; 1252 return; 1253 } 1210 if (!frameView) 1211 return Exception { INVALID_ACCESS_ERR }; 1254 1212 frameView->scrollElementToRect(element, { x, y, w, h }); 1255 } 1256 1257 String Internals::autofillFieldName(Element& element, ExceptionCode& ec) 1258 { 1259 if (!is<HTMLFormControlElement>(element)) { 1260 ec = INVALID_NODE_TYPE_ERR; 1261 return { }; 1262 } 1263 1264 return downcast<HTMLFormControlElement>(element).autofillData().fieldName; 1265 } 1266 1267 void Internals::paintControlTints(ExceptionCode& ec) 1268 { 1269 Document* document = contextDocument(); 1270 if (!document || !document->view()) { 1271 ec = INVALID_ACCESS_ERR; 1272 return; 1273 } 1274 1275 FrameView* frameView = document->view(); 1276 frameView->paintControlTints(); 1213 return { }; 1214 } 1215 1216 ExceptionOr<String> Internals::autofillFieldName(Element& element) 1217 { 1218 if (!is<HTMLFormControlElement>(element)) 1219 return Exception { INVALID_NODE_TYPE_ERR }; 1220 1221 return String { downcast<HTMLFormControlElement>(element).autofillData().fieldName }; 1222 } 1223 1224 ExceptionOr<void> Internals::paintControlTints() 1225 { 1226 Document* document = contextDocument(); 1227 if (!document || !document->view()) 1228 return Exception { INVALID_ACCESS_ERR }; 1229 1230 document->view()->paintControlTints(); 1231 return { }; 1277 1232 } 1278 1233 … … 1308 1263 } 1309 1264 1310 RefPtr<Range> Internals::rangeForDictionaryLookupAtLocation(int x, int y, ExceptionCode& ec)1265 ExceptionOr<RefPtr<Range>> Internals::rangeForDictionaryLookupAtLocation(int x, int y) 1311 1266 { 1312 1267 #if PLATFORM(MAC) 1313 1268 Document* document = contextDocument(); 1314 if (!document || !document->frame()) { 1315 ec = INVALID_ACCESS_ERR; 1316 return nullptr; 1317 } 1269 if (!document || !document->frame()) 1270 return Exception { INVALID_ACCESS_ERR }; 1318 1271 1319 1272 document->updateLayoutIgnorePendingStylesheets(); … … 1325 1278 UNUSED_PARAM(x); 1326 1279 UNUSED_PARAM(y); 1327 ec = INVALID_ACCESS_ERR; 1328 return nullptr; 1329 #endif 1330 } 1331 1332 void Internals::setDelegatesScrolling(bool enabled, ExceptionCode& ec) 1280 return Exception { INVALID_ACCESS_ERR }; 1281 #endif 1282 } 1283 1284 ExceptionOr<void> Internals::setDelegatesScrolling(bool enabled) 1333 1285 { 1334 1286 Document* document = contextDocument(); 1335 1287 // Delegate scrolling is valid only on mainframe's view. 1336 if (!document || !document->view() || !document->page() || &document->page()->mainFrame() != document->frame()) { 1337 ec = INVALID_ACCESS_ERR; 1338 return; 1339 } 1288 if (!document || !document->view() || !document->page() || &document->page()->mainFrame() != document->frame()) 1289 return Exception { INVALID_ACCESS_ERR }; 1340 1290 1341 1291 document->view()->setDelegatesScrolling(enabled); 1342 } 1343 1344 int Internals::lastSpellCheckRequestSequence(ExceptionCode& ec) 1345 { 1346 Document* document = contextDocument(); 1347 if (!document || !document->frame()) { 1348 ec = INVALID_ACCESS_ERR; 1349 return -1; 1350 } 1292 return { }; 1293 } 1294 1295 ExceptionOr<int> Internals::lastSpellCheckRequestSequence() 1296 { 1297 Document* document = contextDocument(); 1298 if (!document || !document->frame()) 1299 return Exception { INVALID_ACCESS_ERR }; 1351 1300 1352 1301 return document->frame()->editor().spellChecker().lastRequestSequence(); 1353 1302 } 1354 1303 1355 int Internals::lastSpellCheckProcessedSequence(ExceptionCode& ec) 1356 { 1357 Document* document = contextDocument(); 1358 if (!document || !document->frame()) { 1359 ec = INVALID_ACCESS_ERR; 1360 return -1; 1361 } 1304 ExceptionOr<int> Internals::lastSpellCheckProcessedSequence() 1305 { 1306 Document* document = contextDocument(); 1307 if (!document || !document->frame()) 1308 return Exception { INVALID_ACCESS_ERR }; 1362 1309 1363 1310 return document->frame()->editor().spellChecker().lastProcessedSequence(); … … 1398 1345 } 1399 1346 1400 unsigned Internals::wheelEventHandlerCount(ExceptionCode& ec) 1401 { 1402 Document* document = contextDocument(); 1403 if (!document) { 1404 ec = INVALID_ACCESS_ERR; 1405 return 0; 1406 } 1347 ExceptionOr<unsigned> Internals::wheelEventHandlerCount() 1348 { 1349 Document* document = contextDocument(); 1350 if (!document) 1351 return Exception { INVALID_ACCESS_ERR }; 1407 1352 1408 1353 return document->wheelEventHandlerCount(); 1409 1354 } 1410 1355 1411 unsigned Internals::touchEventHandlerCount(ExceptionCode& ec) 1412 { 1413 Document* document = contextDocument(); 1414 if (!document) { 1415 ec = INVALID_ACCESS_ERR; 1416 return 0; 1417 } 1356 ExceptionOr<unsigned> Internals::touchEventHandlerCount() 1357 { 1358 Document* document = contextDocument(); 1359 if (!document) 1360 return Exception { INVALID_ACCESS_ERR }; 1418 1361 1419 1362 return document->touchEventHandlerCount(); … … 1424 1367 // different document, and could just make the call through another Internals 1425 1368 // instance instead. 1426 RefPtr<NodeList> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, 1427 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const 1428 { 1429 if (!document.frame() || !document.frame()->view()) { 1430 ec = INVALID_ACCESS_ERR; 1431 return nullptr; 1432 } 1369 ExceptionOr<RefPtr<NodeList>> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const 1370 { 1371 if (!document.frame() || !document.frame()->view()) 1372 return Exception { INVALID_ACCESS_ERR }; 1433 1373 1434 1374 Frame* frame = document.frame(); … … 1476 1416 } 1477 1417 1478 return StaticNodeList::create(WTFMove(matches));1418 return RefPtr<NodeList> { StaticNodeList::create(WTFMove(matches)) }; 1479 1419 } 1480 1420 … … 1560 1500 } 1561 1501 1562 void Internals::setBatteryStatus(const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode& ec) 1563 { 1564 Document* document = contextDocument(); 1565 if (!document || !document->page()) { 1566 ec = INVALID_ACCESS_ERR; 1567 return; 1568 } 1502 ExceptionOr<void> Internals::setBatteryStatus(const String& eventType, bool charging, double chargingTime, double dischargingTime, double level) 1503 { 1504 Document* document = contextDocument(); 1505 if (!document || !document->page()) 1506 return Exception { INVALID_ACCESS_ERR }; 1569 1507 1570 1508 #if ENABLE(BATTERY_STATUS) … … 1577 1515 UNUSED_PARAM(level); 1578 1516 #endif 1579 } 1580 1581 void Internals::setDeviceProximity(const String& eventType, double value, double min, double max, ExceptionCode& ec) 1582 { 1583 Document* document = contextDocument(); 1584 if (!document || !document->page()) { 1585 ec = INVALID_ACCESS_ERR; 1586 return; 1587 } 1517 return { }; 1518 } 1519 1520 ExceptionOr<void> Internals::setDeviceProximity(const String&, double value, double min, double max) 1521 { 1522 Document* document = contextDocument(); 1523 if (!document || !document->page()) 1524 return Exception { INVALID_ACCESS_ERR }; 1588 1525 1589 1526 #if ENABLE(PROXIMITY_EVENTS) 1590 1527 DeviceProximityController::from(document->page())->didChangeDeviceProximity(value, min, max); 1591 1528 #else 1592 UNUSED_PARAM(eventType);1593 1529 UNUSED_PARAM(value); 1594 1530 UNUSED_PARAM(min); 1595 1531 UNUSED_PARAM(max); 1596 1532 #endif 1533 return { }; 1597 1534 } 1598 1535 … … 1605 1542 } 1606 1543 1607 bool Internals::hasSpellingMarker(int from, int length , ExceptionCode&)1544 bool Internals::hasSpellingMarker(int from, int length) 1608 1545 { 1609 1546 Document* document = contextDocument(); … … 1616 1553 } 1617 1554 1618 bool Internals::hasAutocorrectedMarker(int from, int length , ExceptionCode&)1555 bool Internals::hasAutocorrectedMarker(int from, int length) 1619 1556 { 1620 1557 Document* document = contextDocument(); … … 1701 1638 } 1702 1639 1703 void Internals::handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length , ExceptionCode&)1640 void Internals::handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length) 1704 1641 { 1705 1642 if (!contextDocument() || !contextDocument()->frame()) … … 1714 1651 } 1715 1652 1716 bool Internals::isOverwriteModeEnabled( ExceptionCode&)1653 bool Internals::isOverwriteModeEnabled() 1717 1654 { 1718 1655 Document* document = contextDocument(); … … 1723 1660 } 1724 1661 1725 void Internals::toggleOverwriteModeEnabled( ExceptionCode&)1662 void Internals::toggleOverwriteModeEnabled() 1726 1663 { 1727 1664 Document* document = contextDocument(); … … 1732 1669 } 1733 1670 1734 unsigned Internals::countMatchesForText(const String& text, unsigned findOptions, const String& markMatches , ExceptionCode&)1671 unsigned Internals::countMatchesForText(const String& text, unsigned findOptions, const String& markMatches) 1735 1672 { 1736 1673 Document* document = contextDocument(); … … 1742 1679 } 1743 1680 1744 unsigned Internals::countFindMatches(const String& text, unsigned findOptions , ExceptionCode&)1681 unsigned Internals::countFindMatches(const String& text, unsigned findOptions) 1745 1682 { 1746 1683 Document* document = contextDocument(); … … 1779 1716 } 1780 1717 1781 void Internals::setInspectorIsUnderTest(bool isUnderTest, ExceptionCode& ec)1718 ExceptionOr<void> Internals::setInspectorIsUnderTest(bool isUnderTest) 1782 1719 { 1783 1720 Page* page = contextDocument()->frame()->page(); 1784 if (!page) { 1785 ec = INVALID_ACCESS_ERR; 1786 return; 1787 } 1721 if (!page) 1722 return Exception { INVALID_ACCESS_ERR }; 1788 1723 1789 1724 page->inspectorController().setIsUnderTest(isUnderTest); 1790 } 1791 1792 bool Internals::hasGrammarMarker(int from, int length, ExceptionCode&) 1725 return { }; 1726 } 1727 1728 bool Internals::hasGrammarMarker(int from, int length) 1793 1729 { 1794 1730 Document* document = contextDocument(); … … 1799 1735 } 1800 1736 1801 unsigned Internals::numberOfScrollableAreas( ExceptionCode&)1737 unsigned Internals::numberOfScrollableAreas() 1802 1738 { 1803 1739 Document* document = contextDocument(); … … 1818 1754 } 1819 1755 1820 bool Internals::isPageBoxVisible(int pageNumber, ExceptionCode& ec) 1821 { 1822 Document* document = contextDocument(); 1823 if (!document) { 1824 ec = INVALID_ACCESS_ERR; 1825 return false; 1826 } 1756 ExceptionOr<bool> Internals::isPageBoxVisible(int pageNumber) 1757 { 1758 Document* document = contextDocument(); 1759 if (!document) 1760 return Exception { INVALID_ACCESS_ERR }; 1827 1761 1828 1762 return document->isPageBoxVisible(pageNumber); … … 1833 1767 // different document, and could just make the call through another Internals 1834 1768 // instance instead. 1835 String Internals::layerTreeAsText(Document& document, unsigned short flags, ExceptionCode& ec) const 1836 { 1837 if (!document.frame()) { 1838 ec = INVALID_ACCESS_ERR; 1839 return String(); 1840 } 1769 ExceptionOr<String> Internals::layerTreeAsText(Document& document, unsigned short flags) const 1770 { 1771 if (!document.frame()) 1772 return Exception { INVALID_ACCESS_ERR }; 1841 1773 1842 1774 LayerTreeFlags layerTreeFlags = 0; … … 1855 1787 } 1856 1788 1857 String Internals::repaintRectsAsText(ExceptionCode& ec) const 1858 { 1859 Document* document = contextDocument(); 1860 if (!document || !document->frame()) { 1861 ec = INVALID_ACCESS_ERR; 1862 return String(); 1863 } 1789 ExceptionOr<String> Internals::repaintRectsAsText() const 1790 { 1791 Document* document = contextDocument(); 1792 if (!document || !document->frame()) 1793 return Exception { INVALID_ACCESS_ERR }; 1864 1794 1865 1795 return document->frame()->trackedRepaintRectsAsText(); 1866 1796 } 1867 1797 1868 String Internals::scrollingStateTreeAsText(ExceptionCode& ec) const 1869 { 1870 Document* document = contextDocument(); 1871 if (!document || !document->frame()) { 1872 ec = INVALID_ACCESS_ERR; 1873 return String(); 1874 } 1798 ExceptionOr<String> Internals::scrollingStateTreeAsText() const 1799 { 1800 Document* document = contextDocument(); 1801 if (!document || !document->frame()) 1802 return Exception { INVALID_ACCESS_ERR }; 1875 1803 1876 1804 Page* page = document->page(); … … 1881 1809 } 1882 1810 1883 String Internals::mainThreadScrollingReasons(ExceptionCode& ec) const 1884 { 1885 Document* document = contextDocument(); 1886 if (!document || !document->frame()) { 1887 ec = INVALID_ACCESS_ERR; 1888 return String(); 1889 } 1811 ExceptionOr<String> Internals::mainThreadScrollingReasons() const 1812 { 1813 Document* document = contextDocument(); 1814 if (!document || !document->frame()) 1815 return Exception { INVALID_ACCESS_ERR }; 1890 1816 1891 1817 Page* page = document->page(); … … 1896 1822 } 1897 1823 1898 RefPtr<ClientRectList> Internals::nonFastScrollableRects(ExceptionCode& ec) const 1899 { 1900 Document* document = contextDocument(); 1901 if (!document || !document->frame()) { 1902 ec = INVALID_ACCESS_ERR; 1903 return nullptr; 1904 } 1824 ExceptionOr<RefPtr<ClientRectList>> Internals::nonFastScrollableRects() const 1825 { 1826 Document* document = contextDocument(); 1827 if (!document || !document->frame()) 1828 return Exception { INVALID_ACCESS_ERR }; 1905 1829 1906 1830 Page* page = document->page(); … … 1908 1832 return nullptr; 1909 1833 1910 return page->nonFastScrollableRects(); 1911 } 1912 1913 void Internals::setElementUsesDisplayListDrawing(Element& element, bool usesDisplayListDrawing, ExceptionCode& ec) 1914 { 1915 Document* document = contextDocument(); 1916 if (!document || !document->renderView()) { 1917 ec = INVALID_ACCESS_ERR; 1918 return; 1919 } 1920 1921 if (!element.renderer()) { 1922 ec = INVALID_ACCESS_ERR; 1923 return; 1924 } 1834 return RefPtr<ClientRectList> { page->nonFastScrollableRects() }; 1835 } 1836 1837 ExceptionOr<void> Internals::setElementUsesDisplayListDrawing(Element& element, bool usesDisplayListDrawing) 1838 { 1839 Document* document = contextDocument(); 1840 if (!document || !document->renderView()) 1841 return Exception { INVALID_ACCESS_ERR }; 1842 1843 if (!element.renderer()) 1844 return Exception { INVALID_ACCESS_ERR }; 1925 1845 1926 1846 if (is<HTMLCanvasElement>(element)) { 1927 1847 downcast<HTMLCanvasElement>(element).setUsesDisplayListDrawing(usesDisplayListDrawing); 1928 return ;1848 return { }; 1929 1849 } 1930 1850 1931 if (!element.renderer()->hasLayer()) { 1932 ec = INVALID_ACCESS_ERR; 1933 return; 1934 } 1851 if (!element.renderer()->hasLayer()) 1852 return Exception { INVALID_ACCESS_ERR }; 1935 1853 1936 1854 RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer(); 1937 if (!layer->isComposited()) { 1938 ec = INVALID_ACCESS_ERR; 1939 return; 1940 } 1855 if (!layer->isComposited()) 1856 return Exception { INVALID_ACCESS_ERR }; 1941 1857 1942 1858 layer->backing()->setUsesDisplayListDrawing(usesDisplayListDrawing); 1943 } 1944 1945 void Internals::setElementTracksDisplayListReplay(Element& element, bool isTrackingReplay, ExceptionCode& ec) 1946 { 1947 Document* document = contextDocument(); 1948 if (!document || !document->renderView()) { 1949 ec = INVALID_ACCESS_ERR; 1950 return; 1951 } 1952 1953 if (!element.renderer()) { 1954 ec = INVALID_ACCESS_ERR; 1955 return; 1956 } 1859 return { }; 1860 } 1861 1862 ExceptionOr<void> Internals::setElementTracksDisplayListReplay(Element& element, bool isTrackingReplay) 1863 { 1864 Document* document = contextDocument(); 1865 if (!document || !document->renderView()) 1866 return Exception { INVALID_ACCESS_ERR }; 1867 1868 if (!element.renderer()) 1869 return Exception { INVALID_ACCESS_ERR }; 1957 1870 1958 1871 if (is<HTMLCanvasElement>(element)) { 1959 1872 downcast<HTMLCanvasElement>(element).setTracksDisplayListReplay(isTrackingReplay); 1960 return ;1873 return { }; 1961 1874 } 1962 1875 1963 if (!element.renderer()->hasLayer()) { 1964 ec = INVALID_ACCESS_ERR; 1965 return; 1966 } 1876 if (!element.renderer()->hasLayer()) 1877 return Exception { INVALID_ACCESS_ERR }; 1967 1878 1968 1879 RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer(); 1969 if (!layer->isComposited()) { 1970 ec = INVALID_ACCESS_ERR; 1971 return; 1972 } 1880 if (!layer->isComposited()) 1881 return Exception { INVALID_ACCESS_ERR }; 1973 1882 1974 1883 layer->backing()->setIsTrackingDisplayListReplay(isTrackingReplay); 1975 } 1976 1977 String Internals::displayListForElement(Element& element, unsigned short flags, ExceptionCode& ec) 1978 { 1979 Document* document = contextDocument(); 1980 if (!document || !document->renderView()) { 1981 ec = INVALID_ACCESS_ERR; 1982 return String(); 1983 } 1984 1985 if (!element.renderer()) { 1986 ec = INVALID_ACCESS_ERR; 1987 return String(); 1988 } 1884 return { }; 1885 } 1886 1887 ExceptionOr<String> Internals::displayListForElement(Element& element, unsigned short flags) 1888 { 1889 Document* document = contextDocument(); 1890 if (!document || !document->renderView()) 1891 return Exception { INVALID_ACCESS_ERR }; 1892 1893 if (!element.renderer()) 1894 return Exception { INVALID_ACCESS_ERR }; 1989 1895 1990 1896 DisplayList::AsTextFlags displayListFlags = 0; … … 1995 1901 return downcast<HTMLCanvasElement>(element).displayListAsText(displayListFlags); 1996 1902 1997 if (!element.renderer()->hasLayer()) { 1998 ec = INVALID_ACCESS_ERR; 1999 return String(); 2000 } 1903 if (!element.renderer()->hasLayer()) 1904 return Exception { INVALID_ACCESS_ERR }; 2001 1905 2002 1906 RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer(); 2003 if (!layer->isComposited()) { 2004 ec = INVALID_ACCESS_ERR; 2005 return String(); 2006 } 1907 if (!layer->isComposited()) 1908 return Exception { INVALID_ACCESS_ERR }; 2007 1909 2008 1910 return layer->backing()->displayListAsText(displayListFlags); 2009 1911 } 2010 1912 2011 String Internals::replayDisplayListForElement(Element& element, unsigned short flags, ExceptionCode& ec) 2012 { 2013 Document* document = contextDocument(); 2014 if (!document || !document->renderView()) { 2015 ec = INVALID_ACCESS_ERR; 2016 return String(); 2017 } 2018 2019 if (!element.renderer()) { 2020 ec = INVALID_ACCESS_ERR; 2021 return String(); 2022 } 1913 ExceptionOr<String> Internals::replayDisplayListForElement(Element& element, unsigned short flags) 1914 { 1915 Document* document = contextDocument(); 1916 if (!document || !document->renderView()) 1917 return Exception { INVALID_ACCESS_ERR }; 1918 1919 if (!element.renderer()) 1920 return Exception { INVALID_ACCESS_ERR }; 2023 1921 2024 1922 DisplayList::AsTextFlags displayListFlags = 0; … … 2029 1927 return downcast<HTMLCanvasElement>(element).replayDisplayListAsText(displayListFlags); 2030 1928 2031 if (!element.renderer()->hasLayer()) { 2032 ec = INVALID_ACCESS_ERR; 2033 return String(); 2034 } 1929 if (!element.renderer()->hasLayer()) 1930 return Exception { INVALID_ACCESS_ERR }; 2035 1931 2036 1932 RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer(); 2037 if (!layer->isComposited()) { 2038 ec = INVALID_ACCESS_ERR; 2039 return String(); 2040 } 1933 if (!layer->isComposited()) 1934 return Exception { INVALID_ACCESS_ERR }; 2041 1935 2042 1936 return layer->backing()->replayDisplayListAsText(displayListFlags); 2043 1937 } 2044 1938 2045 void Internals::garbageCollectDocumentResources(ExceptionCode& ec) const 2046 { 2047 Document* document = contextDocument(); 2048 if (!document) { 2049 ec = INVALID_ACCESS_ERR; 2050 return; 2051 } 1939 ExceptionOr<void> Internals::garbageCollectDocumentResources() const 1940 { 1941 Document* document = contextDocument(); 1942 if (!document) 1943 return Exception { INVALID_ACCESS_ERR }; 2052 1944 document->cachedResourceLoader().garbageCollectDocumentResources(); 1945 return { }; 2053 1946 } 2054 1947 … … 2068 1961 } 2069 1962 2070 void Internals::insertAuthorCSS(const String& css, ExceptionCode& ec) const 2071 { 2072 Document* document = contextDocument(); 2073 if (!document) { 2074 ec = INVALID_ACCESS_ERR; 2075 return; 2076 } 1963 ExceptionOr<void> Internals::insertAuthorCSS(const String& css) const 1964 { 1965 Document* document = contextDocument(); 1966 if (!document) 1967 return Exception { INVALID_ACCESS_ERR }; 2077 1968 2078 1969 auto parsedSheet = StyleSheetContents::create(*document); … … 2080 1971 parsedSheet.get().parseString(css); 2081 1972 document->extensionStyleSheets().addAuthorStyleSheetForTesting(WTFMove(parsedSheet)); 2082 } 2083 2084 void Internals::insertUserCSS(const String& css, ExceptionCode& ec) const 2085 { 2086 Document* document = contextDocument(); 2087 if (!document) { 2088 ec = INVALID_ACCESS_ERR; 2089 return; 2090 } 1973 return { }; 1974 } 1975 1976 ExceptionOr<void> Internals::insertUserCSS(const String& css) const 1977 { 1978 Document* document = contextDocument(); 1979 if (!document) 1980 return Exception { INVALID_ACCESS_ERR }; 2091 1981 2092 1982 auto parsedSheet = StyleSheetContents::create(*document); … … 2094 1984 parsedSheet.get().parseString(css); 2095 1985 document->extensionStyleSheets().addUserStyleSheet(WTFMove(parsedSheet)); 1986 return { }; 2096 1987 } 2097 1988 … … 2127 2018 } 2128 2019 2129 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode& ec) const 2130 { 2131 if (!frame()) { 2132 ec = INVALID_ACCESS_ERR; 2133 return String(); 2134 } 2020 ExceptionOr<String> Internals::pageProperty(const String& propertyName, int pageNumber) const 2021 { 2022 if (!frame()) 2023 return Exception { INVALID_ACCESS_ERR }; 2135 2024 2136 2025 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageNumber); 2137 2026 } 2138 2027 2139 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionCode& ec) const 2140 { 2141 if (!frame()) { 2142 ec = INVALID_ACCESS_ERR; 2143 return String(); 2144 } 2028 ExceptionOr<String> Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const 2029 { 2030 if (!frame()) 2031 return Exception { INVALID_ACCESS_ERR }; 2145 2032 2146 2033 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft); 2147 2034 } 2148 2035 2149 void Internals::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode& ec) 2150 { 2151 Document* document = contextDocument(); 2152 if (!document || !document->page()) { 2153 ec = INVALID_ACCESS_ERR; 2154 return; 2155 } 2156 Page* page = document->page(); 2157 page->setPageScaleFactor(scaleFactor, IntPoint(x, y)); 2158 } 2159 2160 void Internals::setPageZoomFactor(float zoomFactor, ExceptionCode& ec) 2161 { 2162 Document* document = contextDocument(); 2163 if (!document || !document->frame()) { 2164 ec = INVALID_ACCESS_ERR; 2165 return; 2166 } 2167 Frame* frame = document->frame(); 2168 frame->setPageZoomFactor(zoomFactor); 2169 } 2170 2171 void Internals::setTextZoomFactor(float zoomFactor, ExceptionCode& ec) 2172 { 2173 Document* document = contextDocument(); 2174 if (!document || !document->frame()) { 2175 ec = INVALID_ACCESS_ERR; 2176 return; 2177 } 2178 Frame* frame = document->frame(); 2179 frame->setTextZoomFactor(zoomFactor); 2180 } 2181 2182 void Internals::setUseFixedLayout(bool useFixedLayout, ExceptionCode& ec) 2183 { 2184 Document* document = contextDocument(); 2185 if (!document || !document->view()) { 2186 ec = INVALID_ACCESS_ERR; 2187 return; 2188 } 2189 FrameView* frameView = document->view(); 2190 frameView->setUseFixedLayout(useFixedLayout); 2191 } 2192 2193 void Internals::setFixedLayoutSize(int width, int height, ExceptionCode& ec) 2194 { 2195 Document* document = contextDocument(); 2196 if (!document || !document->view()) { 2197 ec = INVALID_ACCESS_ERR; 2198 return; 2199 } 2200 FrameView* frameView = document->view(); 2201 frameView->setFixedLayoutSize(IntSize(width, height)); 2202 } 2203 2204 void Internals::setViewExposedRect(float x, float y, float width, float height, ExceptionCode& ec) 2205 { 2206 Document* document = contextDocument(); 2207 if (!document || !document->view()) { 2208 ec = INVALID_ACCESS_ERR; 2209 return; 2210 } 2211 2212 FrameView* frameView = document->view(); 2213 frameView->setViewExposedRect(FloatRect(x, y, width, height)); 2036 ExceptionOr<void> Internals::setPageScaleFactor(float scaleFactor, int x, int y) 2037 { 2038 Document* document = contextDocument(); 2039 if (!document || !document->page()) 2040 return Exception { INVALID_ACCESS_ERR }; 2041 2042 document->page()->setPageScaleFactor(scaleFactor, IntPoint(x, y)); 2043 return { }; 2044 } 2045 2046 ExceptionOr<void> Internals::setPageZoomFactor(float zoomFactor) 2047 { 2048 Document* document = contextDocument(); 2049 if (!document || !document->frame()) 2050 return Exception { INVALID_ACCESS_ERR }; 2051 2052 document->frame()->setPageZoomFactor(zoomFactor); 2053 return { }; 2054 } 2055 2056 ExceptionOr<void> Internals::setTextZoomFactor(float zoomFactor) 2057 { 2058 Document* document = contextDocument(); 2059 if (!document || !document->frame()) 2060 return Exception { INVALID_ACCESS_ERR }; 2061 2062 document->frame()->setTextZoomFactor(zoomFactor); 2063 return { }; 2064 } 2065 2066 ExceptionOr<void> Internals::setUseFixedLayout(bool useFixedLayout) 2067 { 2068 Document* document = contextDocument(); 2069 if (!document || !document->view()) 2070 return Exception { INVALID_ACCESS_ERR }; 2071 2072 document->view()->setUseFixedLayout(useFixedLayout); 2073 return { }; 2074 } 2075 2076 ExceptionOr<void> Internals::setFixedLayoutSize(int width, int height) 2077 { 2078 Document* document = contextDocument(); 2079 if (!document || !document->view()) 2080 return Exception { INVALID_ACCESS_ERR }; 2081 2082 document->view()->setFixedLayoutSize(IntSize(width, height)); 2083 return { }; 2084 } 2085 2086 ExceptionOr<void> Internals::setViewExposedRect(float x, float y, float width, float height) 2087 { 2088 Document* document = contextDocument(); 2089 if (!document || !document->view()) 2090 return Exception { INVALID_ACCESS_ERR }; 2091 2092 document->view()->setViewExposedRect(FloatRect(x, y, width, height)); 2093 return { }; 2214 2094 } 2215 2095 … … 2220 2100 return; 2221 2101 2222 FrameView* frameView = document->view(); 2223 frameView->setHeaderHeight(height); 2102 document->view()->setHeaderHeight(height); 2224 2103 } 2225 2104 … … 2230 2109 return; 2231 2110 2232 FrameView* frameView = document->view(); 2233 frameView->setFooterHeight(height); 2111 document->view()->setFooterHeight(height); 2234 2112 } 2235 2113 … … 2237 2115 { 2238 2116 Document* document = contextDocument(); 2239 if (!document )2117 if (!document || !document->page()) 2240 2118 return; 2241 2242 Page* page = document->page(); 2243 page->setTopContentInset(contentInset); 2119 2120 document->page()->setTopContentInset(contentInset); 2244 2121 } 2245 2122 2246 2123 #if ENABLE(FULLSCREEN_API) 2124 2247 2125 void Internals::webkitWillEnterFullScreenForElement(Element& element) 2248 2126 { … … 2276 2154 document->webkitDidExitFullScreenForElement(&element); 2277 2155 } 2156 2278 2157 #endif 2279 2158 … … 2281 2160 { 2282 2161 Document* document = contextDocument(); 2283 if (!document )2162 if (!document || !document->page()) 2284 2163 return; 2285 2164 document->page()->applicationCacheStorage().storeUpdatedQuotaForOrigin(document->securityOrigin(), quota); … … 2317 2196 } 2318 2197 2319 void Internals::startTrackingRepaints(ExceptionCode& ec) 2320 { 2321 Document* document = contextDocument(); 2322 if (!document || !document->view()) { 2323 ec = INVALID_ACCESS_ERR; 2324 return; 2325 } 2326 2327 FrameView* frameView = document->view(); 2328 frameView->setTracksRepaints(true); 2329 } 2330 2331 void Internals::stopTrackingRepaints(ExceptionCode& ec) 2332 { 2333 Document* document = contextDocument(); 2334 if (!document || !document->view()) { 2335 ec = INVALID_ACCESS_ERR; 2336 return; 2337 } 2338 2339 FrameView* frameView = document->view(); 2340 frameView->setTracksRepaints(false); 2341 } 2342 2343 void Internals::startTrackingLayerFlushes(ExceptionCode& ec) 2344 { 2345 Document* document = contextDocument(); 2346 if (!document || !document->renderView()) { 2347 ec = INVALID_ACCESS_ERR; 2348 return; 2349 } 2198 ExceptionOr<void> Internals::startTrackingRepaints() 2199 { 2200 Document* document = contextDocument(); 2201 if (!document || !document->view()) 2202 return Exception { INVALID_ACCESS_ERR }; 2203 2204 document->view()->setTracksRepaints(true); 2205 return { }; 2206 } 2207 2208 ExceptionOr<void> Internals::stopTrackingRepaints() 2209 { 2210 Document* document = contextDocument(); 2211 if (!document || !document->view()) 2212 return Exception { INVALID_ACCESS_ERR }; 2213 2214 document->view()->setTracksRepaints(false); 2215 return { }; 2216 } 2217 2218 ExceptionOr<void> Internals::startTrackingLayerFlushes() 2219 { 2220 Document* document = contextDocument(); 2221 if (!document || !document->renderView()) 2222 return Exception { INVALID_ACCESS_ERR }; 2350 2223 2351 2224 document->renderView()->compositor().startTrackingLayerFlushes(); 2352 } 2353 2354 unsigned Internals::layerFlushCount(ExceptionCode& ec) 2355 { 2356 Document* document = contextDocument(); 2357 if (!document || !document->renderView()) { 2358 ec = INVALID_ACCESS_ERR; 2359 return 0; 2360 } 2225 return { }; 2226 } 2227 2228 ExceptionOr<unsigned> Internals::layerFlushCount() 2229 { 2230 Document* document = contextDocument(); 2231 if (!document || !document->renderView()) 2232 return Exception { INVALID_ACCESS_ERR }; 2361 2233 2362 2234 return document->renderView()->compositor().layerFlushCount(); 2363 2235 } 2364 2236 2365 void Internals::startTrackingStyleRecalcs(ExceptionCode& ec) 2366 { 2367 Document* document = contextDocument(); 2368 if (!document) { 2369 ec = INVALID_ACCESS_ERR; 2370 return; 2371 } 2237 ExceptionOr<void> Internals::startTrackingStyleRecalcs() 2238 { 2239 Document* document = contextDocument(); 2240 if (!document) 2241 return Exception { INVALID_ACCESS_ERR }; 2242 2372 2243 document->startTrackingStyleRecalcs(); 2373 } 2374 2375 unsigned Internals::styleRecalcCount(ExceptionCode& ec) 2376 { 2377 Document* document = contextDocument(); 2378 if (!document) { 2379 ec = INVALID_ACCESS_ERR; 2380 return 0; 2381 } 2244 return { }; 2245 } 2246 2247 ExceptionOr<unsigned> Internals::styleRecalcCount() 2248 { 2249 Document* document = contextDocument(); 2250 if (!document) 2251 return Exception { INVALID_ACCESS_ERR }; 2382 2252 2383 2253 return document->styleRecalcCount(); … … 2392 2262 } 2393 2263 2394 void Internals::startTrackingCompositingUpdates(ExceptionCode& ec) 2395 { 2396 Document* document = contextDocument(); 2397 if (!document || !document->renderView()) { 2398 ec = INVALID_ACCESS_ERR; 2399 return; 2400 } 2264 ExceptionOr<void> Internals::startTrackingCompositingUpdates() 2265 { 2266 Document* document = contextDocument(); 2267 if (!document || !document->renderView()) 2268 return Exception { INVALID_ACCESS_ERR }; 2401 2269 2402 2270 document->renderView()->compositor().startTrackingCompositingUpdates(); 2403 } 2404 2405 unsigned Internals::compositingUpdateCount(ExceptionCode& ec) 2406 { 2407 Document* document = contextDocument(); 2408 if (!document || !document->renderView()) { 2409 ec = INVALID_ACCESS_ERR; 2410 return 0; 2411 } 2271 return { }; 2272 } 2273 2274 ExceptionOr<unsigned> Internals::compositingUpdateCount() 2275 { 2276 Document* document = contextDocument(); 2277 if (!document || !document->renderView()) 2278 return Exception { INVALID_ACCESS_ERR }; 2412 2279 2413 2280 return document->renderView()->compositor().compositingUpdateCount(); 2414 2281 } 2415 2282 2416 void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node* node, ExceptionCode& ec)2283 ExceptionOr<void> Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node* node) 2417 2284 { 2418 2285 Document* document; … … 2423 2290 else if (is<HTMLIFrameElement>(*node)) 2424 2291 document = downcast<HTMLIFrameElement>(*node).contentDocument(); 2425 else { 2426 ec = TypeError; 2427 return; 2428 } 2292 else 2293 return Exception { TypeError }; 2429 2294 2430 2295 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously); 2296 return { }; 2431 2297 } 2432 2298 … … 2494 2360 #endif 2495 2361 2496 String Internals::getCurrentCursorInfo(ExceptionCode& ec) 2497 { 2498 Document* document = contextDocument(); 2499 if (!document || !document->frame()) { 2500 ec = INVALID_ACCESS_ERR; 2501 return String(); 2502 } 2362 ExceptionOr<String> Internals::getCurrentCursorInfo() 2363 { 2364 Document* document = contextDocument(); 2365 if (!document || !document->frame()) 2366 return Exception { INVALID_ACCESS_ERR }; 2503 2367 2504 2368 #if !PLATFORM(IOS) … … 2528 2392 return result.toString(); 2529 2393 #else 2530 return "FAIL: Cursor details not available on this platform.";2394 return String { "FAIL: Cursor details not available on this platform." }; 2531 2395 #endif 2532 2396 } … … 2612 2476 } 2613 2477 2614 bool Internals::mediaElementHasCharacteristic(HTMLMediaElement& element, const String& characteristic, ExceptionCode& ec)2478 ExceptionOr<bool> Internals::mediaElementHasCharacteristic(HTMLMediaElement& element, const String& characteristic) 2615 2479 { 2616 2480 if (equalLettersIgnoringASCIICase(characteristic, "audible")) … … 2621 2485 return element.hasClosedCaptions(); 2622 2486 2623 ec = SYNTAX_ERR;2624 return false; 2625 } 2487 return Exception { SYNTAX_ERR }; 2488 } 2489 2626 2490 #endif 2627 2491 … … 2640 2504 } 2641 2505 2642 String Internals::captionsStyleSheetOverride(ExceptionCode& ec) 2643 { 2644 Document* document = contextDocument(); 2645 if (!document || !document->page()) { 2646 ec = INVALID_ACCESS_ERR; 2647 return emptyString(); 2648 } 2506 ExceptionOr<String> Internals::captionsStyleSheetOverride() 2507 { 2508 Document* document = contextDocument(); 2509 if (!document || !document->page()) 2510 return Exception { INVALID_ACCESS_ERR }; 2649 2511 2650 2512 #if ENABLE(VIDEO_TRACK) … … 2655 2517 } 2656 2518 2657 void Internals::setCaptionsStyleSheetOverride(const String& override, ExceptionCode& ec) 2658 { 2659 Document* document = contextDocument(); 2660 if (!document || !document->page()) { 2661 ec = INVALID_ACCESS_ERR; 2662 return; 2663 } 2519 ExceptionOr<void> Internals::setCaptionsStyleSheetOverride(const String& override) 2520 { 2521 Document* document = contextDocument(); 2522 if (!document || !document->page()) 2523 return Exception { INVALID_ACCESS_ERR }; 2664 2524 2665 2525 #if ENABLE(VIDEO_TRACK) … … 2668 2528 UNUSED_PARAM(override); 2669 2529 #endif 2670 } 2671 2672 void Internals::setPrimaryAudioTrackLanguageOverride(const String& language, ExceptionCode& ec) 2673 { 2674 Document* document = contextDocument(); 2675 if (!document || !document->page()) { 2676 ec = INVALID_ACCESS_ERR; 2677 return; 2678 } 2530 return { }; 2531 } 2532 2533 ExceptionOr<void> Internals::setPrimaryAudioTrackLanguageOverride(const String& language) 2534 { 2535 Document* document = contextDocument(); 2536 if (!document || !document->page()) 2537 return Exception { INVALID_ACCESS_ERR }; 2679 2538 2680 2539 #if ENABLE(VIDEO_TRACK) … … 2683 2542 UNUSED_PARAM(language); 2684 2543 #endif 2685 } 2686 2687 void Internals::setCaptionDisplayMode(const String& mode, ExceptionCode& ec) 2688 { 2689 Document* document = contextDocument(); 2690 if (!document || !document->page()) { 2691 ec = INVALID_ACCESS_ERR; 2692 return; 2693 } 2544 return { }; 2545 } 2546 2547 ExceptionOr<void> Internals::setCaptionDisplayMode(const String& mode) 2548 { 2549 Document* document = contextDocument(); 2550 if (!document || !document->page()) 2551 return Exception { INVALID_ACCESS_ERR }; 2694 2552 2695 2553 #if ENABLE(VIDEO_TRACK) … … 2705 2563 captionPreferences.setCaptionDisplayMode(CaptionUserPreferences::Manual); 2706 2564 else 2707 ec = SYNTAX_ERR;2565 return Exception { SYNTAX_ERR }; 2708 2566 #else 2709 2567 UNUSED_PARAM(mode); 2710 2568 #endif 2569 return { }; 2711 2570 } 2712 2571 2713 2572 #if ENABLE(VIDEO) 2573 2714 2574 Ref<TimeRanges> Internals::createTimeRanges(Float32Array& startTimes, Float32Array& endTimes) 2715 2575 { … … 2727 2587 return ranges.nearest(time); 2728 2588 } 2729 #endif 2730 2731 Ref<ClientRect> Internals::selectionBounds(ExceptionCode& ec) 2732 { 2733 Document* document = contextDocument(); 2734 if (!document || !document->frame()) { 2735 ec = INVALID_ACCESS_ERR; 2736 return ClientRect::create(); 2737 } 2589 2590 #endif 2591 2592 ExceptionOr<Ref<ClientRect>> Internals::selectionBounds() 2593 { 2594 Document* document = contextDocument(); 2595 if (!document || !document->frame()) 2596 return Exception { INVALID_ACCESS_ERR }; 2738 2597 2739 2598 return ClientRect::create(document->frame()->selection().selectionBounds()); … … 2741 2600 2742 2601 #if ENABLE(VIBRATION) 2602 2743 2603 bool Internals::isVibrating() 2744 2604 { 2745 Page* page = contextDocument()->page();2746 ASSERT(page);2747 2748 return Vibration::from(page)->isVibrating(); 2749 } 2750 #endif 2751 2752 bool Internals::isPluginUnavailabilityIndicatorObscured(Element& element, ExceptionCode& ec)2605 auto* document = contextDocument(); 2606 auto* page = document ? document->page() : nullptr; 2607 return page && Vibration::from(page)->isVibrating(); 2608 } 2609 2610 #endif 2611 2612 ExceptionOr<bool> Internals::isPluginUnavailabilityIndicatorObscured(Element& element) 2753 2613 { 2754 2614 auto* renderer = element.renderer(); 2755 if (!is<RenderEmbeddedObject>(renderer)) { 2756 ec = INVALID_ACCESS_ERR; 2757 return false; 2758 } 2615 if (!is<RenderEmbeddedObject>(renderer)) 2616 return Exception { INVALID_ACCESS_ERR }; 2759 2617 2760 2618 return downcast<RenderEmbeddedObject>(*renderer).isReplacementObscured(); … … 2795 2653 #if ENABLE(VIDEO) 2796 2654 2797 void Internals::beginMediaSessionInterruption(const String& interruptionString, ExceptionCode& ec)2655 ExceptionOr<void> Internals::beginMediaSessionInterruption(const String& interruptionString) 2798 2656 { 2799 2657 PlatformMediaSession::InterruptionType interruption = PlatformMediaSession::SystemInterruption; … … 2807 2665 else if (equalLettersIgnoringASCIICase(interruptionString, "suspendedunderlock")) 2808 2666 interruption = PlatformMediaSession::SuspendedUnderLock; 2809 else { 2810 ec = INVALID_ACCESS_ERR; 2811 return; 2812 } 2667 else 2668 return Exception { INVALID_ACCESS_ERR }; 2813 2669 2814 2670 PlatformMediaSessionManager::sharedManager().beginInterruption(interruption); 2671 return { }; 2815 2672 } 2816 2673 … … 2835 2692 } 2836 2693 2837 void Internals::setMediaSessionRestrictions(const String& mediaTypeString, const String& restrictionsString, ExceptionCode& ec)2694 ExceptionOr<void> Internals::setMediaSessionRestrictions(const String& mediaTypeString, const String& restrictionsString) 2838 2695 { 2839 2696 PlatformMediaSession::MediaType mediaType = PlatformMediaSession::None; … … 2844 2701 else if (equalLettersIgnoringASCIICase(mediaTypeString, "webaudio")) 2845 2702 mediaType = PlatformMediaSession::WebAudio; 2846 else { 2847 ec = INVALID_ACCESS_ERR; 2848 return; 2849 } 2703 else 2704 return Exception { INVALID_ACCESS_ERR }; 2850 2705 2851 2706 PlatformMediaSessionManager::SessionRestrictions restrictions = PlatformMediaSessionManager::sharedManager().restrictions(mediaType); … … 2867 2722 } 2868 2723 PlatformMediaSessionManager::sharedManager().addRestriction(mediaType, restrictions); 2724 return { }; 2869 2725 } 2870 2726 … … 2911 2767 } 2912 2768 2913 void Internals::postRemoteControlCommand(const String& commandString, float argument, ExceptionCode& ec)2769 ExceptionOr<void> Internals::postRemoteControlCommand(const String& commandString, float argument) 2914 2770 { 2915 2771 PlatformMediaSession::RemoteControlCommandType command; … … 2934 2790 else if (equalLettersIgnoringASCIICase(commandString, "seektoplaybackposition")) 2935 2791 command = PlatformMediaSession::SeekToPlaybackPositionCommand; 2936 else { 2937 ec = INVALID_ACCESS_ERR; 2938 return; 2939 } 2792 else 2793 return Exception { INVALID_ACCESS_ERR }; 2940 2794 2941 2795 PlatformMediaSessionManager::sharedManager().didReceiveRemoteControlCommand(command, ¶meter); 2796 return { }; 2942 2797 } 2943 2798 … … 3045 2900 } 3046 2901 3047 void Internals::setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState, ExceptionCode& ec)2902 ExceptionOr<void> Internals::setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState) 3048 2903 { 3049 2904 Page* page = contextDocument()->frame()->page(); … … 3058 2913 else if (equalLettersIgnoringASCIICase(deviceState, "unknown")) 3059 2914 state = MediaPlaybackTargetContext::Unknown; 3060 else { 3061 ec = INVALID_ACCESS_ERR; 3062 return; 3063 } 2915 else 2916 return Exception { INVALID_ACCESS_ERR }; 3064 2917 3065 2918 page->setMockMediaPlaybackTargetPickerState(deviceName, state); 3066 } 3067 3068 #endif 3069 3070 RefPtr<MockPageOverlay> Internals::installMockPageOverlay(PageOverlayType type, ExceptionCode& ec) 3071 { 3072 Document* document = contextDocument(); 3073 if (!document || !document->frame()) { 3074 ec = INVALID_ACCESS_ERR; 3075 return nullptr; 3076 } 2919 return { }; 2920 } 2921 2922 #endif 2923 2924 ExceptionOr<Ref<MockPageOverlay>> Internals::installMockPageOverlay(PageOverlayType type) 2925 { 2926 Document* document = contextDocument(); 2927 if (!document || !document->frame()) 2928 return Exception { INVALID_ACCESS_ERR }; 3077 2929 3078 2930 return MockPageOverlayClient::singleton().installOverlay(document->frame()->mainFrame(), type == PageOverlayType::View ? PageOverlay::OverlayType::View : PageOverlay::OverlayType::Document); 3079 2931 } 3080 2932 3081 String Internals::pageOverlayLayerTreeAsText(ExceptionCode& ec) const 3082 { 3083 Document* document = contextDocument(); 3084 if (!document || !document->frame()) { 3085 ec = INVALID_ACCESS_ERR; 3086 return String(); 3087 } 2933 ExceptionOr<String> Internals::pageOverlayLayerTreeAsText() const 2934 { 2935 Document* document = contextDocument(); 2936 if (!document || !document->frame()) 2937 return Exception { INVALID_ACCESS_ERR }; 3088 2938 3089 2939 document->updateLayout(); … … 3173 3023 } 3174 3024 3175 String Internals::scrollSnapOffsets(Element& element, ExceptionCode& ec)3025 ExceptionOr<String> Internals::scrollSnapOffsets(Element& element) 3176 3026 { 3177 3027 if (!element.renderBox()) … … 3183 3033 if (box.isBody()) { 3184 3034 FrameView* frameView = box.frame().mainFrame().view(); 3185 if (!frameView || !frameView->isScrollable()) { 3186 ec = INVALID_ACCESS_ERR; 3187 return String(); 3188 } 3035 if (!frameView || !frameView->isScrollable()) 3036 return Exception { INVALID_ACCESS_ERR }; 3189 3037 scrollableArea = frameView; 3190 3038 3191 3039 } else { 3192 if (!box.canBeScrolledAndHasScrollableArea()) { 3193 ec = INVALID_ACCESS_ERR; 3194 return String(); 3195 } 3040 if (!box.canBeScrolledAndHasScrollableArea()) 3041 return Exception { INVALID_ACCESS_ERR }; 3196 3042 scrollableArea = box.layer(); 3197 3043 } … … 3225 3071 } 3226 3072 3227 String Internals::pathStringWithShrinkWrappedRects(Vector<double> rectComponents, double radius, ExceptionCode& ec) 3228 { 3229 if (rectComponents.size() % 4) { 3230 ec = INVALID_ACCESS_ERR; 3231 return String(); 3232 } 3073 ExceptionOr<String> Internals::pathStringWithShrinkWrappedRects(const Vector<double>& rectComponents, double radius) 3074 { 3075 if (rectComponents.size() % 4) 3076 return Exception { INVALID_ACCESS_ERR }; 3233 3077 3234 3078 Vector<FloatRect> rects; 3235 while (!rectComponents.isEmpty()) { 3236 double height = rectComponents.takeLast(); 3237 double width = rectComponents.takeLast(); 3238 double y = rectComponents.takeLast(); 3239 double x = rectComponents.takeLast(); 3240 3241 rects.append(FloatRect(x, y, width, height)); 3242 } 3243 3244 rects.reverse(); 3245 3246 Path path = PathUtilities::pathWithShrinkWrappedRects(rects, radius); 3247 3248 String pathString; 3249 buildStringFromPath(path, pathString); 3250 3251 return pathString; 3079 for (unsigned i = 0; i < rectComponents.size(); i += 4) 3080 rects.append(FloatRect(rectComponents[i], rectComponents[i + 1], rectComponents[i + 2], rectComponents[i + 3])); 3081 3082 SVGPathStringBuilder builder; 3083 PathUtilities::pathWithShrinkWrappedRects(rects, radius).apply([&builder](const PathElement& element) { 3084 switch (element.type) { 3085 case PathElementMoveToPoint: 3086 builder.moveTo(element.points[0], false, AbsoluteCoordinates); 3087 return; 3088 case PathElementAddLineToPoint: 3089 builder.lineTo(element.points[0], AbsoluteCoordinates); 3090 return; 3091 case PathElementAddQuadCurveToPoint: 3092 builder.curveToQuadratic(element.points[0], element.points[1], AbsoluteCoordinates); 3093 return; 3094 case PathElementAddCurveToPoint: 3095 builder.curveToCubic(element.points[0], element.points[1], element.points[2], AbsoluteCoordinates); 3096 return; 3097 case PathElementCloseSubpath: 3098 builder.closePath(); 3099 return; 3100 } 3101 ASSERT_NOT_REACHED(); 3102 }); 3103 return builder.result(); 3252 3104 } 3253 3105 … … 3313 3165 #endif 3314 3166 3315 String Internals::resourceLoadStatisticsForOrigin( Stringorigin)3167 String Internals::resourceLoadStatisticsForOrigin(const String& origin) 3316 3168 { 3317 3169 return ResourceLoadObserver::sharedObserver().statisticsForOrigin(origin); … … 3336 3188 3337 3189 #if ENABLE(CSS_GRID_LAYOUT) 3190 3338 3191 void Internals::setCSSGridLayoutEnabled(bool enable) 3339 3192 { 3340 3193 RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enable); 3341 3194 } 3195 3342 3196 #endif 3343 3197 3344 3198 #if ENABLE(WEBGL2) 3199 3345 3200 bool Internals::webGL2Enabled() const 3346 3201 { … … 3352 3207 RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(enable); 3353 3208 } 3209 3354 3210 #endif 3355 3211 … … 3386 3242 3387 3243 #if !PLATFORM(COCOA) 3244 3388 3245 bool Internals::userPrefersReducedMotion() const 3389 3246 { 3390 3247 return false; 3391 3248 } 3249 3392 3250 #endif 3393 3251 -
trunk/Source/WebCore/testing/Internals.h
r207372 r207521 1 1 /* 2 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2013-201 5Apple Inc. All rights reserved.3 * Copyright (C) 2013-2016 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "CSSComputedStyleDeclaration.h" 30 30 #include "ContextDestructionObserver.h" 31 #include "ExceptionOr.h" 31 32 #include "PageConsoleClient.h" 32 33 #include <runtime/Float32Array.h> … … 71 72 class XMLHttpRequest; 72 73 73 typedef int ExceptionCode;74 75 74 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver { 76 75 public: … … 80 79 static void resetToConsistentState(Page&); 81 80 82 String elementRenderTreeAsText(Element&, ExceptionCode&);81 ExceptionOr<String> elementRenderTreeAsText(Element&); 83 82 bool hasPausedImageAnimations(Element&); 84 83 … … 95 94 enum class CachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad }; 96 95 void setOverrideCachePolicy(CachePolicy); 97 void setCanShowModalDialogOverride(bool allow, ExceptionCode&);96 ExceptionOr<void> setCanShowModalDialogOverride(bool allow); 98 97 enum class ResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh }; 99 98 void setOverrideResourceLoadPriority(ResourceLoadPriority); … … 111 110 RefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Element&) const; 112 111 113 Node* ensureShadowRoot(Element& host, ExceptionCode&);112 ExceptionOr<Node*> ensureShadowRoot(Element& host); 114 113 Node* ensureUserAgentShadowRoot(Element& host); 115 Node* createShadowRoot(Element& host, ExceptionCode&);114 ExceptionOr<Node*> createShadowRoot(Element& host); 116 115 Node* shadowRoot(Element& host); 117 String shadowRootType(const Node&, ExceptionCode&) const;116 ExceptionOr<String> shadowRootType(const Node&) const; 118 117 String shadowPseudoId(Element&); 119 118 void setShadowPseudoId(Element&, const String&); 120 119 121 120 // DOMTimers throttling testing. 122 bool isTimerThrottled(int timeoutId, ExceptionCode&);121 ExceptionOr<bool> isTimerThrottled(int timeoutId); 123 122 bool isRequestAnimationFrameThrottled() const; 124 123 bool areTimersThrottled() const; 125 124 126 125 // Spatial Navigation testing. 127 unsigned lastSpatialNavigationCandidateCount(ExceptionCode&) const;126 ExceptionOr<unsigned> lastSpatialNavigationCandidateCount() const; 128 127 129 128 // CSS Animation testing. 130 129 unsigned numberOfActiveAnimations() const; 131 bool animationsAreSuspended(ExceptionCode&) const;132 void suspendAnimations(ExceptionCode&) const;133 void resumeAnimations(ExceptionCode&) const;134 bool pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element&, ExceptionCode&);135 bool pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element&, const String& pseudoId, ExceptionCode&);130 ExceptionOr<bool> animationsAreSuspended() const; 131 ExceptionOr<void> suspendAnimations() const; 132 ExceptionOr<void> resumeAnimations() const; 133 ExceptionOr<bool> pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element&); 134 ExceptionOr<bool> pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element&, const String& pseudoId); 136 135 137 136 // CSS Transition testing. 138 bool pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&, ExceptionCode&);139 bool pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId, ExceptionCode&);137 ExceptionOr<bool> pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&); 138 ExceptionOr<bool> pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId); 140 139 141 140 Node* treeScopeRootNode(Node&); … … 144 143 String visiblePlaceholder(Element&); 145 144 void selectColorInColorChooser(HTMLInputElement&, const String& colorValue); 146 Vector<String> formControlStateOfPreviousHistoryItem(ExceptionCode&);147 void setFormControlStateOfPreviousHistoryItem(const Vector<String>&, ExceptionCode&);148 149 Ref<ClientRect> absoluteCaretBounds(ExceptionCode&);145 ExceptionOr<Vector<String>> formControlStateOfPreviousHistoryItem(); 146 ExceptionOr<void> setFormControlStateOfPreviousHistoryItem(const Vector<String>&); 147 148 ExceptionOr<Ref<ClientRect>> absoluteCaretBounds(); 150 149 151 150 Ref<ClientRect> boundingBox(Element&); 152 151 153 Ref<ClientRectList> inspectorHighlightRects(ExceptionCode&);154 String inspectorHighlightObject(ExceptionCode&);155 156 unsigned markerCountForNode(Node&, const String&, ExceptionCode&);157 RefPtr<Range> markerRangeForNode(Node&, const String& markerType, unsigned index, ExceptionCode&);158 String markerDescriptionForNode(Node&, const String& markerType, unsigned index, ExceptionCode&);159 String dumpMarkerRects(const String& markerType, ExceptionCode&);152 ExceptionOr<Ref<ClientRectList>> inspectorHighlightRects(); 153 ExceptionOr<String> inspectorHighlightObject(); 154 155 ExceptionOr<unsigned> markerCountForNode(Node&, const String&); 156 ExceptionOr<RefPtr<Range>> markerRangeForNode(Node&, const String& markerType, unsigned index); 157 ExceptionOr<String> markerDescriptionForNode(Node&, const String& markerType, unsigned index); 158 ExceptionOr<String> dumpMarkerRects(const String& markerType); 160 159 void addTextMatchMarker(const Range&, bool isActive); 161 void setMarkedTextMatchesAreHighlighted(bool, ExceptionCode&);160 ExceptionOr<void> setMarkedTextMatchesAreHighlighted(bool); 162 161 163 162 void invalidateFontCache(); 164 163 165 void setScrollViewPosition(int x, int y, ExceptionCode&);166 void setViewBaseBackgroundColor(const String& colorValue, ExceptionCode&);167 168 void setPagination(const String& mode, int gap, int pageLength, ExceptionCode&);169 void setPaginationLineGridEnabled(bool, ExceptionCode&);170 String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&);171 172 bool wasLastChangeUserEdit(Element& textField, ExceptionCode&);164 ExceptionOr<void> setScrollViewPosition(int x, int y); 165 ExceptionOr<void> setViewBaseBackgroundColor(const String& colorValue); 166 167 ExceptionOr<void> setPagination(const String& mode, int gap, int pageLength); 168 ExceptionOr<void> setPaginationLineGridEnabled(bool); 169 ExceptionOr<String> configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight); 170 171 ExceptionOr<bool> wasLastChangeUserEdit(Element& textField); 173 172 bool elementShouldAutoComplete(HTMLInputElement&); 174 173 void setEditingValue(HTMLInputElement&, const String&); … … 176 175 enum class AutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials }; 177 176 void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType); 178 void scrollElementToRect(Element&, int x, int y, int w, int h, ExceptionCode&);179 180 String autofillFieldName(Element&, ExceptionCode&);181 182 void paintControlTints(ExceptionCode&);177 ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h); 178 179 ExceptionOr<String> autofillFieldName(Element&); 180 181 ExceptionOr<void> paintControlTints(); 183 182 184 183 RefPtr<Range> rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength); … … 187 186 String rangeAsText(const Range&); 188 187 RefPtr<Range> subrange(Range&, int rangeLocation, int rangeLength); 189 RefPtr<Range> rangeForDictionaryLookupAtLocation(int x, int y, ExceptionCode&);190 191 void setDelegatesScrolling(bool enabled, ExceptionCode&);192 193 int lastSpellCheckRequestSequence(ExceptionCode&);194 int lastSpellCheckProcessedSequence(ExceptionCode&);188 ExceptionOr<RefPtr<Range>> rangeForDictionaryLookupAtLocation(int x, int y); 189 190 ExceptionOr<void> setDelegatesScrolling(bool enabled); 191 192 ExceptionOr<int> lastSpellCheckRequestSequence(); 193 ExceptionOr<int> lastSpellCheckProcessedSequence(); 195 194 196 195 Vector<String> userPreferredLanguages() const; … … 200 199 void setUserPreferredAudioCharacteristic(const String&); 201 200 202 unsigned wheelEventHandlerCount(ExceptionCode&); 203 unsigned touchEventHandlerCount(ExceptionCode&); 204 205 RefPtr<NodeList> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, 206 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const; 201 ExceptionOr<unsigned> wheelEventHandlerCount(); 202 ExceptionOr<unsigned> touchEventHandlerCount(); 203 204 ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const; 207 205 208 206 String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined); … … 210 208 void updateEditorUINowIfScheduled(); 211 209 212 bool hasSpellingMarker(int from, int length , ExceptionCode&);213 bool hasGrammarMarker(int from, int length , ExceptionCode&);214 bool hasAutocorrectedMarker(int from, int length , ExceptionCode&);210 bool hasSpellingMarker(int from, int length); 211 bool hasGrammarMarker(int from, int length); 212 bool hasAutocorrectedMarker(int from, int length); 215 213 void setContinuousSpellCheckingEnabled(bool); 216 214 void setAutomaticQuoteSubstitutionEnabled(bool); … … 220 218 void setAutomaticSpellingCorrectionEnabled(bool); 221 219 222 void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length , ExceptionCode&);223 224 bool isOverwriteModeEnabled( ExceptionCode&);225 void toggleOverwriteModeEnabled( ExceptionCode&);226 227 unsigned countMatchesForText(const String&, unsigned findOptions, const String& markMatches , ExceptionCode&);228 unsigned countFindMatches(const String&, unsigned findOptions , ExceptionCode&);229 230 unsigned numberOfScrollableAreas( ExceptionCode&);231 232 bool isPageBoxVisible(int pageNumber, ExceptionCode&);220 void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length); 221 222 bool isOverwriteModeEnabled(); 223 void toggleOverwriteModeEnabled(); 224 225 unsigned countMatchesForText(const String&, unsigned findOptions, const String& markMatches); 226 unsigned countFindMatches(const String&, unsigned findOptions); 227 228 unsigned numberOfScrollableAreas(); 229 230 ExceptionOr<bool> isPageBoxVisible(int pageNumber); 233 231 234 232 static const char* internalsId; … … 237 235 unsigned workerThreadCount() const; 238 236 239 void setBatteryStatus(const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode&); 240 241 void setDeviceProximity(const String& eventType, double value, double min, double max, ExceptionCode&); 237 ExceptionOr<void> setBatteryStatus(const String& eventType, bool charging, double chargingTime, double dischargingTime, double level); 238 ExceptionOr<void> setDeviceProximity(const String& eventType, double value, double min, double max); 242 239 243 240 enum { … … 249 246 LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16 250 247 }; 251 String layerTreeAsText(Document&, unsigned short flags, ExceptionCode&) const;252 String repaintRectsAsText(ExceptionCode&) const;253 String scrollingStateTreeAsText(ExceptionCode&) const;254 String mainThreadScrollingReasons(ExceptionCode&) const;255 RefPtr<ClientRectList> nonFastScrollableRects(ExceptionCode&) const;256 257 void setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing, ExceptionCode&);258 void setElementTracksDisplayListReplay(Element&, bool isTrackingReplay, ExceptionCode&);248 ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const; 249 ExceptionOr<String> repaintRectsAsText() const; 250 ExceptionOr<String> scrollingStateTreeAsText() const; 251 ExceptionOr<String> mainThreadScrollingReasons() const; 252 ExceptionOr<RefPtr<ClientRectList>> nonFastScrollableRects() const; 253 254 ExceptionOr<void> setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing); 255 ExceptionOr<void> setElementTracksDisplayListReplay(Element&, bool isTrackingReplay); 259 256 260 257 enum { … … 262 259 DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1, 263 260 }; 264 String displayListForElement(Element&, unsigned short flags, ExceptionCode&); 265 266 String replayDisplayListForElement(Element&, unsigned short flags, ExceptionCode&); 267 268 void garbageCollectDocumentResources(ExceptionCode&) const; 261 ExceptionOr<String> displayListForElement(Element&, unsigned short flags); 262 ExceptionOr<String> replayDisplayListForElement(Element&, unsigned short flags); 263 264 ExceptionOr<void> garbageCollectDocumentResources() const; 269 265 270 266 void beginSimulatedMemoryPressure(); … … 272 268 bool isUnderMemoryPressure(); 273 269 274 void insertAuthorCSS(const String&, ExceptionCode&) const;275 void insertUserCSS(const String&, ExceptionCode&) const;270 ExceptionOr<void> insertAuthorCSS(const String&) const; 271 ExceptionOr<void> insertUserCSS(const String&) const; 276 272 277 273 unsigned numberOfLiveNodes() const; … … 280 276 RefPtr<DOMWindow> openDummyInspectorFrontend(const String& url); 281 277 void closeDummyInspectorFrontend(); 282 void setInspectorIsUnderTest(bool isUnderTest, ExceptionCode&);278 ExceptionOr<void> setInspectorIsUnderTest(bool); 283 279 284 280 String counterValue(Element&); … … 288 284 289 285 int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600); 290 String pageProperty(String, int, ExceptionCode&) const;291 String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode&) const;292 293 void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&);294 void setPageZoomFactor(float zoomFactor, ExceptionCode&);295 void setTextZoomFactor(float zoomFactor, ExceptionCode&);296 297 void setUseFixedLayout(bool useFixedLayout, ExceptionCode&);298 void setFixedLayoutSize(int width, int height, ExceptionCode&);299 void setViewExposedRect(float left, float top, float width, float height, ExceptionCode&);286 ExceptionOr<String> pageProperty(const String& propertyName, int pageNumber) const; 287 ExceptionOr<String> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const; 288 289 ExceptionOr<void> setPageScaleFactor(float scaleFactor, int x, int y); 290 ExceptionOr<void> setPageZoomFactor(float); 291 ExceptionOr<void> setTextZoomFactor(float); 292 293 ExceptionOr<void> setUseFixedLayout(bool); 294 ExceptionOr<void> setFixedLayoutSize(int width, int height); 295 ExceptionOr<void> setViewExposedRect(float left, float top, float width, float height); 300 296 301 297 void setHeaderHeight(float); … … 322 318 Vector<String> getReferencedFilePaths() const; 323 319 324 void startTrackingRepaints(ExceptionCode&);325 void stopTrackingRepaints(ExceptionCode&);326 327 void startTrackingLayerFlushes(ExceptionCode&);328 unsigned layerFlushCount(ExceptionCode&);320 ExceptionOr<void> startTrackingRepaints(); 321 ExceptionOr<void> stopTrackingRepaints(); 322 323 ExceptionOr<void> startTrackingLayerFlushes(); 324 ExceptionOr<unsigned> layerFlushCount(); 329 325 330 void startTrackingStyleRecalcs(ExceptionCode&);331 unsigned styleRecalcCount(ExceptionCode&);326 ExceptionOr<void> startTrackingStyleRecalcs(); 327 ExceptionOr<unsigned> styleRecalcCount(); 332 328 unsigned lastStyleUpdateSize() const; 333 329 334 void startTrackingCompositingUpdates(ExceptionCode&);335 unsigned compositingUpdateCount(ExceptionCode&);336 337 void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionCode&);330 ExceptionOr<void> startTrackingCompositingUpdates(); 331 ExceptionOr<unsigned> compositingUpdateCount(); 332 333 ExceptionOr<void> updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*); 338 334 unsigned layoutCount() const; 339 335 … … 346 342 void setUsesMockScrollAnimator(bool); 347 343 348 String getCurrentCursorInfo(ExceptionCode&);344 ExceptionOr<String> getCurrentCursorInfo(); 349 345 350 346 String markerTextForListItem(Element&); … … 378 374 #if ENABLE(VIDEO) 379 375 void simulateAudioInterruption(HTMLMediaElement&); 380 bool mediaElementHasCharacteristic(HTMLMediaElement&, const String&, ExceptionCode&);376 ExceptionOr<bool> mediaElementHasCharacteristic(HTMLMediaElement&, const String&); 381 377 #endif 382 378 383 379 bool isSelectPopupVisible(HTMLSelectElement&); 384 380 385 String captionsStyleSheetOverride(ExceptionCode&);386 void setCaptionsStyleSheetOverride(const String&, ExceptionCode&);387 void setPrimaryAudioTrackLanguageOverride(const String&, ExceptionCode&);388 void setCaptionDisplayMode(const String&, ExceptionCode&);381 ExceptionOr<String> captionsStyleSheetOverride(); 382 ExceptionOr<void> setCaptionsStyleSheetOverride(const String&); 383 ExceptionOr<void> setPrimaryAudioTrackLanguageOverride(const String&); 384 ExceptionOr<void> setCaptionDisplayMode(const String&); 389 385 390 386 #if ENABLE(VIDEO) … … 393 389 #endif 394 390 395 Ref<ClientRect> selectionBounds(ExceptionCode&);391 ExceptionOr<Ref<ClientRect>> selectionBounds(); 396 392 397 393 #if ENABLE(VIBRATION) … … 399 395 #endif 400 396 401 bool isPluginUnavailabilityIndicatorObscured(Element&, ExceptionCode&);397 ExceptionOr<bool> isPluginUnavailabilityIndicatorObscured(Element&); 402 398 bool isPluginSnapshotted(Element&); 403 399 … … 410 406 411 407 #if ENABLE(VIDEO) 412 void beginMediaSessionInterruption(const String&, ExceptionCode&);408 ExceptionOr<void> beginMediaSessionInterruption(const String&); 413 409 void endMediaSessionInterruption(const String&); 414 410 void applicationDidEnterForeground() const; 415 411 void applicationWillEnterBackground() const; 416 void setMediaSessionRestrictions(const String& mediaType, const String& restrictions, ExceptionCode&);412 ExceptionOr<void> setMediaSessionRestrictions(const String& mediaType, const String& restrictions); 417 413 void setMediaElementRestrictions(HTMLMediaElement&, const String& restrictions); 418 void postRemoteControlCommand(const String&, float argument, ExceptionCode&);414 ExceptionOr<void> postRemoteControlCommand(const String&, float argument); 419 415 bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const; 420 416 #endif … … 431 427 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 432 428 void setMockMediaPlaybackTargetPickerEnabled(bool); 433 void setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState, ExceptionCode&);429 ExceptionOr<void> setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState); 434 430 #endif 435 431 … … 442 438 443 439 enum class PageOverlayType { View, Document }; 444 RefPtr<MockPageOverlay> installMockPageOverlay(PageOverlayType, ExceptionCode&);445 String pageOverlayLayerTreeAsText(ExceptionCode&) const;440 ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType); 441 ExceptionOr<String> pageOverlayLayerTreeAsText() const; 446 442 447 443 void setPageMuted(bool); … … 459 455 460 456 #if ENABLE(CSS_SCROLL_SNAP) 461 String scrollSnapOffsets(Element&, ExceptionCode&);462 #endif 463 464 String pathStringWithShrinkWrappedRects(Vector<double> rectComponents, double radius, ExceptionCode&);457 ExceptionOr<String> scrollSnapOffsets(Element&); 458 #endif 459 460 ExceptionOr<String> pathStringWithShrinkWrappedRects(const Vector<double>& rectComponents, double radius); 465 461 466 462 String getCurrentMediaControlsStatusForElement(HTMLMediaElement&); … … 469 465 void setShowAllPlugins(bool); 470 466 471 String resourceLoadStatisticsForOrigin( Stringorigin);467 String resourceLoadStatisticsForOrigin(const String& origin); 472 468 void setResourceLoadStatisticsEnabled(bool); 473 469 … … 504 500 Frame* frame() const; 505 501 506 RenderedDocumentMarker* markerAt(Node&, const String& markerType, unsigned index, ExceptionCode&);502 ExceptionOr<RenderedDocumentMarker*> markerAt(Node&, const String& markerType, unsigned index); 507 503 508 504 std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend; -
trunk/Source/WebCore/testing/Internals.idl
r207372 r207521 83 83 boolean hasPausedImageAnimations(Element element); 84 84 85 [MayThrow LegacyException] DOMString elementRenderTreeAsText(Element element);85 [MayThrowException] DOMString elementRenderTreeAsText(Element element); 86 86 boolean isPreloaded(DOMString url); 87 87 boolean isLoadingFromMemoryCache(DOMString url); … … 101 101 CSSStyleDeclaration computedStyleIncludingVisitedInfo(Element element); 102 102 103 [MayThrow LegacyException] Node ensureShadowRoot(Element host);103 [MayThrowException] Node ensureShadowRoot(Element host); 104 104 Node ensureUserAgentShadowRoot(Element host); 105 [MayThrow LegacyException] Node createShadowRoot(Element host);105 [MayThrowException] Node createShadowRoot(Element host); 106 106 Node shadowRoot(Element host); 107 107 108 [MayThrow LegacyException] DOMString shadowRootType(Node root);108 [MayThrowException] DOMString shadowRootType(Node root); 109 109 DOMString shadowPseudoId(Element element); 110 110 void setShadowPseudoId(Element element, DOMString id); … … 113 113 114 114 // Spatial Navigation testing 115 [MayThrow LegacyException] unsigned long lastSpatialNavigationCandidateCount();115 [MayThrowException] unsigned long lastSpatialNavigationCandidateCount(); 116 116 117 117 // CSS Animation testing. 118 118 unsigned long numberOfActiveAnimations(); 119 [MayThrow LegacyException] void suspendAnimations();120 [MayThrow LegacyException] void resumeAnimations();121 [MayThrow LegacyException] boolean animationsAreSuspended();122 [MayThrow LegacyException] boolean pauseAnimationAtTimeOnElement(DOMString animationName, unrestricted double pauseTime, Element element);123 [MayThrow LegacyException] boolean pauseAnimationAtTimeOnPseudoElement(DOMString animationName, unrestricted double pauseTime, Element element, DOMString pseudoId);119 [MayThrowException] void suspendAnimations(); 120 [MayThrowException] void resumeAnimations(); 121 [MayThrowException] boolean animationsAreSuspended(); 122 [MayThrowException] boolean pauseAnimationAtTimeOnElement(DOMString animationName, unrestricted double pauseTime, Element element); 123 [MayThrowException] boolean pauseAnimationAtTimeOnPseudoElement(DOMString animationName, unrestricted double pauseTime, Element element, DOMString pseudoId); 124 124 125 125 // CSS Transition testing. 126 [MayThrow LegacyException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element);127 [MayThrow LegacyException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId);126 [MayThrowException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element); 127 [MayThrowException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId); 128 128 129 129 DOMString visiblePlaceholder(Element element); 130 130 void selectColorInColorChooser(HTMLInputElement element, DOMString colorValue); 131 [MayThrow LegacyException] sequence<DOMString> formControlStateOfPreviousHistoryItem();132 [MayThrow LegacyException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values);133 134 [MayThrow LegacyException] ClientRect absoluteCaretBounds();131 [MayThrowException] sequence<DOMString> formControlStateOfPreviousHistoryItem(); 132 [MayThrowException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values); 133 134 [MayThrowException] ClientRect absoluteCaretBounds(); 135 135 136 136 ClientRect boundingBox(Element element); 137 137 138 [MayThrow LegacyException] ClientRectList inspectorHighlightRects();139 [MayThrow LegacyException] DOMString inspectorHighlightObject();140 141 [MayThrow LegacyException] unsigned long markerCountForNode(Node node, DOMString markerType);142 [MayThrow LegacyException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);143 [MayThrow LegacyException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);144 [MayThrow LegacyException] DOMString dumpMarkerRects(DOMString markerType);138 [MayThrowException] ClientRectList inspectorHighlightRects(); 139 [MayThrowException] DOMString inspectorHighlightObject(); 140 141 [MayThrowException] unsigned long markerCountForNode(Node node, DOMString markerType); 142 [MayThrowException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index); 143 [MayThrowException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index); 144 [MayThrowException] DOMString dumpMarkerRects(DOMString markerType); 145 145 void addTextMatchMarker(Range range, boolean isActive); 146 [MayThrow LegacyException] void setMarkedTextMatchesAreHighlighted(boolean flag);146 [MayThrowException] void setMarkedTextMatchesAreHighlighted(boolean flag); 147 147 148 148 void invalidateFontCache(); 149 149 150 [MayThrow LegacyException] void setScrollViewPosition(long x, long y);151 152 [MayThrow LegacyException] void setViewBaseBackgroundColor(DOMString colorValue);153 154 [MayThrow LegacyException] void setPagination(DOMString mode, long gap, optional long pageLength = 0);155 [MayThrow LegacyException] void setPaginationLineGridEnabled(boolean enabled);156 157 [MayThrow LegacyException] DOMString configurationForViewport(unrestricted float devicePixelRatio, long deviceWidth, long deviceHeight, long availableWidth, long availableHeight);158 159 [MayThrow LegacyException] boolean wasLastChangeUserEdit(Element textField);150 [MayThrowException] void setScrollViewPosition(long x, long y); 151 152 [MayThrowException] void setViewBaseBackgroundColor(DOMString colorValue); 153 154 [MayThrowException] void setPagination(DOMString mode, long gap, optional long pageLength = 0); 155 [MayThrowException] void setPaginationLineGridEnabled(boolean enabled); 156 157 [MayThrowException] DOMString configurationForViewport(unrestricted float devicePixelRatio, long deviceWidth, long deviceHeight, long availableWidth, long availableHeight); 158 159 [MayThrowException] boolean wasLastChangeUserEdit(Element textField); 160 160 boolean elementShouldAutoComplete(HTMLInputElement inputElement); 161 161 void setEditingValue(HTMLInputElement inputElement, DOMString value); 162 162 void setAutofilled(HTMLInputElement inputElement, boolean enabled); 163 163 void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType); 164 [MayThrowLegacyException]unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);165 [MayThrowLegacyException]unsigned long countFindMatches(DOMString text, unsigned long findOptions);166 167 [MayThrow LegacyException] DOMString autofillFieldName(Element formControlElement);168 169 [MayThrow LegacyException] void paintControlTints();170 171 [MayThrow LegacyException] void scrollElementToRect(Element element, long x, long y, long w, long h);164 unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches); 165 unsigned long countFindMatches(DOMString text, unsigned long findOptions); 166 167 [MayThrowException] DOMString autofillFieldName(Element formControlElement); 168 169 [MayThrowException] void paintControlTints(); 170 171 [MayThrowException] void scrollElementToRect(Element element, long x, long y, long w, long h); 172 172 173 173 Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength); … … 176 176 DOMString rangeAsText(Range range); 177 177 Range subrange(Range range, long rangeLocation, long rangeLength); 178 [MayThrow LegacyException] Range rangeForDictionaryLookupAtLocation(long x, long y);179 180 [MayThrow LegacyException] void setDelegatesScrolling(boolean enabled);181 182 [MayThrow LegacyException] long lastSpellCheckRequestSequence();183 [MayThrow LegacyException] long lastSpellCheckProcessedSequence();178 [MayThrowException] Range rangeForDictionaryLookupAtLocation(long x, long y); 179 180 [MayThrowException] void setDelegatesScrolling(boolean enabled); 181 182 [MayThrowException] long lastSpellCheckRequestSequence(); 183 [MayThrowException] long lastSpellCheckProcessedSequence(); 184 184 185 185 sequence<DOMString> userPreferredLanguages(); … … 189 189 void setUserPreferredAudioCharacteristic(DOMString characteristic); 190 190 191 [MayThrow LegacyException] unsigned long wheelEventHandlerCount();192 [MayThrow LegacyException] unsigned long touchEventHandlerCount();193 194 [MayThrow LegacyException] NodeList nodesFromRect(Document document, long x, long y,191 [MayThrowException] unsigned long wheelEventHandlerCount(); 192 [MayThrowException] unsigned long touchEventHandlerCount(); 193 194 [MayThrowException] NodeList nodesFromRect(Document document, long x, long y, 195 195 unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding, 196 196 boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent); … … 201 201 void updateEditorUINowIfScheduled(); 202 202 203 [MayThrowLegacyException]boolean hasSpellingMarker(long from, long length);204 [MayThrowLegacyException]boolean hasGrammarMarker(long from, long length);205 [MayThrowLegacyException]boolean hasAutocorrectedMarker(long from, long length);203 boolean hasSpellingMarker(long from, long length); 204 boolean hasGrammarMarker(long from, long length); 205 boolean hasAutocorrectedMarker(long from, long length); 206 206 void setContinuousSpellCheckingEnabled(boolean enabled); 207 207 void setAutomaticQuoteSubstitutionEnabled(boolean enabled); … … 211 211 void setAutomaticSpellingCorrectionEnabled(boolean enabled); 212 212 213 [MayThrowLegacyException]void handleAcceptedCandidate(DOMString candidate, unsigned long location, unsigned long length);214 215 [MayThrowLegacyException]boolean isOverwriteModeEnabled();216 [MayThrowLegacyException]void toggleOverwriteModeEnabled();217 218 [MayThrowLegacyException]unsigned long numberOfScrollableAreas();219 220 [MayThrow LegacyException] boolean isPageBoxVisible(long pageNumber);213 void handleAcceptedCandidate(DOMString candidate, unsigned long location, unsigned long length); 214 215 boolean isOverwriteModeEnabled(); 216 void toggleOverwriteModeEnabled(); 217 218 unsigned long numberOfScrollableAreas(); 219 220 [MayThrowException] boolean isPageBoxVisible(long pageNumber); 221 221 222 222 unsigned long imageFrameIndex(HTMLImageElement element); … … 231 231 const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 8; 232 232 const unsigned short LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16; 233 [MayThrow LegacyException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);234 235 [MayThrow LegacyException] DOMString scrollingStateTreeAsText();236 [MayThrow LegacyException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().237 [MayThrow LegacyException] ClientRectList nonFastScrollableRects();238 239 [MayThrow LegacyException] DOMString repaintRectsAsText();233 [MayThrowException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0); 234 235 [MayThrowException] DOMString scrollingStateTreeAsText(); 236 [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons(). 237 [MayThrowException] ClientRectList nonFastScrollableRects(); 238 239 [MayThrowException] DOMString repaintRectsAsText(); 240 240 241 241 // These throw if the element does not have a compositing layer. 242 [MayThrow LegacyException] void setElementUsesDisplayListDrawing(Element element, boolean usesDisplayListDrawing);243 [MayThrow LegacyException] void setElementTracksDisplayListReplay(Element element, boolean trackReplay);242 [MayThrowException] void setElementUsesDisplayListDrawing(Element element, boolean usesDisplayListDrawing); 243 [MayThrowException] void setElementTracksDisplayListReplay(Element element, boolean trackReplay); 244 244 245 245 // Flags for displayListForElement. 246 246 const unsigned short DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1; 247 247 // Returns the recorded display list. 248 [MayThrow LegacyException] DOMString displayListForElement(Element element, optional unsigned short flags = 0);248 [MayThrowException] DOMString displayListForElement(Element element, optional unsigned short flags = 0); 249 249 // Returns the display list that was actually painted. 250 [MayThrow LegacyException] DOMString replayDisplayListForElement(Element element, optional unsigned short flags = 0);251 252 [MayThrow LegacyException] void garbageCollectDocumentResources();253 254 [MayThrow LegacyException] void insertAuthorCSS(DOMString css);255 [MayThrow LegacyException] void insertUserCSS(DOMString css);250 [MayThrowException] DOMString replayDisplayListForElement(Element element, optional unsigned short flags = 0); 251 252 [MayThrowException] void garbageCollectDocumentResources(); 253 254 [MayThrowException] void insertAuthorCSS(DOMString css); 255 [MayThrowException] void insertUserCSS(DOMString css); 256 256 257 257 readonly attribute boolean isUnderMemoryPressure; … … 260 260 261 261 #if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS 262 [MayThrow LegacyException] void setBatteryStatus(DOMString eventType, boolean charging, unrestricted double chargingTime, unrestricted double dischargingTime, unrestricted double level);262 [MayThrowException] void setBatteryStatus(DOMString eventType, boolean charging, unrestricted double chargingTime, unrestricted double dischargingTime, unrestricted double level); 263 263 #endif 264 264 265 265 #if defined(ENABLE_PROXIMITY_EVENTS) && ENABLE_PROXIMITY_EVENTS 266 [MayThrow LegacyException] void setDeviceProximity(DOMString eventType, unrestricted double value, unrestricted double min, unrestricted double max);266 [MayThrowException] void setDeviceProximity(DOMString eventType, unrestricted double value, unrestricted double min, unrestricted double max); 267 267 #endif 268 268 … … 271 271 DOMWindow openDummyInspectorFrontend(DOMString url); 272 272 void closeDummyInspectorFrontend(); 273 [MayThrow LegacyException] void setInspectorIsUnderTest(boolean isUnderTest);273 [MayThrowException] void setInspectorIsUnderTest(boolean isUnderTest); 274 274 275 275 DOMString counterValue(Element element); … … 277 277 sequence<DOMString> shortcutIconURLs(); 278 278 long numberOfPages(optional unrestricted double pageWidthInPixels = 800, optional unrestricted double pageHeightInPixels = 600); 279 [MayThrow LegacyException] DOMString pageProperty(DOMString propertyName, long pageNumber);280 [MayThrow LegacyException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);281 282 [MayThrow LegacyException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y);283 [MayThrow LegacyException] void setPageZoomFactor(unrestricted float zoomFactor);284 [MayThrow LegacyException] void setTextZoomFactor(unrestricted float zoomFactor);285 286 [MayThrow LegacyException] void setUseFixedLayout(boolean useFixedLayout);287 [MayThrow LegacyException] void setFixedLayoutSize(long width, long height);288 289 [MayThrow LegacyException] void setViewExposedRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);279 [MayThrowException] DOMString pageProperty(DOMString propertyName, long pageNumber); 280 [MayThrowException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft); 281 282 [MayThrowException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y); 283 [MayThrowException] void setPageZoomFactor(unrestricted float zoomFactor); 284 [MayThrowException] void setTextZoomFactor(unrestricted float zoomFactor); 285 286 [MayThrowException] void setUseFixedLayout(boolean useFixedLayout); 287 [MayThrowException] void setFixedLayoutSize(long width, long height); 288 289 [MayThrowException] void setViewExposedRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); 290 290 291 291 void setHeaderHeight(unrestricted float height); … … 314 314 // These functions both reset the tracked repaint rects. They are intended to be used in the following order: 315 315 // startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints. 316 [MayThrow LegacyException] void startTrackingRepaints();317 [MayThrow LegacyException] void stopTrackingRepaints();318 319 [MayThrow LegacyException] void startTrackingLayerFlushes();320 [MayThrow LegacyException] unsigned long layerFlushCount();316 [MayThrowException] void startTrackingRepaints(); 317 [MayThrowException] void stopTrackingRepaints(); 318 319 [MayThrowException] void startTrackingLayerFlushes(); 320 [MayThrowException] unsigned long layerFlushCount(); 321 321 322 322 // Query if a timer is currently throttled, to debug timer throttling. 323 [MayThrow LegacyException] boolean isTimerThrottled(long timerHandle);323 [MayThrowException] boolean isTimerThrottled(long timerHandle); 324 324 325 325 boolean isRequestAnimationFrameThrottled(); 326 326 boolean areTimersThrottled(); 327 327 328 [MayThrow LegacyException] void startTrackingStyleRecalcs();329 [MayThrow LegacyException] unsigned long styleRecalcCount();328 [MayThrowException] void startTrackingStyleRecalcs(); 329 [MayThrowException] unsigned long styleRecalcCount(); 330 330 readonly attribute unsigned long lastStyleUpdateSize; 331 331 332 [MayThrow LegacyException] void startTrackingCompositingUpdates();333 [MayThrow LegacyException] unsigned long compositingUpdateCount();332 [MayThrowException] void startTrackingCompositingUpdates(); 333 [MayThrowException] unsigned long compositingUpdateCount(); 334 334 335 335 // |node| should be Document, HTMLIFrameElement, or unspecified. 336 336 // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is 337 337 // specified without security checks. Unspecified or null means this document. 338 [MayThrow LegacyException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node? node = null);338 [MayThrowException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node? node = null); 339 339 340 340 readonly attribute unsigned long layoutCount; 341 341 342 342 // Returns a string with information about the mouse cursor used at the specified client location. 343 [MayThrow LegacyException] DOMString getCurrentCursorInfo();343 [MayThrowException] DOMString getCurrentCursorInfo(); 344 344 345 345 DOMString markerTextForListItem(Element element); … … 360 360 361 361 [Conditional=VIDEO] void simulateAudioInterruption(HTMLMediaElement element); 362 [Conditional=VIDEO, MayThrow LegacyException] boolean mediaElementHasCharacteristic(HTMLMediaElement element, DOMString characteristic);362 [Conditional=VIDEO, MayThrowException] boolean mediaElementHasCharacteristic(HTMLMediaElement element, DOMString characteristic); 363 363 364 364 [Conditional=LEGACY_ENCRYPTED_MEDIA] void initializeMockCDM(); … … 368 368 DOMString getImageSourceURL(Element element); 369 369 370 [Conditional=VIDEO_TRACK, MayThrow LegacyException] DOMString captionsStyleSheetOverride();371 [Conditional=VIDEO_TRACK, MayThrow LegacyException] void setCaptionsStyleSheetOverride(DOMString override);372 [Conditional=VIDEO_TRACK, MayThrow LegacyException] void setPrimaryAudioTrackLanguageOverride(DOMString language);373 [Conditional=VIDEO_TRACK, MayThrow LegacyException] void setCaptionDisplayMode(DOMString mode);370 [Conditional=VIDEO_TRACK, MayThrowException] DOMString captionsStyleSheetOverride(); 371 [Conditional=VIDEO_TRACK, MayThrowException] void setCaptionsStyleSheetOverride(DOMString override); 372 [Conditional=VIDEO_TRACK, MayThrowException] void setPrimaryAudioTrackLanguageOverride(DOMString language); 373 [Conditional=VIDEO_TRACK, MayThrowException] void setCaptionDisplayMode(DOMString mode); 374 374 375 375 [Conditional=VIDEO] TimeRanges createTimeRanges(Float32Array startTimes, Float32Array … … 383 383 #endif 384 384 385 [MayThrow LegacyException] boolean isPluginUnavailabilityIndicatorObscured(Element element);385 [MayThrowException] boolean isPluginUnavailabilityIndicatorObscured(Element element); 386 386 boolean isPluginSnapshotted(Element element); 387 387 388 [MayThrow LegacyException] ClientRect selectionBounds();388 [MayThrowException] ClientRect selectionBounds(); 389 389 390 390 [Conditional=MEDIA_SOURCE] void initializeMockMediaSource(); … … 393 393 [Conditional=MEDIA_SOURCE] void setShouldGenerateTimestamps(SourceBuffer buffer, boolean flag); 394 394 395 [Conditional=VIDEO, MayThrow LegacyException] void beginMediaSessionInterruption(DOMString interruptionType);395 [Conditional=VIDEO, MayThrowException] void beginMediaSessionInterruption(DOMString interruptionType); 396 396 [Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags); 397 397 [Conditional=MEDIA_SESSION] void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory category); … … 402 402 [Conditional=VIDEO] void applicationDidEnterForeground(); 403 403 [Conditional=VIDEO] void applicationWillEnterBackground(); 404 [Conditional=VIDEO, MayThrow LegacyException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions);404 [Conditional=VIDEO, MayThrowException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions); 405 405 [Conditional=VIDEO] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions); 406 406 [Conditional=WEB_AUDIO] void setAudioContextRestrictions(AudioContext context, DOMString restrictions); 407 [Conditional=VIDEO, MayThrow LegacyException] void postRemoteControlCommand(DOMString command, optional unrestricted float argument = 0);407 [Conditional=VIDEO, MayThrowException] void postRemoteControlCommand(DOMString command, optional unrestricted float argument = 0); 408 408 [Conditional=WIRELESS_PLAYBACK_TARGET] void setMockMediaPlaybackTargetPickerEnabled(boolean enabled); 409 [Conditional=WIRELESS_PLAYBACK_TARGET, MayThrow LegacyException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);409 [Conditional=WIRELESS_PLAYBACK_TARGET, MayThrowException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState); 410 410 [Conditional=MEDIA_STREAM] void setMockMediaCaptureDevicesEnabled(boolean enabled); 411 411 [Conditional=WEB_RTC] void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection connection, DOMString action); … … 415 415 [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(HTMLMediaElement element); 416 416 417 [MayThrow LegacyException] MockPageOverlay installMockPageOverlay(PageOverlayType type);418 [MayThrow LegacyException] DOMString pageOverlayLayerTreeAsText();417 [MayThrowException] MockPageOverlay installMockPageOverlay(PageOverlayType type); 418 [MayThrowException] DOMString pageOverlayLayerTreeAsText(); 419 419 420 420 void setPageMuted(boolean muted); … … 430 430 431 431 #if defined(ENABLE_CSS_SCROLL_SNAP) && ENABLE_CSS_SCROLL_SNAP 432 [MayThrow LegacyException] DOMString scrollSnapOffsets(Element element);433 #endif 434 435 [MayThrow LegacyException] DOMString pathStringWithShrinkWrappedRects(sequence<double> rectComponents, double radius);432 [MayThrowException] DOMString scrollSnapOffsets(Element element); 433 #endif 434 435 [MayThrowException] DOMString pathStringWithShrinkWrappedRects(sequence<double> rectComponents, double radius); 436 436 437 437 [Conditional=VIDEO] DOMString getCurrentMediaControlsStatusForElement(HTMLMediaElement element); … … 446 446 void setResourceLoadStatisticsEnabled(boolean enable); 447 447 448 [MayThrow LegacyException] void setCanShowModalDialogOverride(boolean allow);448 [MayThrowException] void setCanShowModalDialogOverride(boolean allow); 449 449 450 450 DOMString composedTreeAsText(Node parent);
Note: See TracChangeset
for help on using the changeset viewer.