Skip to content

Commit 804dd78

Browse files
committed
Merge pull request livecode#3496 from livecodeian/bugfix-16568
[[ Bug 16568 ]] Make sure native layers are clipped to the bounds of containing groups
2 parents b3cde75 + 14e8e88 commit 804dd78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1014
-568
lines changed

docs/notes/bugfix-16568.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Browser widget visibility not updated correctly when in a group

engine/src/button.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ uint2 MCButton::gettransient() const
16731673
}
16741674

16751675

1676-
void MCButton::setrect(const MCRectangle &nrect)
1676+
void MCButton::applyrect(const MCRectangle &nrect)
16771677
{
16781678
rect = nrect;
16791679
MCRectangle trect;

engine/src/button.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class MCButton : public MCControl
190190
#endif
191191

192192
virtual uint2 gettransient() const;
193-
virtual void setrect(const MCRectangle &nrect);
193+
virtual void applyrect(const MCRectangle &nrect);
194194

195195
#ifdef LEGACY_EXEC
196196
virtual Exec_stat getprop_legacy(uint4 parid, Properties which, MCExecPoint &, Boolean effective, bool recursive = false);

engine/src/eps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Boolean MCEPS::mup(uint2 which, bool p_release)
181181
return True;
182182
}
183183

184-
void MCEPS::setrect(const MCRectangle &nrect)
184+
void MCEPS::applyrect(const MCRectangle &nrect)
185185
{
186186
if (rect.width != nrect.width || rect.height != nrect.height)
187187
{

engine/src/eps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MCEPS : public MCControl
5050
virtual const char *gettypestring();
5151
virtual Boolean mdown(uint2 which);
5252
virtual Boolean mup(uint2 which, bool p_release);
53-
virtual void setrect(const MCRectangle &nrect);
53+
virtual void applyrect(const MCRectangle &nrect);
5454

5555
#ifdef LEGACY_EXEC
5656
virtual Exec_stat getprop_legacy(uint4 parid, Properties which, MCExecPoint &, Boolean effective, bool recursive = false);

engine/src/exec-interface-group.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -801,12 +801,21 @@ void MCGroup::GetClipsToRect(MCExecContext& ctxt, bool& r_clips_to_rect)
801801
r_clips_to_rect = m_clips_to_rect;
802802
}
803803

804-
void MCGroup::SetVisible(MCExecContext& ctxt, uinteger_t part, bool setting)
804+
// PM-2015-07-02: [[ Bug 13262 ]] Make sure we attach/detach the player when
805+
// showing/hiding a group that has a player
806+
void MCGroup::SetVisible(MCExecContext &ctxt, uinteger_t part, bool setting)
805807
{
806-
SetVisibility(ctxt, part, setting, true);
807-
}
808-
809-
void MCGroup::SetInvisible(MCExecContext& ctxt, uinteger_t part, bool setting)
810-
{
811-
SetVisibility(ctxt, part, setting, false);
808+
MCControl::SetVisible(ctxt, part, setting);
809+
#ifdef PLATFORM_PLAYER
810+
for(MCPlayer *t_player = MCplayers; t_player != nil; t_player = t_player -> getnextplayer())
811+
{
812+
if (t_player -> getparent() == this)
813+
{
814+
if (setting)
815+
t_player -> attachplayer();
816+
else
817+
t_player -> detachplayer();
818+
}
819+
}
820+
#endif
812821
}

engine/src/exec-interface-image.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -739,10 +739,10 @@ void MCImage::SetInk(MCExecContext& ctxt, intenum_t ink)
739739
notifyneeds(false);
740740
}
741741

742-
void MCImage::SetVisibility(MCExecContext& ctxt, uinteger_t part, bool setting, bool visible)
742+
void MCImage::SetVisible(MCExecContext& ctxt, uinteger_t part, bool setting)
743743
{
744-
Boolean wasvisible = isvisible();
745-
MCObject::SetVisibility(ctxt, part, setting, visible);
744+
bool wasvisible = isvisible();
745+
MCObject::SetVisible(ctxt, part, setting);
746746
if (!(MCbufferimages || flags & F_I_ALWAYS_BUFFER)
747747
&& !isvisible() && m_rep != nil)
748748
closeimage();
@@ -762,16 +762,6 @@ void MCImage::SetVisibility(MCExecContext& ctxt, uinteger_t part, bool setting,
762762
}
763763
}
764764

