Internals.idl   [plain text]


/*
 * Copyright (C) 2012 Google Inc. All rights reserved.
 * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

enum PageOverlayType {
    "view",
    "document"
};

// These map to ResourceRequestCachePolicy.
enum CachePolicy {
    "UseProtocolCachePolicy",
    "ReloadIgnoringCacheData",
    "ReturnCacheDataElseLoad",
    "ReturnCacheDataDontLoad"
};

// FIXME: Strings in an enum should not have the name of the enum as a prefix.
enum ResourceLoadPriority {
    "ResourceLoadPriorityVeryLow",
    "ResourceLoadPriorityLow",
    "ResourceLoadPriorityMedium",
    "ResourceLoadPriorityHigh",
    "ResourceLoadPriorityVeryHigh"
};

[Conditional=MEDIA_SESSION] enum MediaSessionInterruptingCategory {
    "content",
    "transient",
    "transient-solo"
};

[Conditional=MEDIA_SESSION] enum MediaControlEvent {
    "play-pause",
    "next-track",
    "previous-track"
};

// FIXME: Strings in an enum should not have the name of the enum as a prefix.
enum AutoFillButtonType {
    "AutoFillButtonTypeNone",
    "AutoFillButtonTypeContacts",
    "AutoFillButtonTypeCredentials"
};

enum UserInterfaceLayoutDirection {
    "LTR",
    "RTL"
};

[
    ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
    NoInterfaceObject,
] interface Internals {
    DOMString address(Node node);
    boolean nodeNeedsStyleRecalc(Node node);
    DOMString styleChangeType(Node node);
    DOMString description(any value);

    // Animated image pausing testing.
    boolean hasPausedImageAnimations(Element element);

    [RaisesException] DOMString elementRenderTreeAsText(Element element);
    boolean isPreloaded(DOMString url);
    boolean isLoadingFromMemoryCache(DOMString url);
    DOMString xhrResponseSource(XMLHttpRequest xhr);
    boolean isSharingStyleSheetContents(HTMLLinkElement a, HTMLLinkElement b);
    boolean isStyleSheetLoadingSubresources(HTMLLinkElement link);
    void clearMemoryCache();
    void pruneMemoryCacheToSize(long size);
    long memoryCacheSize();
    void setOverrideCachePolicy(CachePolicy policy);
    void setOverrideResourceLoadPriority(ResourceLoadPriority priority);
    void setStrictRawResourceValidationPolicyDisabled(boolean disabled);

    void clearPageCache();
    unsigned long pageCacheSize();

    CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node);

    [RaisesException] Node ensureShadowRoot(Element host);
    Node ensureUserAgentShadowRoot(Element host);
    [RaisesException] Node createShadowRoot(Element host);
    Node shadowRoot(Element host);

    [RaisesException] DOMString shadowRootType(Node root);
    DOMString shadowPseudoId(Element element);
    void setShadowPseudoId(Element element, DOMString id);
    Node treeScopeRootNode(Node node);
    Node parentTreeScope(Node node);

    // Spatial Navigation testing
    [RaisesException] unsigned long lastSpatialNavigationCandidateCount();

    // CSS Animation testing.
    unsigned long numberOfActiveAnimations();
    [RaisesException] void suspendAnimations();
    [RaisesException] void resumeAnimations();
    [RaisesException] boolean animationsAreSuspended();
    [RaisesException] boolean pauseAnimationAtTimeOnElement(DOMString animationName, unrestricted double pauseTime, Element element);
    [RaisesException] boolean pauseAnimationAtTimeOnPseudoElement(DOMString animationName, unrestricted double pauseTime, Element element, DOMString pseudoId);

    // CSS Transition testing.
    [RaisesException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element);
    [RaisesException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId);

    DOMString visiblePlaceholder(Element element);
    void selectColorInColorChooser(HTMLInputElement element, DOMString colorValue);
    [RaisesException] DOMString[] formControlStateOfPreviousHistoryItem();
    [RaisesException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values);

    [RaisesException] ClientRect absoluteCaretBounds();

    ClientRect boundingBox(Element element);

    [RaisesException] ClientRectList inspectorHighlightRects();
    [RaisesException] DOMString inspectorHighlightObject();

    [RaisesException] unsigned long markerCountForNode(Node node, DOMString markerType);
    [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
    [RaisesException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
    [RaisesException] DOMString dumpMarkerRects(DOMString markerType);
    void addTextMatchMarker(Range range, boolean isActive);
    [RaisesException] void setMarkedTextMatchesAreHighlighted(boolean flag);

    void invalidateFontCache();

    [RaisesException] void setScrollViewPosition(long x, long y);

    [RaisesException] void setViewBaseBackgroundColor(DOMString colorValue);

    [RaisesException] void setPagination(DOMString mode, long gap, optional long pageLength = 0);
    [RaisesException] void setPaginationLineGridEnabled(boolean enabled);

    [RaisesException] DOMString configurationForViewport(unrestricted float devicePixelRatio,
                                       long deviceWidth,
                                       long deviceHeight,
                                       long availableWidth,
                                       long availableHeight);

    [RaisesException] boolean wasLastChangeUserEdit(Element textField);
    boolean elementShouldAutoComplete(HTMLInputElement inputElement);
    void setEditingValue(HTMLInputElement inputElement, DOMString value);
    void setAutofilled(HTMLInputElement inputElement, boolean enabled);
    void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
    [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
    [RaisesException] unsigned long countFindMatches(DOMString text, unsigned long findOptions);

    [RaisesException] DOMString autofillFieldName(Element formControlElement);

    [RaisesException] void paintControlTints();

    [RaisesException] void scrollElementToRect(Element element, long x, long y, long w, long h);

    Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
    unsigned long locationFromRange(Element scope, Range range);
    unsigned long lengthFromRange(Element scope, Range range);
    DOMString rangeAsText(Range range);
    Range subrange(Range range, long rangeLocation, long rangeLength);
    [RaisesException] Range rangeForDictionaryLookupAtLocation(long x, long y);

    [RaisesException] void setDelegatesScrolling(boolean enabled);

    [RaisesException] long lastSpellCheckRequestSequence();
    [RaisesException] long lastSpellCheckProcessedSequence();

    sequence<DOMString> userPreferredLanguages();
    void setUserPreferredLanguages(sequence<DOMString> languages);

    sequence<DOMString> userPreferredAudioCharacteristics();
    void setUserPreferredAudioCharacteristic(DOMString characteristic);

    [RaisesException] unsigned long wheelEventHandlerCount();
    [RaisesException] unsigned long touchEventHandlerCount();

    [RaisesException] NodeList nodesFromRect(Document document, long x, long y,
        unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding,
        boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent);

    // Calling parserMetaData() with no arguments gets the metadata for the script of the current scope.
    DOMString parserMetaData(optional any func);

    void updateEditorUINowIfScheduled();

    [RaisesException] boolean hasSpellingMarker(long from, long length);
    [RaisesException] boolean hasGrammarMarker(long from, long length);
    [RaisesException] boolean hasAutocorrectedMarker(long from, long length);
    [RaisesException] void setContinuousSpellCheckingEnabled(boolean enabled);
    [RaisesException] void setAutomaticQuoteSubstitutionEnabled(boolean enabled);
    [RaisesException] void setAutomaticLinkDetectionEnabled(boolean enabled);
    [RaisesException] void setAutomaticDashSubstitutionEnabled(boolean enabled);
    [RaisesException] void setAutomaticTextReplacementEnabled(boolean enabled);
    [RaisesException] void setAutomaticSpellingCorrectionEnabled(boolean enabled);

    [RaisesException] void handleAcceptedCandidate(DOMString candidate, unsigned long location, unsigned long length);

    [RaisesException] boolean isOverwriteModeEnabled();
    [RaisesException] void toggleOverwriteModeEnabled();

    [RaisesException] unsigned long numberOfScrollableAreas();

    [RaisesException] boolean isPageBoxVisible(long pageNumber);

    unsigned long imageFrameIndex(HTMLImageElement element);

    readonly attribute InternalSettings settings;
    readonly attribute unsigned long workerThreadCount;

    // Flags for layerTreeAsText.
    const unsigned short LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1;
    const unsigned short LAYER_TREE_INCLUDES_TILE_CACHES = 2;
    const unsigned short LAYER_TREE_INCLUDES_REPAINT_RECTS = 4;
    const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 8;
    const unsigned short LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16;
    [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);

    [RaisesException] DOMString scrollingStateTreeAsText();
    [RaisesException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
    [RaisesException] ClientRectList nonFastScrollableRects();

    [RaisesException] DOMString repaintRectsAsText();

    // These throw if the element does not have a compositing layer.
    [RaisesException] void setElementUsesDisplayListDrawing(Element element, boolean usesDisplayListDrawing);
    [RaisesException] void setElementTracksDisplayListReplay(Element element, boolean trackReplay);

    // Flags for displayListForElement.
    const unsigned short DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1;
    // Returns the recorded display list.
    [RaisesException] DOMString displayListForElement(Element element, optional unsigned short flags = 0);
    // Returns the display list that was actually painted.
    [RaisesException] DOMString replayDisplayListForElement(Element element, optional unsigned short flags = 0);

    [RaisesException] void garbageCollectDocumentResources();

    [RaisesException] void insertAuthorCSS(DOMString css);
    [RaisesException] void insertUserCSS(DOMString css);

#