void RenderReplaced::adjustOverflowForBoxShadowAndReflect() { IntRect overflow; for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next) { if (boxShadow->style == Inset) continue; IntRect shadow = borderBoxRect(); shadow.move(boxShadow->x, boxShadow->y); shadow.inflate(boxShadow->blur + boxShadow->spread); overflow.unite(shadow); } // Now that we have an overflow rect including shadow, let's make sure that // the reflection (which can also include the shadow) is also included. if (hasReflection()) { if (overflow.isEmpty()) overflow = borderBoxRect(); overflow.unite(reflectedRect(overflow)); } if (!overflow.isEmpty()) { if (!gOverflowRectMap) gOverflowRectMap = new OverflowRectMap(); overflow.unite(borderBoxRect()); gOverflowRectMap->set(this, overflow); setReplacedHasOverflow(true); } else if (replacedHasOverflow()) { gOverflowRectMap->remove(this); setReplacedHasOverflow(false); } }
void RenderMedia::layout() { StackStats::LayoutCheckPoint layoutCheckPoint; LayoutSize oldSize = contentBoxRect().size(); RenderImage::layout(); RenderBox* controlsRenderer = toRenderBox(m_children.firstChild()); if (!controlsRenderer) return; bool controlsNeedLayout = controlsRenderer->needsLayout(); // If the region chain has changed we also need to relayout the controls to update the region box info. // FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock. const RenderFlowThread* flowThread = flowThreadContainingBlock(); if (flowThread && !controlsNeedLayout) { if (flowThread->pageLogicalSizeChanged()) controlsNeedLayout = true; } LayoutSize newSize = contentBoxRect().size(); if (newSize == oldSize && !controlsNeedLayout) return; // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient, // and this method will be called many times per second during playback, use a LayoutStateMaintainer: LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop())); controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed)); controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed)); controlsRenderer->setNeedsLayout(true, MarkOnlyThis); controlsRenderer->layout(); setChildNeedsLayout(false); statePusher.pop(); }
void RenderVTTCue::layout() { LayoutRectRecorder recorder(*this); RenderBlockFlow::layout(); // If WebVTT Regions are used, the regular WebVTT layout algorithm is no // longer necessary, since cues having the region parameter set do not have // any positioning parameters. Also, in this case, the regions themselves // have positioning information. if (!m_cue->regionId().isEmpty()) return; LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); if (m_cue->snapToLines()) repositionCueSnapToLinesSet(); else repositionCueSnapToLinesNotSet(); statePusher.pop(); }
void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) { ASSERT(needsLayout()); if (!relayoutChildren && simplifiedLayout()) return; // FIXME: Much of this method is boiler plate that matches RenderBox::layoutBlock and Render*FlexibleBox::layoutBlock. // It would be nice to refactor some of the duplicate code. LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); if (inRenderFlowThread()) { // Regions changing widths can force us to relayout our children. if (logicalWidthChangedInRegions()) relayoutChildren = true; } computeInitialRegionRangeForBlock(); LayoutSize previousSize = size(); setLogicalHeight(0); computeLogicalWidth(); m_overflow.clear(); layoutGridItems(); LayoutUnit oldClientAfterEdge = clientLogicalBottom(); computeLogicalHeight(); if (size() != previousSize) relayoutChildren = true; layoutPositionedObjects(relayoutChildren || isRoot()); computeRegionRangeForBlock(); computeOverflow(oldClientAfterEdge); statePusher.pop(); updateLayerTransform(); // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if // we overflow or not. if (hasOverflowClip()) layer()->updateScrollInfoAfterLayout(); repainter.repaintAfterLayout(); setNeedsLayout(false); }
void RenderTextTrackCue::layout() { StackStats::LayoutCheckPoint layoutCheckPoint; RenderBlock::layout(); LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); if (m_cue->cueType()== TextTrackCue::WebVTT) { if (m_cue->snapToLines()) repositionCueSnapToLinesSet(); else repositionCueSnapToLinesNotSet(); } else repositionGenericCue(); statePusher.pop(); }
void RenderDialog::layout() { LayoutRepainter repainter(*this, true); LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); RenderBlock::layout(); RenderStyle* styleToUse = style(); if (styleToUse->position() != AbsolutePosition || !styleToUse->top().isAuto() || !styleToUse->bottom().isAuto()) { statePusher.pop(); return; } // Adjust the dialog's position to be centered in or at the top of the viewport. // FIXME: Figure out what to do in vertical writing mode. FrameView* frameView = document()->view(); int scrollTop = frameView->scrollOffset().height(); FloatPoint absolutePoint(0, scrollTop); int visibleHeight = frameView->visibleContentRect(true).height(); if (height() < visibleHeight) absolutePoint.move(0, (visibleHeight - height()) / 2); FloatPoint localPoint = containingBlock()->absoluteToLocal(absolutePoint); LayoutUnit localTop = LayoutSize(localPoint.x(), localPoint.y()).height(); setY(localTop); statePusher.pop(); // FIXME: Since there is always a layer here, repainter shouldn't be necessary. But without it, the dialog is sometimes not painted (see bug 90670). repainter.repaintAfterLayout(); }
void RenderMedia::layout() { IntSize oldSize = contentBoxRect().size(); RenderImage::layout(); RenderBox* controlsRenderer = m_controls->renderBox(); if (!controlsRenderer) return; IntSize newSize = contentBoxRect().size(); if (newSize == oldSize && !controlsRenderer->needsLayout()) return; // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or // call view()->disableLayoutState(). Since using a LayoutStateMaintainer is slightly more efficient, // and this method will be called many times per second during playback, use a LayoutStateMaintainer: LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); controlsRenderer->setLocation(borderLeft() + paddingLeft(), borderTop() + paddingTop()); controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed)); controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed)); controlsRenderer->setNeedsLayout(true, false); controlsRenderer->layout(); setChildNeedsLayout(false); statePusher.pop(); }
void RenderVTTCue::layout() { StackStats::LayoutCheckPoint layoutCheckPoint; RenderBlockFlow::layout(); #if ENABLE(WEBVTT_REGIONS) // If WebVTT Regions are used, the regular WebVTT layout algorithm is no // longer necessary, since cues having the region parameter set do not have // any positioning parameters. Also, in this case, the regions themselves // have positioning information. if (!m_cue->regionId().isEmpty()) return; #endif LayoutStateMaintainer statePusher(view(), *this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); if (m_cue->cueType()== TextTrackCue::WebVTT) { if (toVTTCue(m_cue)->snapToLines()) repositionCueSnapToLinesSet(); else repositionCueSnapToLinesNotSet(); } else repositionGenericCue(); statePusher.pop(); }