765-
void MCImage::SetVisible(MCExecContext& ctxt, uinteger_t part, bool setting)
766-
{
767-
SetVisibility(ctxt, part, setting, true);
768-
}
769-
770-
void MCImage::SetInvisible(MCExecContext& ctxt, uinteger_t part, bool setting)
771-
{
772-
SetVisibility(ctxt, part, setting, false);
773-
}
774-
775765
// MERG-2015-02-11: [[ ImageMetadata ]] Refactored image metadata property
776766
void MCImage::GetMetadataProperty(MCExecContext& ctxt, MCNameRef p_prop, MCExecValue& r_value)
777767
{

engine/src/exec-interface-object.cpp

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,17 +3151,11 @@ void MCObject::Set3D(MCExecContext& ctxt, bool setting)
31513151

31523152
////////////////////////////////////////////////////////////////////////////////
31533153

3154-
void MCObject::SetVisibility(MCExecContext& ctxt, uint32_t part, bool setting, bool visible)
3154+
void MCObject::SetVisible(MCExecContext& ctxt, uint32_t part, bool setting)
31553155
{
31563156
bool dirty;
31573157
dirty = changeflag(setting, F_VISIBLE);
31583158

3159-
if (!visible)
3160-
{
3161-
flags ^= F_VISIBLE;
3162-
dirty = !dirty;
3163-
}
3164-
31653159
// MW-2011-10-17: [[ Bug 9813 ]] Record the current effective rect of the object.
31663160
MCRectangle t_old_effective_rect;
31673161
if (dirty && opened && gettype() >= CT_GROUP)
@@ -3188,42 +3182,27 @@ void MCObject::SetVisibility(MCExecContext& ctxt, uint32_t part, bool setting, b
31883182

31893183
void MCObject::GetVisible(MCExecContext& ctxt, uint32_t part, bool& r_setting)
31903184
{
3191-
r_setting = getflag(F_VISIBLE);
3192-
}
3193-
3194-
void MCObject::SetVisible(MCExecContext& ctxt, uint32_t part, bool setting)
3195-
{
3196-
SetVisibility(ctxt, part, setting, true);
3185+
r_setting = isvisible(false);
31973186
}
31983187

31993188
void MCObject::GetEffectiveVisible(MCExecContext& ctxt, uint32_t part, bool& r_setting)
32003189
{
3201-
bool t_vis;
3202-
t_vis = getflag(F_VISIBLE);
3203-
3204-
// if visible and effective and parent is a
3205-
// group then keep searching parent properties
3206-
if (t_vis && parent != NULL && parent->gettype() == CT_GROUP)
3207-
parent->GetEffectiveVisible(ctxt, part, t_vis);
3208-
3209-
r_setting = t_vis;
3190+
r_setting = isvisible(true);
32103191
}
32113192

32123193
void MCObject::GetInvisible(MCExecContext& ctxt, uint32_t part, bool& r_setting)
32133194
{
3214-
r_setting = (flags & F_VISIBLE) == False;
3195+
r_setting = !isvisible(false);
32153196
}
32163197

32173198
void MCObject::SetInvisible(MCExecContext& ctxt, uint32_t part, bool setting)
32183199
{
3219-
SetVisibility(ctxt, part, setting, false);
3200+
SetVisible(ctxt, part, !setting);
32203201
}
32213202

32223203
void MCObject::GetEffectiveInvisible(MCExecContext& ctxt, uint32_t part, bool& r_setting)
32233204
{
3224-
bool t_setting;
3225-
GetEffectiveVisible(ctxt, part, t_setting);
3226-
r_setting = !t_setting;
3205+
r_setting = !isvisible(true);
32273206
}
32283207

32293208
void MCObject::GetEnabled(MCExecContext& ctxt, uint32_t part, bool& r_setting)

engine/src/exec-interface-player.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,10 @@ void MCPlayer::SetBorderWidth(MCExecContext& ctxt, uinteger_t width)
697697
Redraw();
698698
}
699699

700-
void MCPlayer::SetVisibility(MCExecContext& ctxt, uinteger_t part, bool setting, bool visible)
700+
void MCPlayer::SetVisible(MCExecContext& ctxt, uinteger_t part, bool setting)
701701
{
702702
uint4 oldflags = flags;
703-
MCObject::SetVisibility(ctxt, part, setting, visible);
703+
MCControl::SetVisible(ctxt, part, setting);
704704

705705
// PM-2015-07-01: [[ Bug 15191 ]] Keep the LC 6.7 behaviour in non-platform player, to make the video layer to hide
706706
#ifndef FEATURE_PLATFORM_PLAYER
@@ -713,16 +713,6 @@ void MCPlayer::SetVisibility(MCExecContext& ctxt, uinteger_t part, bool setting,
713713
updatevisibility();
714714
}
715715

716-
void MCPlayer::SetVisible(MCExecContext& ctxt, uinteger_t part, bool setting)
717-
{
718-
SetVisibility(ctxt, part, setting, true);
719-
}
720-
721-
void MCPlayer::SetInvisible(MCExecContext& ctxt, uinteger_t part, bool setting)
722-
{
723-
SetVisibility(ctxt, part, setting, false);
724-
}
725-
726716
void MCPlayer::SetTraversalOn(MCExecContext& ctxt, bool setting)
727717
{
728718
MCObject::SetTraversalOn(ctxt, setting);

engine/src/field.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ uint2 MCField::gettransient() const
13991399
return 0;
14001400
}
14011401

1402-
void MCField::setrect(const MCRectangle &nrect)
1402+
void MCField::applyrect(const MCRectangle &nrect)
14031403
{
14041404
// The contents only need to be laid out if the size changes. In particular,
14051405
// it is the width that is important; the height does not affect layout.

0 commit comments

Comments
 (0)