Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v_display_revisit' into v_acid1
Browse files Browse the repository at this point in the history
  • Loading branch information
prepare committed Jul 26, 2015
2 parents 6eb7c87 + e3f0a5e commit 08415c3
Show file tree
Hide file tree
Showing 18 changed files with 1,402 additions and 1,101 deletions.
3 changes: 2 additions & 1 deletion Source/HtmlRenderer.Demo/Samples/0_acid1_dev/003.2.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
</style>
</head>
<body>
abcd
<form>
<p>
bang
Expand All @@ -132,5 +132,6 @@
<input type="radio" name="foo2" value="on"/>
</p>
</form>
1234
</body>
</html>
18 changes: 18 additions & 0 deletions Source/HtmlRenderer.Demo/Samples/0_acid1_dev/003.3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<title>test
</title>
</head>
<body>
xyz
<div style="display:inline;background-color:yellow;padding:5px">
12345
<div> sub1</div>
<div> sub2</div>
67890
</div>
<div style="display:inline">
abcde
</div>
</body>
</html>
22 changes: 22 additions & 0 deletions Source/HtmlRenderer.Demo/Samples/0_acid1_dev/003.4.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<html>
<head>
<title>test
</title>
</head>
<body>
abcd
<form style="display:inline">
<p>
bang

<input type="radio" name="foo" value="off"/>
</p>
<p>
whimper

<input type="radio" name="foo2" value="on"/>
</p>
</form>
1234
</body>
</html>
4 changes: 4 additions & 0 deletions Source/LayoutFarm.Composers/7_Events/HtmlInputEventAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public void MouseMove(UIMouseEventArgs e, CssBox startAt)
//dragging *** , if changed
if (this._mousedownX != x || this._mousedownY != y)
{

//handle mouse drag
CssBoxHitChain hitChain = GetFreeHitChain();
hitChain.SetRootGlobalPosition(x, y);
Expand Down Expand Up @@ -169,17 +170,20 @@ public void MouseMove(UIMouseEventArgs e, CssBox startAt)
BoxHitUtils.HitTest(_mouseDownStartAt, lastRootGlobalX, lastRootGlobalY, _latestMouseDownChain);

}

//create selection range
var newSelectionRange = new SelectionRange(
_latestMouseDownChain,
hitChain,
this.ifonts);
if (newSelectionRange.IsValid)
{

this._htmlContainer.SetSelection(newSelectionRange);
}
else
{

this._htmlContainer.SetSelection(null);
}
}
Expand Down
57 changes: 47 additions & 10 deletions Source/LayoutFarm.CssBase/CssProps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,52 @@

