Skip to content

Commit

Permalink
Cherry-pick b33aded. rdar://problem/93689838
Browse files Browse the repository at this point in the history
    ASSERTION FAILED: firstChild():[ macOS ] media/track/track-cues-missed.html is a flaky test.
    https://bugs.webkit.org/show_bug.cgi?id=258183
    rdar://110876540

    Reviewed by Andy Estes.

    * Source/WebCore/rendering/RenderVTTCue.cpp:
    (WebCore::RenderVTTCue::isOutside const): Return early if firstChild() return null.
    (WebCore::RenderVTTCue::isOverlapping const): Ditto.
    (WebCore::RenderVTTCue::overlappingObject const): Ditto.
    (WebCore::RenderVTTCue::moveIfNecessaryToKeepWithinContainer): Ditto.
    (WebCore::RenderVTTCue::findNonOverlappingPosition const): Ditto.

    Canonical link: https://commits.webkit.org/265420@main
Identifier: 265377.2@safari-7616.1.20-branch
  • Loading branch information
eric-carlson authored and MyahCobbs committed Jun 23, 2023
1 parent 9a6517c commit b067c6e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Source/WebCore/rendering/RenderVTTCue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ void RenderVTTCue::layout()

bool RenderVTTCue::initializeLayoutParameters(LayoutUnit& step, LayoutUnit& position)
{
ASSERT(firstChild());
if (!firstChild())
return false;

Expand Down Expand Up @@ -158,6 +157,9 @@ void RenderVTTCue::placeBoxInDefaultPosition(LayoutUnit position, bool& switched

bool RenderVTTCue::isOutside() const
{
if (!firstChild())
return false;

return !rectIsWithinContainer(backdropBox().absoluteBoundingBoxRect());
}

Expand All @@ -169,11 +171,16 @@ bool RenderVTTCue::rectIsWithinContainer(const IntRect& rect) const

bool RenderVTTCue::isOverlapping() const
{
if (!firstChild())
return false;

return overlappingObject();
}

RenderVTTCue* RenderVTTCue::overlappingObject() const
{
ASSERT(firstChild());

return overlappingObjectForRect(backdropBox().absoluteBoundingBoxRect());
}

Expand Down Expand Up @@ -257,6 +264,9 @@ bool RenderVTTCue::switchDirection(bool& switched, LayoutUnit& step)

void RenderVTTCue::moveIfNecessaryToKeepWithinContainer()
{
if (!firstChild())
return;

IntRect containerRect = containingBlock()->absoluteBoundingBoxRect();
IntRect cueRect = backdropBox().absoluteBoundingBoxRect();

Expand Down Expand Up @@ -287,6 +297,9 @@ void RenderVTTCue::moveIfNecessaryToKeepWithinContainer()

bool RenderVTTCue::findNonOverlappingPosition(int& newX, int& newY) const
{
if (!firstChild())
return false;

newX = x();
newY = y();
IntRect srcRect = backdropBox().absoluteBoundingBoxRect();
Expand Down Expand Up @@ -407,6 +420,7 @@ RenderBlockFlow& RenderVTTCue::backdropBox() const

RenderInline& RenderVTTCue::cueBox() const
{
ASSERT(firstChild());
return downcast<RenderInline>(*backdropBox().firstChild());
}

Expand Down

0 comments on commit b067c6e

Please sign in to comment.