示例#1
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node["fullscreen"] != null);
        }
示例#2
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return((node as IRenderableNode).ComputedStyle.DrawDirectionX == DirectionMode.LTR);
        }
示例#3
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node["disabled"] == null && node["readonly"] == null);
        }
示例#4
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null || node.parentNode == null)
            {
                return(false);
            }

            return(node.childIndex == (node.parentNode.childCount - 1));
        }
示例#5
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node["default"] != null);
        }
示例#6
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node == (node.document as ReflowDocument).documentElement);
        }
示例#7
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node.id == node.document.Target);
        }
示例#8
0
        public override bool TryMatch(Dom.Node context)
        {
            string cName = context.className;

            if (string.IsNullOrEmpty(cName))
            {
                return(false);
            }

            int nextSpace = cName.IndexOf(' ');

            if (nextSpace != -1)
            {
                // Multiple classes to check.

                int currentStart = 0;
                int currentEnd   = nextSpace;

                // While there's still more text..
                while (currentStart < cName.Length)
                {
                    if (Text == cName.Substring(currentStart, currentEnd - currentStart))
                    {
                        return(true);
                    }

                    // Move start:
                    currentStart = currentEnd + 1;

                    if (currentStart >= cName.Length)
                    {
                        // All done.
                        break;
                    }

                    // Next space is at..
                    nextSpace = cName.IndexOf(' ', currentStart);

                    if (nextSpace == -1)
                    {
                        currentEnd = cName.Length;
                    }
                    else
                    {
                        currentEnd = nextSpace;
                    }
                }
            }
            else if (Text == cName)
            {
                // Just a single class to check and it passed!
                return(true);
            }

            // Nope!
            return(false);
        }
示例#9
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node.getAttribute("visited") != null);
        }
示例#10
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node.childIndex == 0);
        }
示例#11
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node.getAttribute("disabled") == null && node.getAttribute("readonly") == null);
        }
示例#12
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node["indeterminate"] == "1");
        }
示例#13
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node["value"] == null);
        }
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node.getAttribute("indeterminate") == "1");
        }
示例#15
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            return(node["required"] != null);
        }
示例#16
0
        public override bool TryMatch(Dom.Node context)
        {
            if (context == null)
            {
                return(false);
            }

            // Read it:
            string value = context.getAttribute(Attribute);

            if (value == null)
            {
                return(false);
            }

            if (Value == null)
            {
                // Attribute must just exist.
                return(true);
            }

            if (CaseInsensitive)
            {
                value = value.ToLower();
            }

            switch (MatchMode)
            {
            default:
            case 0:
                // Equals: (=)
                return(value == Value);

            case 1:
                // Starts with: (^=)
                return(value.StartsWith(Value));

            case 2:
                // Ends with: ($=)
                return(value.EndsWith(Value));

            case 3:
                // Contains substring: (*=)
                return(value.Contains(Value));

            case 4:
                // Contains word: (~=)
                return((value == Value) || value.Contains(" " + Value + " ") || value.StartsWith(Value + " ") || value.EndsWith(" " + Value));

            case 5:
                // Starts with value and - (|=)
                return((value == Value) || value.StartsWith(Value + "-"));
            }
        }
示例#17
0
        public override bool TryMatch(Dom.Node context)
        {
            // Tag match?
            Dom.Element el = context as Dom.Element;

            if (el == null)
            {
                return(false);
            }

            return(el.Tag == Text || (el.Tag == null && Text == "span"));
        }
示例#18
0
        public override bool TryMatch(Dom.Node context)
        {
            // Match with ID?
            string value;

            if (context.Properties.TryGetValue("id", out value))
            {
                return(value == Text);
            }

            return(false);
        }
示例#19
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            // Blank strings and '1' mean it's checked:
            string check = node["checked"];

            return(check == "1" || check == "");
        }
示例#20
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            int index = node.sameNameIndex;

            index -= ChildOffset;

            return((index % Nth) == 0);
        }
示例#21
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            // Get the value:
            string value = node["value"];

            // Required and blank is invalid:
            return(node["required"] != null && string.IsNullOrEmpty(value));
        }
        public override bool TryMatch(Dom.Node e)
        {
            for (int i = 0; i < Matchers.Length; i++)
            {
                // If any are true, we return true:
                if (Matchers[i].TryMatch(e))
                {
                    return(true);
                }
            }

            // Otherwise, they were all false - we're false:
            return(false);
        }
示例#23
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            int childCount = node.parentNode_.childCount;

            int index = childCount - 1 - node.sameNameIndex;

            index -= ChildOffset;

            return((index % Nth) == 0);
        }
示例#24
0
        public override void MoveUpwards(CssEvent e)
        {
            // Current node:
            Dom.Node node = e.CurrentNode;

            if (node != null)
            {
                e.CurrentNode = node.parentNode;

                if (e.CurrentNode is Dom.Document)
                {
                    e.CurrentNode = null;
                }
            }
        }
示例#25
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            HtmlDocument htmlDoc = (node.document as HtmlDocument);

            if (htmlDoc == null)
            {
                return(false);
            }

            return(htmlDoc != UI.document);
        }
示例#26
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            HtmlDocument htmlDoc = (node.document as HtmlDocument);

            // Location must be 'resources://' only:
            if (htmlDoc == null || htmlDoc.location == null || htmlDoc.location.Protocol != "resources")
            {
                return(false);
            }

            return(htmlDoc == UI.document);
        }
示例#27
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            int index = node.childElementIndex;

            index -= ChildOffset;

            if (index < 0)
            {
                return(false);
            }

            return((index % Nth) == 0);
        }
示例#28
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            if (node.getAttribute("required") == null)
            {
                // Not required.
                return(true);
            }

            // Get the value:
            string value = node.getAttribute("value");

            // Not blank:
            return(!string.IsNullOrEmpty(value));
        }
示例#29
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            // First get a pointer over this element:
            InputPointer pointer = null;

            for (int i = 0; i < InputPointer.PointerCount; i++)
            {
                pointer = InputPointer.AllRaw[i];

                if (pointer.ActiveOver == node)
                {
                    // Great, got it!
                    break;
                }
                else if (pointer.ActiveOver != null)
                {
                    // Is our node one of its parents?
                    if (node.isParentOf(pointer.ActiveOver))
                    {
                        break;
                    }
                }

                pointer = null;
            }


            if (pointer != null)
            {
                // True if the pointer is 'down':
                return(pointer.IsDown);
            }

            return(false);
        }
示例#30
0
        public override bool TryMatch(Dom.Node node)
        {
            if (node == null)
            {
                return(false);
            }

            // Get the value:
            int value;

            if (int.TryParse(node.getAttribute("value"), out value))
            {
                // Get min:
                int min;
                int.TryParse(node.getAttribute("min"), out min);

                if (value < min)
                {
                    return(false);
                }

                // Get max:
                int max;
                if (!int.TryParse(node.getAttribute("max"), out max))
                {
                    max = int.MaxValue;
                }

                if (value > max)
                {
                    return(false);
                }

                // In range!
                return(true);
            }

            return(false);
        }