Interface CSSCanvas

All Known Implementing Classes:
AbstractCSSCanvas

public interface CSSCanvas
CSS canvas interface.
  • Method Details

    • getStyleDatabase

      StyleDatabase getStyleDatabase()
      Gets the style database for this canvas.
      Returns:
      the StyleDatabase.
    • isActivePseudoClass

      boolean isActivePseudoClass(CSSElement element, String pseudoclassName)
      Is the provided pseudo-class active in this canvas?
      Parameters:
      element - the element to which the pseudo-class applies.
      pseudoclassName - the pseudo-class name.
      Returns:
      true id the pseudo-class is active, false otherwise.
    • getFeatureValue

      ExtendedCSSPrimitiveValue getFeatureValue(String feature)
      Provide the value of the requested media feature.
      Parameters:
      feature - the media feature.
      Returns:
      the value of the requested media feature, or null if the feature is not known or not supported.
    • matchesFeature

      boolean matchesFeature(String featureName, ExtendedCSSPrimitiveValue value)
      Does this canvas support the given media feature?
      Parameters:
      featureName - the media feature name.
      value - the optional feature value to be tested against.
      Returns:
      true if the feature (with the given value, if any) is supported, false otherwise.
    • reloadStyleState

      void reloadStyleState()
      Reload any possible style state/caching that this canvas may have.
    • getViewport

      Viewport getViewport()
      Gets the viewport of this canvas.
      Returns:
      the viewport, or null if this canvas does not have a viewport.
    • stringWidth

      int stringWidth(String text, CSSComputedProperties style)
      Gives the width, in typographic points, for showing the given text with the given style.
      Parameters:
      text - the text to measure.
      style - the style that applies.
      Returns:
      the advance width for showing the text with the given font.
    • getCapHeight

      float getCapHeight(CSSComputedProperties style)
      Get the cap-height of the first available font, in typographic points.

      If the cap-height is not available, the font's ascent must be used.

      Parameters:
      style - the style that applies.
      Returns:
      the cap-height of the first available font.
    • getDocument

      CSSDocument getDocument()
      Gets the document to which this canvas applies.
      Returns:
      the document.