Provided pointer-events fixes #16
This commit is contained in:
Родитель
6eb73f83ff
Коммит
406e3b49a8
|
@ -4,6 +4,7 @@ Released on Thursday, May 5 2019.
|
|||
|
||||
- Reference latest AngleSharp
|
||||
- Returns `null` in `GetStyle` if CSS not configured (#15)
|
||||
- Added `pointer-events` and fixed border recombination (#16)
|
||||
- Added extension helper `SetStyle` to modify all styles of many elements (#22)
|
||||
- Introduced special converter for the `src` declaration (#25)
|
||||
- Fixed bug regarding CSS grid serialization (#27)
|
||||
|
|
|
@ -416,5 +416,18 @@ namespace AngleSharp.Css.Tests.Styling
|
|||
|
||||
Assert.AreEqual("background-color: rgba(0, 0, 0, 0); background-image: none; background-attachment: scroll; background-clip: border-box; background-origin: padding-box; background-repeat: repeat; background-size: auto auto", style.CssText);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RecombinationWorksWithBorder_Issue16()
|
||||
{
|
||||
var expected = "<button style=\"pointer-events: auto; border-width: 1px; border-style: solid; border-color: rgba(0, 0, 0, 1)\"></button>";
|
||||
var document = ParseDocument("");
|
||||
var element = document.CreateElement("button");
|
||||
element.GetStyle().SetPointerEvents("auto");
|
||||
element.GetStyle().SetBorderWidth("1px");
|
||||
element.GetStyle().SetBorderStyle("solid");
|
||||
element.GetStyle().SetBorderColor("black");
|
||||
Assert.AreEqual(expected, element.ToHtml());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1500,5 +1500,30 @@ namespace AngleSharp.Css
|
|||
/// The right bottom keyword.
|
||||
/// </summary>
|
||||
public static readonly String RightBottom = "right bottom";
|
||||
|
||||
/// <summary>
|
||||
/// The stroke keyword.
|
||||
/// </summary>
|
||||
public static readonly String Stroke = "stroke";
|
||||
|
||||
/// <summary>
|
||||
/// The painted keyword.
|
||||
/// </summary>
|
||||
public static readonly String Painted = "painted";
|
||||
|
||||
/// <summary>
|
||||
/// The visibleStroke keyword.
|
||||
/// </summary>
|
||||
public static readonly String VisibleStroke = "visibleStroke";
|
||||
|
||||
/// <summary>
|
||||
/// The visibleFill keyword.
|
||||
/// </summary>
|
||||
public static readonly String VisibleFill = "visibleFill";
|
||||
|
||||
/// <summary>
|
||||
/// The visiblePainted keyword.
|
||||
/// </summary>
|
||||
public static readonly String VisiblePainted = "visiblePainted";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
namespace AngleSharp.Css.Declarations
|
||||
{
|
||||
using AngleSharp.Css.Dom;
|
||||
using System;
|
||||
using static ValueConverters;
|
||||
|
||||
static class PointerEventsDeclaration
|
||||
{
|
||||
public static String Name = PropertyNames.PointerEvents;
|
||||
|
||||
public static IValueConverter Converter = Or(PointerEventConverter, AssignInitial(PointerEvent.Auto));
|
||||
|
||||
public static PropertyFlags Flags = PropertyFlags.Inherited;
|
||||
}
|
||||
}
|
|
@ -1245,6 +1245,12 @@ namespace AngleSharp.Css
|
|||
converter: ScrollbarTrackColorDeclaration.Converter,
|
||||
flags: ScrollbarTrackColorDeclaration.Flags)
|
||||
},
|
||||
{
|
||||
PointerEventsDeclaration.Name, new DeclarationInfo(
|
||||
name: PointerEventsDeclaration.Name,
|
||||
converter: PointerEventsDeclaration.Converter,
|
||||
flags: PointerEventsDeclaration.Flags)
|
||||
},
|
||||
{
|
||||
OrderDeclaration.Name, new DeclarationInfo(
|
||||
name: OrderDeclaration.Name,
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
namespace AngleSharp.Css.Dom
|
||||
{
|
||||
/// <summary>
|
||||
/// The values for pointer-event.
|
||||
/// </summary>
|
||||
public enum PointerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The element is never the target of pointer events; however, pointer events may target its descendant elements if those descendants have pointer-events set to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to/from the descendant during the event capture/bubble phases.
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// The element behaves as it would if the pointer-events property were not specified. In SVG content, this value and the value visiblePainted have the same effect.
|
||||
/// </summary>
|
||||
Auto,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when the visibility property is set to visible and e.g. when a mouse cursor is over the interior (i.e., 'fill') of the element and the fill property is set to a value other than none, or when a mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke property is set to a value other than none.
|
||||
/// </summary>
|
||||
VisiblePainted,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when the visibility property is set to visible and when e.g. a mouse cursor is over the interior (i.e., fill) of the element. The value of the fill property does not affect event processing.
|
||||
/// </summary>
|
||||
VisibleFill,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when the visibility property is set to visible and e.g. when the mouse cursor is over the perimeter (i.e., stroke) of the element. The value of the stroke property does not affect event processing.
|
||||
/// </summary>
|
||||
VisibleStroke,
|
||||
/// <summary>
|
||||
/// SVG only. The element can be the target of a pointer event when the visibility property is set to visible and e.g. the mouse cursor is over either the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill and stroke do not affect event processing.
|
||||
/// </summary>
|
||||
Visible,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when e.g. the mouse cursor is over the interior (i.e., 'fill') of the element and the fill property is set to a value other than none, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke property is set to a value other than none. The value of the visibility property does not affect event processing.
|
||||
/// </summary>
|
||||
Painted,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) of the element. The values of the fill and visibility properties do not affect event processing.
|
||||
/// </summary>
|
||||
Fill,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when the pointer is over the perimeter (i.e., stroke) of the element. The values of the stroke and visibility properties do not affect event processing.
|
||||
/// </summary>
|
||||
Stroke,
|
||||
/// <summary>
|
||||
/// SVG only. The element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill, stroke, and visibility properties do not affect event processing.
|
||||
/// </summary>
|
||||
All,
|
||||
}
|
||||
}
|
|
@ -753,6 +753,23 @@ namespace AngleSharp.Css
|
|||
{ CssKeywords.Start, RubyOverhangMode.Start },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Contains the string-PointerEvent mapping.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<String, PointerEvent> PointerEvents = new Dictionary<String, PointerEvent>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ CssKeywords.None, PointerEvent.None },
|
||||
{ CssKeywords.Auto, PointerEvent.Auto },
|
||||
{ CssKeywords.Visible, PointerEvent.Visible },
|
||||
{ CssKeywords.VisibleFill, PointerEvent.VisibleFill },
|
||||
{ CssKeywords.VisiblePainted, PointerEvent.VisiblePainted },
|
||||
{ CssKeywords.VisibleStroke, PointerEvent.VisibleStroke },
|
||||
{ CssKeywords.Painted, PointerEvent.Painted },
|
||||
{ CssKeywords.Fill, PointerEvent.Fill },
|
||||
{ CssKeywords.Stroke, PointerEvent.Stroke },
|
||||
{ CssKeywords.All, PointerEvent.All },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Contains the string-FlexDirection mapping.
|
||||
/// </summary>
|
||||
|
|
|
@ -444,6 +444,11 @@ namespace AngleSharp.Css
|
|||
/// </summary>
|
||||
public static readonly IValueConverter RubyPositionConverter = Map.RubyPositions.ToConverter();
|
||||
|
||||
/// <summary>
|
||||
/// Represents a converter for the PointerEvent enumeration.
|
||||
/// </summary>
|
||||
public static readonly IValueConverter PointerEventConverter = Map.PointerEvents.ToConverter();
|
||||
|
||||
/// <summary>
|
||||
/// Represents a converter for the SystemFont enumeration.
|
||||
/// </summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче