Example #1
0
        protected void ImplSetAttribute(DomAttribute attr)
        {
            //handle some attribute
            //special for some attributes

            switch ((WellknownName)attr.LocalNameIndex)
            {
            case WellknownName.Style:
            {
                //TODO: parse and evaluate style here
                //****
                WebDom.Parser.CssParser miniCssParser = CssParserPool.GetFreeParser();
                //parse and evaluate the ruleset
                CssRuleSet parsedRuleSet = miniCssParser.ParseCssPropertyDeclarationList(attr.Value.ToCharArray());

                Css.BoxSpec spec = null;
                if (this.ParentNode != null)
                {
                    spec = ((HtmlElement)this.ParentNode).Spec;
                }
                foreach (WebDom.CssPropertyDeclaration propDecl in parsedRuleSet.GetAssignmentIter())
                {
                    SpecSetter.AssignPropertyValue(
                        _boxSpec,
                        spec,
                        propDecl);
                }
                CssParserPool.ReleaseParser(ref miniCssParser);
            }
            break;
            }
        }
Example #2
0
 public CssBoxSvgRoot(Css.BoxSpec spec, IRootGraphics rootgfx, SvgElement svgElem)
     : base(spec, rootgfx, Css.CssDisplay.Block)
 {
     SetAsCustomCssBox(this);
     //create svg node
     this.SvgSpec = svgElem;
     ChangeDisplayType(this, Css.CssDisplay.Block);
 }
Example #3
0
        /// <summary>
        /// Init.
        /// </summary>
        /// <param name="parent">the parent box of this box</param>
        /// <param name="controller">the html tag data of this box</param>
        public CssBoxImage(Css.BoxSpec boxSpec,
                           IRootGraphics rootgfx, ImageBinder binder)
            : base(boxSpec, rootgfx)
        {
            this._imgRun             = new CssImageRun();
            this._imgRun.ImageBinder = binder;
            this._imgRun.SetOwner(this);
            var runlist = new List <CssRun>(1);

            runlist.Add(_imgRun);
            CssBox.UnsafeSetContentRuns(this, runlist, false);
        }
Example #4
0
        /// <summary>
        /// Init.
        /// </summary>
        /// <param name="parent">the parent box of this box</param>
        /// <param name="controller">the html tag data of this box</param>
        public CssBoxImage(Css.BoxSpec boxSpec,
                           ImageBinder binder)
            : base(boxSpec)
        {
            _imgRun              = new CssImageRun();
            _imgRun.ImageBinder  = binder;
            binder.ImageChanged += Binder_ImageChanged;
            _imgRun.SetOwner(this);
            //
            var runlist = new List <CssRun>(1);

            runlist.Add(_imgRun);
            CssBox.UnsafeSetContentRuns(this, runlist, false);
        }
Example #5
0
        public override void SetAttribute(DomAttribute attr)
        {
            base.SetAttribute(attr); //to base
            //----------------------

            switch ((WellknownName)attr.LocalNameIndex)
            {
            case WellknownName.Src:
            {
                switch (this.WellknownElementName)
                {
                case WellKnownDomNodeName.img:
                {
                    if (_principalBox != null)
                    {
                        CssBoxImage boxImg = (CssBoxImage)_principalBox;
                        boxImg.ImageBinder = new ImageBinder(attr.Value);
                        boxImg.InvalidateGraphics();
                    }
                }
                break;
                }
            }
            break;

            case WellknownName.Style:
            {
                //TODO: parse and evaluate style here
                //****
                WebDom.Parser.CssParser miniCssParser = CssParserPool.GetFreeParser();
                //parse and evaluate the ruleset
                CssRuleSet parsedRuleSet = miniCssParser.ParseCssPropertyDeclarationList(attr.Value.ToCharArray());

                Css.BoxSpec spec = null;
                if (this.ParentNode != null)
                {
                    spec = ((HtmlElement)this.ParentNode).Spec;
                }
                foreach (WebDom.CssPropertyDeclaration propDecl in parsedRuleSet.GetAssignmentIter())
                {
                    SpecSetter.AssignPropertyValue(
                        _boxSpec,
                        spec,
                        propDecl);
                }
                CssParserPool.ReleaseParser(ref miniCssParser);
            }
            break;
            }
        }
Example #6
0
        public static CssBoxSvgRoot CreateSvgBox(CssBox parentBox,
                                                 HtmlElement elementNode,
                                                 Css.BoxSpec spec)
        {
            SvgFragment        fragment          = new SvgFragment();
            SvgRootEventPortal svgRootController = new SvgRootEventPortal(elementNode);
            CssBoxSvgRoot      svgRoot           = new CssBoxSvgRoot(
                elementNode.Spec,
                parentBox.RootGfx,
                fragment);

            svgRoot.SetController(svgRootController);
            svgRootController.SvgRoot = svgRoot;
            parentBox.AppendChild(svgRoot);
            CreateSvgBoxContent(fragment, elementNode);
            return(svgRoot);
        }
        public WrapperInlineCssBox(object controller, Css.BoxSpec boxSpec,
                                   RootGraphic rootgfx, RenderElement re)
            : base(controller, boxSpec, re.Root, CssDisplay.Inline)
        {
            int w = re.Width;
            int h = re.Height;

            ChangeDisplayType(this, CssDisplay.Inline);
            this.externalRun = new CssExternalRun(re);
            this.externalRun.SetOwner(this);
            var runlist = new List <CssRun>(1);

            runlist.Add(externalRun);
            CssBox.UnsafeSetContentRuns(this, runlist, false);
            ChangeDisplayType(this, Css.CssDisplay.Inline);
            //---------------------------------------------------
            LayoutFarm.RenderElement.SetParentLink(re, this);
        }