namespace LayoutFarm.Css
{
// <display-outside>
// = block | inline | run-in ;
//<display-inside>
// = flow | flow-root | table | flex | grid | ruby ;
//<display-listitem>
// = list-item && <display-outside>? && [ flow | flow-root ]?
//<display-internal>
// = table-row-group | table-header-group |
// table-footer-group | table-row | table-cell |
// table-column-group | table-column | table-caption |
// ruby-base | ruby-text | ruby-base-container |
// ruby-text-container ;
//<display-box>
// = contents | none ;
//<display-legacy>
// = inline-block | inline-list-item |
// inline-table | inline-flex | inline-grid ;
// //--------------------------------------------------

public enum CssDisplayOutside : byte
{
Internal,

Block,
Inline,
RunIn,

TableCell,
TableCaption,

}

public enum CssDisplayInside : byte
{
Internal,

Flow,
FlowRoot,
Table,
Flex,
Grid,
Ruby,
}



//--------------------------------------------------
public enum CssDisplay : byte
{
[Map(CssConstants.Inline)]
Expand Down Expand Up @@ -41,13 +85,7 @@ public enum CssDisplay : byte

[Map(CssConstants.None)]
None,

//===========================================
/// <summary>
///following group act as Containing box : Block,Table,TableCell, ListItem
/// </summary>
__CONTAINER_BEGIN_HERE,


[Map(CssConstants.Block)]
Block,
[Map(CssConstants.Table)]
Expand All @@ -58,8 +96,7 @@ public enum CssDisplay : byte
ListItem,

[Map(CssConstants.Flex)]
Flex
//===========================================
Flex
}
public enum CssWhiteSpace : byte
{
Expand Down
32 changes: 23 additions & 9 deletions Source/LayoutFarm.HtmlRenderer/2_Boxes/1_CoreBox/CssBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public CssBox(BoxSpec spec, IRootGraphics rootgfx)
if (!spec.IsFreezed)
{
//must be freezed
//throw new NotSupportedException();
throw new NotSupportedException();
}
#endif

Expand Down Expand Up @@ -107,7 +107,22 @@ public CssBox ParentBox
{
get { return _parentBox; }
}

internal bool HasContainerProperty
{
get
{
switch (this._cssDisplay)
{
case Css.CssDisplay.Block:
case Css.CssDisplay.Table:
case Css.CssDisplay.TableCell:
case Css.CssDisplay.ListItem:
case Css.CssDisplay.Flex:
return true;
}
return false;
}
}
public CssBox GetTopRootCssBox()
{
var topmost = this;
Expand Down Expand Up @@ -148,13 +163,13 @@ public bool IsCustomCssBox
/// <summary>
/// is the box "Display" is "Inline", is this is an inline box and not block.
/// </summary>
public bool IsInline
internal bool OutsideDisplayIsInline
{
get
{
return (this._boxCompactFlags & BoxFlags.IS_INLINE_BOX) != 0;
}
internal set
set
{
if (value)
{
Expand Down Expand Up @@ -266,10 +281,7 @@ internal string dbugCopyTextContent()
#endif
internal void AddLineBox(CssLineBox linebox)
{


linebox.linkedNode = this._clientLineBoxes.AddLast(linebox);

}
internal int LineBoxCount
{
Expand Down Expand Up @@ -373,8 +385,10 @@ List<CssRun> Runs
return this._aa_contentRuns;
}
}

internal bool HasRuns
/// <summary>
/// box has only runs
/// </summary>
internal bool HasOnlyRuns
{
get
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//2014,2015 BSD,WinterDev


//2014,2015 BSD, WinterDev
using System;
using System.Collections.Generic;

Expand All @@ -12,7 +10,8 @@ class CssBoxCollection
LinkedList<CssBox> _boxes = new LinkedList<CssBox>();
public CssBoxCollection()
{
}
}

public IEnumerable<CssBox> GetChildBoxIter()
{
var cNode = _boxes.First;
Expand All @@ -31,6 +30,7 @@ public IEnumerable<CssBox> GetChildBoxBackwardIter()
cNode = cNode.Previous;
}
}

public void AddChild(CssBox owner, CssBox box)
{

Expand Down Expand Up @@ -92,7 +92,7 @@ public CssBox GetLastChild()
public IEnumerator<CssBox> GetEnumerator()
{
return this._boxes.GetEnumerator();
}
}

#if DEBUG
public bool dbugContains(CssBox box)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ partial class CssBox
//condition 3: valid
LinkedList<CssLineBox> _clientLineBoxes;


/// <summary>
/// absolute position layer
/// </summary>
CssBoxCollection _absPosLayer;
//List<CssBox> _absLayer2;


CssBlockRun justBlockRun;

Expand Down Expand Up @@ -177,6 +174,7 @@ public void RemoveChild(CssBox box)
} break;
}
}

public void AppendChild(CssBox box)
{
switch (box.Position)
Expand Down Expand Up @@ -349,7 +347,7 @@ public void AppendToAbsoluteLayer(CssBox box)
//}

}

//-------------------------------------
internal void ResetLineBoxes()
{
Expand Down
Loading

0 comments on commit 08415c3

Please sign in to comment.