зеркало из https://github.com/mozilla/gecko-dev.git
Check style unit before translating relative position coords
This commit is contained in:
Родитель
87de5f350c
Коммит
de4d61cd11
|
@ -258,12 +258,30 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX,
|
|||
nsIFrame* kid = aFirstChild;
|
||||
while (--aChildCount >= 0) {
|
||||
const nsStylePosition* kidPosition;
|
||||
kid->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)kidPosition);
|
||||
kid->GetStyleData(eStyleStruct_Position,
|
||||
(const nsStyleStruct*&)kidPosition);
|
||||
if (NS_STYLE_POSITION_RELATIVE == kidPosition->mPosition) {
|
||||
kid->GetOrigin(origin);
|
||||
// XXX Check the unit: could be auto or percent (not just length)
|
||||
nscoord dx = kidPosition->mLeftOffset.GetCoordValue();
|
||||
nscoord dy = kidPosition->mTopOffset.GetCoordValue();
|
||||
nscoord dx = 0;
|
||||
switch (kidPosition->mLeftOffset.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
printf("XXX: not yet implemented: % relative position\n");
|
||||
case eStyleUnit_Auto:
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
dx = kidPosition->mLeftOffset.GetCoordValue();
|
||||
break;
|
||||
}
|
||||
nscoord dy = 0;
|
||||
switch (kidPosition->mTopOffset.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
printf("XXX: not yet implemented: % relative position\n");
|
||||
case eStyleUnit_Auto:
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
dx = kidPosition->mTopOffset.GetCoordValue();
|
||||
break;
|
||||
}
|
||||
kid->MoveTo(origin.x + dx, origin.y + dy);
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
|
|
|
@ -258,12 +258,30 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX,
|
|||
nsIFrame* kid = aFirstChild;
|
||||
while (--aChildCount >= 0) {
|
||||
const nsStylePosition* kidPosition;
|
||||
kid->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)kidPosition);
|
||||
kid->GetStyleData(eStyleStruct_Position,
|
||||
(const nsStyleStruct*&)kidPosition);
|
||||
if (NS_STYLE_POSITION_RELATIVE == kidPosition->mPosition) {
|
||||
kid->GetOrigin(origin);
|
||||
// XXX Check the unit: could be auto or percent (not just length)
|
||||
nscoord dx = kidPosition->mLeftOffset.GetCoordValue();
|
||||
nscoord dy = kidPosition->mTopOffset.GetCoordValue();
|
||||
nscoord dx = 0;
|
||||
switch (kidPosition->mLeftOffset.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
printf("XXX: not yet implemented: % relative position\n");
|
||||
case eStyleUnit_Auto:
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
dx = kidPosition->mLeftOffset.GetCoordValue();
|
||||
break;
|
||||
}
|
||||
nscoord dy = 0;
|
||||
switch (kidPosition->mTopOffset.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
printf("XXX: not yet implemented: % relative position\n");
|
||||
case eStyleUnit_Auto:
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
dx = kidPosition->mTopOffset.GetCoordValue();
|
||||
break;
|
||||
}
|
||||
kid->MoveTo(origin.x + dx, origin.y + dy);
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
|
|
Загрузка…
Ссылка в новой задаче