Example #8
0
        public CssBox(BoxSpec spec)
        {
            _aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (__aa_dbugId == 13)
            //{
            //}
            //if (!spec.IsFreezed)
            //{
            //    //must be freezed
            //    throw new NotSupportedException();
            //}
#endif

            //assign spec
            _myspec = spec;
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Example #9
0
        public CssBox(BoxSpec spec, RootGraphic rootgfx)
        {
            this.rootgfx = rootgfx;
            this._aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (this.__aa_dbugId == 6)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed
                throw new NotSupportedException();
            }
#endif

            //assign spec 
            this._myspec = spec;
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Example #10
0
        public CssBox(BoxSpec spec, IRootGraphics rootgfx)
        {
            this.rootgfx   = rootgfx;
            this._aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (this.__aa_dbugId == 6)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed
                throw new NotSupportedException();
            }
#endif

            //assign spec
            this._myspec = spec;
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Example #11
0
        public CssBox(BoxSpec spec, CssDisplay displayType)
        {
            _aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (__aa_dbugId == 13)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed
                throw new NotSupportedException();
            }
#endif

            //assign spec
            _boxCompactFlags |= BoxFlags.DONT_CHANGE_DISPLAY_TYPE;
            _cssDisplay       = displayType;
            _myspec           = spec;
            //----------------------------
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Example #12
0
        public CssBoxSvgRoot(Css.BoxSpec spec, IRootGraphics rootgfx, VgDocument svgdoc)
            : base(spec, rootgfx, Css.CssDisplay.Block)
        {
            //----------
            _vgVisualDocHost = new PaintLab.Svg.VgVisualDocHost();
            _vgVisualDocHost.SetImgRequestDelgate((ImageBinder reqImgBinder, PaintLab.Svg.VgVisualElement vgVisualE, object requestFrom) =>
            {
                //TODO: implementation here
            });
            _vgVisualDocHost.SetInvalidateDelegate(vgVisualElem =>
            {
                vgVisualElem.ClearBitmapSnapshot();
                vgVisualElem.InvalidateBounds();
                this.InvalidateGraphics();
            });
            //----------

            SetAsCustomCssBox(this);
            //create svg node
            this.SvgDoc = svgdoc;
            //convert svgElem to agg-based
            ChangeDisplayType(this, Css.CssDisplay.Block);
        }
Example #13
0
        public CssBox(BoxSpec spec, RootGraphic rootgfx, CssDisplay displayType)
        {
            this.rootgfx = rootgfx;
            this._aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (this.__aa_dbugId == 6)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed 
                throw new NotSupportedException();
            }
#endif

            //assign spec             
            this._boxCompactFlags |= BoxFlags.DONT_CHANGE_DISPLAY_TYPE;
            this._cssDisplay = displayType;
            this._myspec = spec;
            //---------------------------- 
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Example #14
0
 public CssScrollView(HtmlHost htmlhost, Css.BoxSpec boxSpec,
                      IRootGraphics rootgfx)
     : base(boxSpec, rootgfx)
 {
     _htmlhost = htmlhost;
 }
Example #15
0
 internal HtmlElement(HtmlDocument owner, int prefix, int localNameIndex)
     : base(owner, prefix, localNameIndex)
 {
     _boxSpec = new Css.BoxSpec();
 }
Example #16
0
 public CssFloatContainerBox(Css.BoxSpec boxSpec, IRootGraphics rootgfx, Css.CssDisplay display)
     : base(boxSpec, rootgfx, display)
 {
 }
Example #17
0
 public CssScrollView(Css.BoxSpec boxSpec,
                      IRootGraphics rootgfx)
     : base(boxSpec, rootgfx)
 {
 }
Example #18
0
 /// <summary>
 /// Init.
 /// </summary>
 /// <param name="parent">the parent box of this box</param>
 /// <param name="controller">the html tag data of this box</param>
 public CssBoxHr(Css.BoxSpec spec)
     : base(spec)
 {
     ChangeDisplayType(this, Css.CssDisplay.Block);
 }
Example #19
0
 public CssBoxMathMLRoot(Css.BoxSpec spec)
     : base(spec, Css.CssDisplay.Block)
 {
 }
Example #20
0
 public CssScrollView(HtmlHost htmlhost, Css.BoxSpec boxSpec)
     : base(boxSpec)
 {
     _htmlhost = htmlhost;
 }
 public CssFloatContainerBox(Css.BoxSpec boxSpec, Css.CssDisplay display)
     : base(boxSpec, display)
 {
 }
Example #22
0
 /// <summary>
 /// Init.
 /// </summary>
 /// <param name="parent">the parent box of this box</param>
 /// <param name="controller">the html tag data of this box</param>
 public CssBoxHr(Css.BoxSpec spec, IRootGraphics rootgfx)
     : base(spec, rootgfx)
 {
     ChangeDisplayType(this, Css.CssDisplay.Block);
 }
Example #23
0
 public CssBoxListItem(Css.BoxSpec spec)
     : base(spec)
 {
 }
Example #24
0
 public CssBoxListItem(Css.BoxSpec spec, IRootGraphics rootgfx)
     : base(spec, rootgfx)
 {
 }
Example #25
0
 internal HtmlElement(HtmlDocument owner, int prefix, int localNameIndex)
     : base(owner, prefix, localNameIndex)
 {
     this.boxSpec = new Css.BoxSpec();
 }