mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 17:46:35 +08:00
Implement overflow:visible/hidden attribute (defaults to visible)
Summary: Prior to this patch DrawCommands weren't get clipped by parent DrawCommands at all. For example, a <View> element with size 200x200 with overflow:hidden should clip its child which is 400x400, but this didn't happen. However, if parent <View> would mount to an Android View, it would clip the child regardless of the overflow attribute value (because Android Views always clip whatever is drawing inside that View against its boundaries). This diff is fixing these issue, implementing overflow attribute support and making clipping behavior consistent between nodes that mount to View and nodes that don't. Reviewed By: ahmedre Differential Revision: D2768643
This commit is contained in:
committed by
Ahmed El-Helw
parent
f738b598d8
commit
6f06f76e38
@@ -137,8 +137,22 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
float left,
|
||||
float top,
|
||||
float right,
|
||||
float bottom) {
|
||||
super.collectState(stateBuilder, left, top, right, bottom);
|
||||
float bottom,
|
||||
float clipLeft,
|
||||
float clipTop,
|
||||
float clipRight,
|
||||
float clipBottom) {
|
||||
|
||||
super.collectState(
|
||||
stateBuilder,
|
||||
left,
|
||||
top,
|
||||
right,
|
||||
bottom,
|
||||
clipLeft,
|
||||
clipRight,
|
||||
clipTop,
|
||||
clipBottom);
|
||||
|
||||
if (mText == null) {
|
||||
// nothing to draw (empty text).
|
||||
@@ -158,7 +172,15 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
INCLUDE_PADDING));
|
||||
}
|
||||
|
||||
mDrawCommand = (DrawTextLayout) mDrawCommand.updateBoundsAndFreeze(left, top, right, bottom);
|
||||
mDrawCommand = (DrawTextLayout) mDrawCommand.updateBoundsAndFreeze(
|
||||
left,
|
||||
top,
|
||||
right,
|
||||
bottom,
|
||||
clipLeft,
|
||||
clipTop,
|
||||
clipRight,
|
||||
clipBottom);
|
||||
stateBuilder.addDrawCommand(mDrawCommand);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user