AngleSharp / AngleSharp.Css

:angel: Library to enable support for cascading stylesheets in AngleSharp.

Home Page:https://anglesharp.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clientWidth/Height offsetWidth/Height, scollWidth/Height

cyraid opened this issue · comments

New Feature Proposal

Description

Wanting to do some layout and animation for a personal project. Noticed there isn't width/height on a specific Element. The getClientRects()/getBoundingClientRect()/scroll()/etc. don't seem to be implemented? Is this in a new version or just haven't gotten to it yet?

Specification

https://w3c.github.io/csswg-drafts/cssom-view/

anglesharp does no layouting/rendering wich is needed for those properties

anglesharp does no layouting/rendering wich is needed for those properties

@FlorianRappl haven't you spoken about rendering ? This comment is mostly for you, just checking what I'd all need to do, maybe might merge some efforts. Wanted to see what you had first. :)

The comment from @jogibear9988 is spot on. A full rendering engine is needed to compute these as they are dependent on the layouting.

I once had a rather primitive engine running but for a couple of reasons this was never published and maintained.

Right now there just aren't enough reasons (and contributors) to make this a reality.

Not sure if we should close this topic as rendering would also not be in this library (on the other hand layouting / some crucial algorithms potentially would).

I'll leave it open for now - mostly for visibility.

The comment from @jogibear9988 is spot on. A full rendering engine is needed to compute these as they are dependent on the layouting.

I once had a rather primitive engine running but for a couple of reasons this was never published and maintained.

Right now there just aren't enough reasons (and contributors) to make this a reality.

Not sure if we should close this topic as rendering would also not be in this library (on the other hand layouting / some crucial algorithms potentially would).

I'll leave it open for now - mostly for visibility.

@FlorianRappl @jogibear9988 I mostly meant layout, and then later asked if Florian had something with a Rendering setup done thinking he might have possibly done some layout work.

If one were to add Width/Height etc. Would you add them directly to IElement, and HtmlElement? Or something like IElementView that IElement would also inherit from? As they would need to be on Element as the standard states (as far as I remember). There would also need to be the Window extensions, so IWindowView? Also IScreen? IDocumentView for the Document extensions?

public interface IScreen
{

  /// <summary>
  /// Gets the width of the available screen area.
  /// </summary>
  [DomName("availWidth")]
  public long AvailWidth { get; }

  /// <summary>
  /// Gets the height of the available screen area.
  /// </summary>
  [DomName("availHeight")]
  public long AvailHeight { get; }

  /// <summary>
  /// Gets the width of the screen area.
  /// </summary>
  [DomName("width")]
  public long Width { get; }

  /// <summary>
  /// Gets the height of the available screen area.
  /// </summary>
  [DomName("height")]
  public long Height { get; }

  /// <summary>
  /// Gets the number of bits allocated to colors for a pixel output device, excluding the alpha channel.
  /// </summary>
  [DomName("colorDepth")]
  public ulong ColorDepth { get; }

  /// <summary>
  /// Gets the number of bits allocated to colors for a pixel output device, excluding the alpha channel.
  /// </summary>
  [DomName("pixelDepth")]
  public ulong PixelDepth { get; }

}

For getting font metrics, would Harfbuzz be too big of a requirement? Perhaps maybe the layout should be a separate github which includes things like that? Would it be included as a .With() as a Service? I haven't looked too deeply into the setup, but though I would ask first.

Yeah the requested part would be part of rendering lib and not the CSS lib (e.g., AngleSharp.Renderer.