diff options
Diffstat (limited to 'Source/WebCore/rendering')
44 files changed, 501 insertions, 392 deletions
diff --git a/Source/WebCore/rendering/FilterEffectRenderer.cpp b/Source/WebCore/rendering/FilterEffectRenderer.cpp index 78ed248ff..9cb29479c 100644 --- a/Source/WebCore/rendering/FilterEffectRenderer.cpp +++ b/Source/WebCore/rendering/FilterEffectRenderer.cpp @@ -202,7 +202,11 @@ bool FilterEffectRenderer::build(Document* document, const FilterOperations& ope m_hasFilterThatMovesPixels = operations.hasFilterThatMovesPixels(); if (m_hasFilterThatMovesPixels) operations.getOutsets(m_topOutset, m_rightOutset, m_bottomOutset, m_leftOutset); - m_effects.clear(); + + // Keep the old effects on the stack until we've created the new effects. + // New FECustomFilters can reuse cached resources from old FECustomFilters. + FilterEffectList oldEffects; + m_effects.swap(oldEffects); RefPtr<FilterEffect> previousEffect = m_sourceGraphic; for (size_t i = 0; i < operations.operations().size(); ++i) { diff --git a/Source/WebCore/rendering/FlowThreadController.h b/Source/WebCore/rendering/FlowThreadController.h index 0aef61130..ae6237d2d 100644 --- a/Source/WebCore/rendering/FlowThreadController.h +++ b/Source/WebCore/rendering/FlowThreadController.h @@ -42,6 +42,7 @@ class RenderNamedFlowThread; typedef ListHashSet<RenderNamedFlowThread*> RenderNamedFlowThreadList; class FlowThreadController { + WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<FlowThreadController> create(RenderView*); ~FlowThreadController(); diff --git a/Source/WebCore/rendering/HitTestRequest.h b/Source/WebCore/rendering/HitTestRequest.h index 1900900f1..3faf88a9f 100644 --- a/Source/WebCore/rendering/HitTestRequest.h +++ b/Source/WebCore/rendering/HitTestRequest.h @@ -37,7 +37,6 @@ public: TouchEvent = 1 << 7, AllowShadowContent = 1 << 8, AllowChildFrameContent = 1 << 9, - // FIXME: Get rid of the two options below if possible. ChildFrameHitTest = 1 << 10, TestChildFrameScrollBars = 1 << 11 }; diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index c2a406156..198f37e91 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2232,7 +2232,7 @@ LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const Re LayoutUnit blockOffset = logicalTopForChild(child); if (region) - blockOffset = max(blockOffset, blockOffset + (region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage)); + blockOffset = max(blockOffset, blockOffset + (region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage)); LayoutUnit startOff = startOffsetForLine(blockOffset, false, region, offsetFromLogicalTopOfFirstPage, logicalHeightForChild(child)); @@ -6896,7 +6896,7 @@ bool RenderBlock::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pageBou return false; if (region->isLastRegion()) return region->isRenderRegionSet() || region->style()->regionOverflow() == BreakRegionOverflow - || (pageBoundaryRule == IncludePageBoundary && pageOffset == region->offsetFromLogicalTopOfFirstPage()); + || (pageBoundaryRule == IncludePageBoundary && pageOffset == region->logicalTopForFlowThreadContent()); return true; } @@ -7187,20 +7187,51 @@ bool RenderBlock::lineWidthForPaginatedLineChanged(RootInlineBox* rootBox, Layou LayoutUnit RenderBlock::offsetFromLogicalTopOfFirstPage() const { - // FIXME: This function needs to work without layout state. It's fine to use the layout state as a cache - // for speed, but we need a slow implementation that will walk up the containing block chain and figure - // out our offset from the top of the page. LayoutState* layoutState = view()->layoutState(); - if (!layoutState || !layoutState->isPaginated()) - return 0; + if (layoutState && !layoutState->isPaginated()) + return ZERO_LAYOUT_UNIT; + if (layoutState) { + // FIXME: Sanity check that the renderer in the layout state is ours, since otherwise the computation will be off. + // Right now this assert gets hit inside computeLogicalHeight for percentage margins, since they're computed using + // widths which can vary in each region. Until we patch that, we can't have this assert. + // ASSERT(layoutState->m_renderer == this); - // FIXME: Sanity check that the renderer in the layout state is ours, since otherwise the computation will be off. - // Right now this assert gets hit inside computeLogicalHeight for percentage margins, since they're computed using - // widths which can vary in each region. Until we patch that, we can't have this assert. - // ASSERT(layoutState->m_renderer == this); + LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; + return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(); + } + // FIXME: Right now, this assert is hit outside layout, from logicalLeftSelectionOffset in selectionGapRectsForRepaint (called from FrameSelection::selectAll). + // ASSERT(inRenderFlowThread()); - LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; - return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(); + // FIXME: This is a slower path that doesn't use layout state and relies on getting your logical top inside the enclosing flow thread. It doesn't + // work with columns or pages currently, but it should once they have been switched over to using flow threads. + if (!inRenderFlowThread()) + return ZERO_LAYOUT_UNIT; + + const RenderBlock* currentBlock = this; + LayoutRect blockRect(0, 0, width(), height()); + + while (currentBlock && !currentBlock->isRenderFlowThread()) { + RenderBlock* containerBlock = currentBlock->containingBlock(); + ASSERT(containerBlock); + if (!containerBlock) + return ZERO_LAYOUT_UNIT; + LayoutPoint currentBlockLocation = currentBlock->location(); + + if (containerBlock->style()->writingMode() != currentBlock->style()->writingMode()) { + // We have to put the block rect in container coordinates + // and we have to take into account both the container and current block flipping modes + if (containerBlock->style()->isFlippedBlocksWritingMode()) { + if (containerBlock->isHorizontalWritingMode()) + blockRect.setY(currentBlock->height() - blockRect.maxY()); + else + blockRect.setX(currentBlock->width() - blockRect.maxX()); + } + currentBlock->flipForWritingMode(blockRect); + } + blockRect.moveBy(currentBlockLocation); + currentBlock = containerBlock; + }; + return currentBlock->isHorizontalWritingMode() ? blockRect.y() : blockRect.x(); } RenderRegion* RenderBlock::regionAtBlockOffset(LayoutUnit blockOffset) const @@ -7248,9 +7279,9 @@ RenderRegion* RenderBlock::clampToStartAndEndRegions(RenderRegion* region) const RenderRegion* endRegion; enclosingRenderFlowThread()->getRegionRangeForBox(this, startRegion, endRegion); - if (startRegion && region->offsetFromLogicalTopOfFirstPage() < startRegion->offsetFromLogicalTopOfFirstPage()) + if (startRegion && region->logicalTopForFlowThreadContent() < startRegion->logicalTopForFlowThreadContent()) return startRegion; - if (endRegion && region->offsetFromLogicalTopOfFirstPage() > endRegion->offsetFromLogicalTopOfFirstPage()) + if (endRegion && region->logicalTopForFlowThreadContent() > endRegion->logicalTopForFlowThreadContent()) return endRegion; return region; diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index fe6694437..6394a6db4 100755 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -1232,7 +1232,7 @@ void RenderBlock::layoutRunsAndFloats(LineLayoutState& layoutState, bool hasInli // that the block really needed a full layout, we missed our chance to repaint the layer // before layout started. Luckily the layer has cached the repaint rect for its original // position and size, and so we can use that to make a repaint happen now. - repaintUsingContainer(containerForRepaint(), layer()->repaintRect()); + repaintUsingContainer(containerForRepaint(), pixelSnappedIntRect(layer()->repaintRect())); } } diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 446a7f8f1..2c3375da0 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -647,6 +647,17 @@ LayoutSize RenderBox::cachedSizeForOverflowClip() const return layer()->size(); } +void RenderBox::applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const +{ + paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden. + + // height() is inaccurate if we're in the middle of a layout of this RenderBox, so use the + // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint + // anyway if its size does change. + LayoutRect clipRect(LayoutPoint(), cachedSizeForOverflowClip()); + paintRect = intersection(paintRect, clipRect); +} + LayoutUnit RenderBox::minPreferredLogicalWidth() const { if (preferredLogicalWidthsDirty()) @@ -1157,7 +1168,7 @@ LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar LayoutUnit logicalTopPosition = logicalTop(); LayoutUnit adjustedPageOffsetForContainingBlock = offsetFromLogicalTopOfFirstPage - logicalTop(); if (region) { - LayoutUnit offsetFromLogicalTopOfRegion = region ? region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage : ZERO_LAYOUT_UNIT; + LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage : ZERO_LAYOUT_UNIT; logicalTopPosition = max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfRegion); containingBlockRegion = cb->clampToStartAndEndRegions(region); } @@ -1219,7 +1230,7 @@ LayoutUnit RenderBox::containingBlockAvailableLineWidthInRegion(RenderRegion* re LayoutUnit logicalTopPosition = logicalTop(); LayoutUnit adjustedPageOffsetForContainingBlock = offsetFromLogicalTopOfFirstPage - logicalTop(); if (region) { - LayoutUnit offsetFromLogicalTopOfRegion = region ? region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage : ZERO_LAYOUT_UNIT; + LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage : ZERO_LAYOUT_UNIT; logicalTopPosition = max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfRegion); containingBlockRegion = cb->clampToStartAndEndRegions(region); } @@ -1574,21 +1585,13 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout, // its controlClipRect will be wrong. For overflow clip we use the values cached by the layer. + rect.setLocation(topLeft); if (o->hasOverflowClip()) { RenderBox* containerBox = toRenderBox(o); - - // o->height() is inaccurate if we're in the middle of a layout of |o|, so use the - // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint - // anyway if its size does change. - topLeft -= containerBox->scrolledContentOffset(); // For overflow:auto/scroll/hidden. - - LayoutRect repaintRect(topLeft, rect.size()); - LayoutRect boxRect(LayoutPoint(), containerBox->cachedSizeForOverflowClip()); - rect = intersection(repaintRect, boxRect); + containerBox->applyCachedClipAndScrollOffsetForRepaint(rect); if (rect.isEmpty()) return; - } else - rect.setLocation(topLeft); + } if (containerSkipped) { // If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates. @@ -1964,7 +1967,7 @@ static bool shouldFlipBeforeAfterMargins(const RenderStyle* containingBlockStyle void RenderBox::updateLogicalHeight() { LogicalExtentComputedValues computedValues; - computeLogicalHeight(computedValues); + computeLogicalHeight(logicalHeight(), logicalTop(), computedValues); setLogicalHeight(computedValues.m_extent); setLogicalTop(computedValues.m_position); @@ -1972,10 +1975,10 @@ void RenderBox::updateLogicalHeight() setMarginAfter(computedValues.m_margins.m_after); } -void RenderBox::computeLogicalHeight(LogicalExtentComputedValues& computedValues) const +void RenderBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const { - computedValues.m_extent = logicalHeight(); - computedValues.m_position = logicalTop(); + computedValues.m_extent = logicalHeight; + computedValues.m_position = logicalTop; // Cell height is managed by the table and inline non-replaced elements do not support a height property. if (isTableCell() || (isInline() && !isReplaced())) @@ -1999,7 +2002,7 @@ void RenderBox::computeLogicalHeight(LogicalExtentComputedValues& computedValues if (isTable()) { if (hasPerpendicularContainingBlock) { bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb->style(), style()); - computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), logicalHeight(), + computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), computedValues.m_extent, shouldFlipBeforeAfter ? computedValues.m_margins.m_after : computedValues.m_margins.m_before, shouldFlipBeforeAfter ? computedValues.m_margins.m_before : computedValues.m_margins.m_after); } @@ -2039,7 +2042,7 @@ void RenderBox::computeLogicalHeight(LogicalExtentComputedValues& computedValues if (checkMinMaxHeight) { heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); if (heightResult == -1) - heightResult = logicalHeight(); + heightResult = computedValues.m_extent; heightResult = constrainLogicalHeightByMinMax(heightResult); } else { // The only times we don't check min/max height are when a fixed length has @@ -2089,21 +2092,21 @@ void RenderBox::computeLogicalHeight(LogicalExtentComputedValues& computedValues LayoutUnit RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height) const { - LayoutUnit logicalHeight = computeContentLogicalHeightUsing(heightType, height); + LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height); if (logicalHeight != -1) logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); return logicalHeight; } -LayoutUnit RenderBox::computeLogicalClientHeight(SizeType heightType, const Length& height) +LayoutUnit RenderBox::computeContentLogicalHeight(SizeType heightType, const Length& height) { - LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(heightType, height); + LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height); if (heightIncludingScrollbar == -1) return -1; return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); } -LayoutUnit RenderBox::computeContentLogicalHeightUsing(SizeType heightType, const Length& height) const +LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height) const { if (height.isAuto()) return heightType == MinSize ? 0 : -1; @@ -2118,7 +2121,7 @@ LayoutUnit RenderBox::computeContentLogicalHeightUsing(SizeType heightType, cons LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const { - LayoutUnit result = -1; + LayoutUnit availableHeight = -1; // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing // block that may have a specified height and then use it. In strict mode, this violates the @@ -2127,9 +2130,12 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const // only at explicit containers. bool skippedAutoHeightContainingBlock = false; RenderBlock* cb = containingBlock(); - while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) { + LayoutUnit rootMarginBorderPaddingHeight = 0; + while (!cb->isRenderView() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == cb->isHorizontalWritingMode()) { if (!document()->inQuirksMode() && !cb->isAnonymousBlock()) break; + if (cb->isBody() || cb->isRoot()) + rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfter() + cb->borderAndPaddingLogicalHeight(); skippedAutoHeightContainingBlock = true; cb = cb->containingBlock(); cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); @@ -2145,10 +2151,12 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const bool includeBorderPadding = isTable(); - // Table cells violate what the CSS spec says to do with heights. Basically we - // don't care if the cell specified a height or not. We just always make ourselves - // be a percentage of the cell's current content height. - if (cb->isTableCell()) { + if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) + availableHeight = cb->contentLogicalWidth(); + else if (cb->isTableCell()) { + // Table cells violate what the CSS spec says to do with heights. Basically we + // don't care if the cell specified a height or not. We just always make ourselves + // be a percentage of the cell's current content height. if (!skippedAutoHeightContainingBlock) { if (!cb->hasOverrideHeight()) { // Normally we would let the cell size intrinsically, but scrolling overflow has to be @@ -2163,38 +2171,42 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const return 0; return -1; } - result = cb->overrideLogicalContentHeight(); + availableHeight = cb->overrideLogicalContentHeight(); includeBorderPadding = true; } } else if (cbstyle->logicalHeight().isFixed()) { // Otherwise we only use our percentage height if our containing block had a specified height. LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle->logicalHeight().value()); - result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); + availableHeight = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { // We need to recur and compute the percentage height for our containing block. LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle->logicalHeight()); if (heightWithScrollbar != -1) { LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar); - result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); + availableHeight = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); } - } else if (cb->isRenderView() || (cb->isBody() && document()->inQuirksMode()) || isOutOfFlowPositionedWithSpecifiedHeight) { + } else if (cb->isRenderView() || isOutOfFlowPositionedWithSpecifiedHeight) { // Don't allow this to affect the block' height() member variable, since this // can get called while the block is still laying out its kids. LayoutUnit oldHeight = cb->logicalHeight(); cb->updateLogicalHeight(); - result = cb->contentLogicalHeight(); + availableHeight = cb->contentLogicalHeight(); cb->setLogicalHeight(oldHeight); } - if (result != -1) { - result = valueForLength(height, result); - if (includeBorderPadding) { - // It is necessary to use the border-box to match WinIE's broken - // box model. This is essential for sizing inside - // table cells using percentage heights. - result -= borderAndPaddingLogicalHeight(); - result = max<LayoutUnit>(0, result); - } + if (availableHeight == -1) + return availableHeight; + + availableHeight -= rootMarginBorderPaddingHeight; + + LayoutUnit result = valueForLength(height, availableHeight); + if (includeBorderPadding) { + // FIXME: Table cells should default to box-sizing: border-box so we can avoid this hack. + // It is necessary to use the border-box to match WinIE's broken + // box model. This is essential for sizing inside + // table cells using percentage heights. + result -= borderAndPaddingLogicalHeight(); + return max<LayoutUnit>(0, result); } return result; } @@ -2334,11 +2346,12 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h) const return overrideLogicalContentHeight(); if (h.isPercent() && isOutOfFlowPositioned()) { + // FIXME: This is wrong if the containingBlock has a perpendicular writing mode. LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(containingBlock()); return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight)); } - LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(MainOrPreferredSize, h); + LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h); if (heightIncludingScrollbar != -1) return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); @@ -2353,6 +2366,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h) const return adjustContentBoxLogicalHeightForBoxSizing(newHeight); } + // FIXME: This is wrong if the containingBlock has a perpendicular writing mode. return containingBlock()->availableLogicalHeight(); } @@ -2497,7 +2511,7 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh if (region && curr->isRenderBlock()) { const RenderBlock* cb = toRenderBlock(curr); region = cb->clampToStartAndEndRegions(region); - RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region, region->offsetFromLogicalTopOfFirstPage()); + RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region, region->logicalTopForFlowThreadContent()); if (boxInfo) staticPosition += boxInfo->logicalLeft(); } @@ -2516,7 +2530,7 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh if (region && curr->isRenderBlock()) { const RenderBlock* cb = toRenderBlock(curr); region = cb->clampToStartAndEndRegions(region); - RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region, region->offsetFromLogicalTopOfFirstPage()); + RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region, region->logicalTopForFlowThreadContent()); if (boxInfo) { if (curr != containerBlock) staticPosition -= cb->logicalWidth() - (boxInfo->logicalLeft() + boxInfo->logicalWidth()); @@ -2928,7 +2942,8 @@ void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp computeBlockStaticDistance(logicalTopLength, logicalBottomLength, this, containerBlock); // Calculate constraint equation values for 'height' case. - computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, + LayoutUnit logicalHeight = computedValues.m_extent; + computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, logicalTopLength, logicalBottomLength, marginBefore, marginAfter, computedValues); @@ -2939,7 +2954,7 @@ void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp if (!styleToUse->logicalMaxHeight().isUndefined()) { LogicalExtentComputedValues maxValues; - computePositionedLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, + computePositionedLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, logicalTopLength, logicalBottomLength, marginBefore, marginAfter, maxValues); @@ -2955,7 +2970,7 @@ void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp if (!styleToUse->logicalMinHeight().isZero()) { LogicalExtentComputedValues minValues; - computePositionedLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, + computePositionedLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, logicalTopLength, logicalBottomLength, marginBefore, marginAfter, minValues); @@ -3010,7 +3025,7 @@ static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const R } void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock, - LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, + LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, LogicalExtentComputedValues& computedValues) const { @@ -3022,7 +3037,7 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto())); LayoutUnit logicalHeightValue; - LayoutUnit contentLogicalHeight = logicalHeight() - bordersPlusPadding; + LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; LayoutUnit logicalTopValue = 0; diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index af3c4624a..590875a8b 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -366,7 +366,7 @@ public: virtual void updateLogicalWidth(); virtual void updateLogicalHeight(); - void computeLogicalHeight(LogicalExtentComputedValues&) const; + void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const; RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const; void computeLogicalWidthInRegion(LogicalExtentComputedValues&, RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = ZERO_LAYOUT_UNIT) const; @@ -389,8 +389,8 @@ public: LayoutUnit computeLogicalWidthInRegionUsing(SizeType, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage) const; LayoutUnit computeLogicalHeightUsing(SizeType, const Length& height) const; - LayoutUnit computeLogicalClientHeight(SizeType, const Length& height); - LayoutUnit computeContentLogicalHeightUsing(SizeType, const Length& height) const; + LayoutUnit computeContentLogicalHeight(SizeType, const Length& height); + LayoutUnit computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height) const; LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const; LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const; LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const; @@ -509,6 +509,7 @@ public: IntSize scrolledContentOffset() const; LayoutSize cachedSizeForOverflowClip() const; + void applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const; virtual bool hasRelativeDimensions() const; virtual bool hasRelativeLogicalHeight() const; @@ -592,8 +593,8 @@ private: LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, LogicalExtentComputedValues&) const; - void computePositionedLogicalHeightUsing(SizeType, Length logicalHeight, const RenderBoxModelObject* containerBlock, - LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, + void computePositionedLogicalHeightUsing(SizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock, + LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom, LogicalExtentComputedValues&) const; diff --git a/Source/WebCore/rendering/RenderBoxRegionInfo.h b/Source/WebCore/rendering/RenderBoxRegionInfo.h index 3f9d0fa1b..bcaa3353c 100644 --- a/Source/WebCore/rendering/RenderBoxRegionInfo.h +++ b/Source/WebCore/rendering/RenderBoxRegionInfo.h @@ -30,6 +30,7 @@ namespace WebCore { class RenderBoxRegionInfo { + WTF_MAKE_FAST_ALLOCATED; public: RenderBoxRegionInfo(LayoutUnit logicalLeft, LayoutUnit logicalWidth, bool isShifted) : m_logicalLeft(logicalLeft) diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index c3a2a5c9a..85a5fe201 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -307,7 +307,7 @@ void RenderFlexibleBox::repositionLogicalHeightDependentFlexItems(OrderIterator& alignFlexLines(iterator, lineContexts); // If we have a single line flexbox, the line height is all the available space. - // For flex-direction: row, this means we need to use the height, so we do this after calling computeLogicalHeight. + // For flex-direction: row, this means we need to use the height, so we do this after calling updateLogicalHeight. if (!isMultiline() && lineContexts.size() == 1) lineContexts[0].crossAxisExtent = crossAxisContentExtent(); alignChildren(iterator, lineContexts); @@ -393,20 +393,23 @@ LayoutUnit RenderFlexibleBox::crossAxisContentExtent() const return isHorizontalFlow() ? contentHeight() : contentWidth(); } -LayoutUnit RenderFlexibleBox::mainAxisContentExtent() +LayoutUnit RenderFlexibleBox::mainAxisContentExtent(LayoutUnit contentLogicalHeight) { - if (isColumnFlow()) - return std::max(LayoutUnit(0), computeLogicalClientHeight(MainOrPreferredSize, style()->logicalHeight())); + if (isColumnFlow()) { + LogicalExtentComputedValues computedValues; + computeLogicalHeight(contentLogicalHeight, logicalTop(), computedValues); + return std::max(LayoutUnit(0), computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight()); + } return contentLogicalWidth(); } -LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, SizeType sizeType, const Length& size, LayoutUnit maximumValue) +LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, SizeType sizeType, const Length& size) { // FIXME: This is wrong for orthogonal flows. It should use the flexbox's writing-mode, not the child's in order // to figure out the logical height/width. if (isColumnFlow()) - return child->computeLogicalClientHeight(sizeType, size); - return child->adjustContentBoxLogicalWidthForBoxSizing(valueForLength(size, maximumValue, view())); + return child->computeContentLogicalHeight(sizeType, size); + return child->adjustContentBoxLogicalWidthForBoxSizing(valueForLength(size, contentLogicalWidth(), view())); } WritingMode RenderFlexibleBox::transformedWritingMode() const @@ -605,30 +608,7 @@ LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* LayoutUnit mainAxisExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth(); return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); } - return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis, mainAxisContentExtent())); -} - -LayoutUnit RenderFlexibleBox::computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent) -{ - LayoutUnit contentExtent = 0; - if (!isColumnFlow()) - contentExtent = mainAxisContentExtent(); - else if (hasOverrideHeight()) - contentExtent = overrideLogicalContentHeight(); - else { - LayoutUnit heightResult = computeLogicalClientHeight(MainOrPreferredSize, style()->logicalHeight()); - if (heightResult == -1) - heightResult = preferredMainAxisExtent; - LayoutUnit minHeight = computeLogicalClientHeight(MinSize, style()->logicalMinHeight()); // Leave as -1 if unset. - LayoutUnit maxHeight = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalClientHeight(MaxSize, style()->logicalMaxHeight()); - if (maxHeight == -1) - maxHeight = heightResult; - heightResult = std::min(maxHeight, heightResult); - heightResult = std::max(minHeight, heightResult); - contentExtent = heightResult; - } - - return contentExtent - preferredMainAxisExtent; + return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis)); } void RenderFlexibleBox::layoutFlexItems(OrderIterator& iterator, WTF::Vector<LineContext>& lineContexts) @@ -641,7 +621,7 @@ void RenderFlexibleBox::layoutFlexItems(OrderIterator& iterator, WTF::Vector<Lin LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefore(); while (computeNextFlexLine(iterator, orderedChildren, preferredMainAxisExtent, totalFlexGrow, totalWeightedFlexShrink, minMaxAppliedMainAxisExtent)) { - LayoutUnit availableFreeSpace = computeAvailableFreeSpace(preferredMainAxisExtent); + LayoutUnit availableFreeSpace = mainAxisContentExtent(preferredMainAxisExtent) - preferredMainAxisExtent; FlexSign flexSign = (minMaxAppliedMainAxisExtent < preferredMainAxisExtent + availableFreeSpace) ? PositiveFlexibility : NegativeFlexibility; InflexibleFlexItemSize inflexibleItems; WTF::Vector<LayoutUnit> childSizes; @@ -757,17 +737,16 @@ LayoutUnit RenderFlexibleBox::marginBoxAscentForChild(RenderBox* child) return ascent + flowAwareMarginBeforeForChild(child); } -LayoutUnit RenderFlexibleBox::computeMarginValue(Length margin, LayoutUnit availableSize, RenderView* view) +LayoutUnit RenderFlexibleBox::computeChildMarginValue(Length margin, RenderView* view) { - // CSS always computes percent margins with respect to the containing block's width, even for margin-top/margin-bottom. - if (margin.isPercent()) - availableSize = logicalWidth(); + // When resolving the margins, we use the content size for resolving percent and calc (for percents in calc expressions) margins. + // Fortunately, percent margins are always computed with respect to the block's width, even for margin-top and margin-bottom. + LayoutUnit availableSize = contentLogicalWidth(); return minimumValueForLength(margin, availableSize, view); } void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, OrderHashSet& orderValues) { - LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); RenderView* renderView = view(); for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { orderValues.add(child->style()->order()); @@ -787,35 +766,21 @@ void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, Ord // Before running the flex algorithm, 'auto' has a margin of 0. // Also, if we're not auto sizing, we don't do a layout that computes the start/end margins. if (isHorizontalFlow()) { - child->setMarginLeft(computeMarginValue(child->style()->marginLeft(), flexboxAvailableContentExtent, renderView)); - child->setMarginRight(computeMarginValue(child->style()->marginRight(), flexboxAvailableContentExtent, renderView)); + child->setMarginLeft(computeChildMarginValue(child->style()->marginLeft(), renderView)); + child->setMarginRight(computeChildMarginValue(child->style()->marginRight(), renderView)); } else { - child->setMarginTop(computeMarginValue(child->style()->marginTop(), flexboxAvailableContentExtent, renderView)); - child->setMarginBottom(computeMarginValue(child->style()->marginBottom(), flexboxAvailableContentExtent, renderView)); + child->setMarginTop(computeChildMarginValue(child->style()->marginTop(), renderView)); + child->setMarginBottom(computeChildMarginValue(child->style()->marginBottom(), renderView)); } } } -LayoutUnit RenderFlexibleBox::lineBreakLength() -{ - if (!isColumnFlow()) - return mainAxisContentExtent(); - - LayoutUnit height = computeLogicalClientHeight(MainOrPreferredSize, style()->logicalHeight()); - if (height == -1) - height = MAX_LAYOUT_UNIT; - LayoutUnit maxHeight = computeLogicalClientHeight(MaxSize, style()->logicalMaxHeight()); - if (maxHeight != -1) - height = std::min(height, maxHeight); - return height; -} - -LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize, LayoutUnit flexboxAvailableContentExtent) +LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize) { // FIXME: Support intrinsic min/max lengths. Length max = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); if (max.isSpecified()) { - LayoutUnit maxExtent = computeMainAxisExtentForChild(child, MaxSize, max, flexboxAvailableContentExtent); + LayoutUnit maxExtent = computeMainAxisExtentForChild(child, MaxSize, max); if (maxExtent != -1 && childSize > maxExtent) childSize = maxExtent; } @@ -823,7 +788,7 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, Layo Length min = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); LayoutUnit minExtent = 0; if (min.isSpecified()) - minExtent = computeMainAxisExtentForChild(child, MinSize, min, flexboxAvailableContentExtent); + minExtent = computeMainAxisExtentForChild(child, MinSize, min); else if (min.isAuto()) { minExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->minPreferredLogicalWidth(); minExtent -= mainAxisBorderAndPaddingExtentForChild(child); @@ -841,8 +806,7 @@ bool RenderFlexibleBox::computeNextFlexLine(OrderIterator& iterator, OrderedFlex if (!iterator.currentChild()) return false; - LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); - LayoutUnit lineBreak = lineBreakLength(); + LayoutUnit lineBreakLength = mainAxisContentExtent(MAX_LAYOUT_UNIT); for (RenderBox* child = iterator.currentChild(); child; child = iterator.next()) { if (child->isOutOfFlowPositioned()) { @@ -854,14 +818,14 @@ bool RenderFlexibleBox::computeNextFlexLine(OrderIterator& iterator, OrderedFlex LayoutUnit childMainAxisMarginBoxExtent = mainAxisBorderAndPaddingExtentForChild(child) + childMainAxisExtent; childMainAxisMarginBoxExtent += isHorizontalFlow() ? child->marginWidth() : child->marginHeight(); - if (isMultiline() && preferredMainAxisExtent + childMainAxisMarginBoxExtent > lineBreak && orderedChildren.size() > 0) + if (isMultiline() && preferredMainAxisExtent + childMainAxisMarginBoxExtent > lineBreakLength && orderedChildren.size() > 0) break; orderedChildren.append(child); preferredMainAxisExtent += childMainAxisMarginBoxExtent; totalFlexGrow += child->style()->flexGrow(); totalWeightedFlexShrink += child->style()->flexShrink() * childMainAxisExtent; - LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(child, childMainAxisExtent, flexboxAvailableContentExtent); + LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(child, childMainAxisExtent); minMaxAppliedMainAxisExtent += childMinMaxAppliedMainAxisExtent - childMainAxisExtent + childMainAxisMarginBoxExtent; } return true; @@ -884,7 +848,6 @@ void RenderFlexibleBox::freezeViolations(const WTF::Vector<Violation>& violation bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedFlexItemList& children, LayoutUnit& availableFreeSpace, float& totalFlexGrow, float& totalWeightedFlexShrink, InflexibleFlexItemSize& inflexibleItems, WTF::Vector<LayoutUnit>& childSizes) { childSizes.clear(); - LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); LayoutUnit totalViolation = 0; LayoutUnit usedFreeSpace = 0; WTF::Vector<Violation> minViolations; @@ -906,7 +869,7 @@ bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && isfinite(totalWeightedFlexShrink)) childSize += roundedLayoutUnit(availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink); - LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize, flexboxAvailableContentExtent); + LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize); childSizes.append(adjustedChildSize); usedFreeSpace += adjustedChildSize - preferredChildSize; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index d418ce84c..7533c58d1 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -85,8 +85,8 @@ private: LayoutUnit crossAxisExtent() const; LayoutUnit mainAxisExtent() const; LayoutUnit crossAxisContentExtent() const; - LayoutUnit mainAxisContentExtent(); - LayoutUnit computeMainAxisExtentForChild(RenderBox* child, SizeType, const Length& size, LayoutUnit maximumValue); + LayoutUnit mainAxisContentExtent(LayoutUnit contentLogicalHeight); + LayoutUnit computeMainAxisExtentForChild(RenderBox* child, SizeType, const Length& size); WritingMode transformedWritingMode() const; LayoutUnit flowAwareBorderStart() const; LayoutUnit flowAwareBorderEnd() const; @@ -120,12 +120,10 @@ private: LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, RenderBox*); LayoutUnit marginBoxAscentForChild(RenderBox*); - LayoutUnit computeMarginValue(Length margin, LayoutUnit availableSize, RenderView*); + LayoutUnit computeChildMarginValue(Length margin, RenderView*); void computeMainAxisPreferredSizes(bool relayoutChildren, OrderHashSet&); - LayoutUnit lineBreakLength(); - LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize, LayoutUnit flexboxAvailableContentExtent); + LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize); bool computeNextFlexLine(OrderIterator&, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalFlexGrow, float& totalWeightedFlexShrink, LayoutUnit& minMaxAppliedMainAxisExtent); - LayoutUnit computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent); bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, float& totalFlexGrow, float& totalWeightedFlexShrink, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes); void freezeViolations(const WTF::Vector<Violation>&, LayoutUnit& availableFreeSpace, float& totalFlexGrow, float& totalWeightedFlexShrink, InflexibleFlexItemSize&); diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index f2a2046d2..650097e57 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h @@ -175,14 +175,14 @@ protected: typedef HashMap<const RenderBox*, RenderRegionRange> RenderRegionRangeMap; RenderRegionRangeMap m_regionRangeMap; - bool m_hasValidRegions; - bool m_regionsInvalidated; - bool m_regionsHaveUniformLogicalWidth; - bool m_regionsHaveUniformLogicalHeight; - bool m_overset; - bool m_hasRegionsWithStyling; - bool m_dispatchRegionLayoutUpdateEvent; - bool m_pageLogicalHeightChanged; + bool m_hasValidRegions : 1; + bool m_regionsInvalidated : 1; + bool m_regionsHaveUniformLogicalWidth : 1; + bool m_regionsHaveUniformLogicalHeight : 1; + bool m_overset : 1; + bool m_hasRegionsWithStyling : 1; + bool m_dispatchRegionLayoutUpdateEvent : 1; + bool m_pageLogicalHeightChanged : 1; }; inline RenderFlowThread* toRenderFlowThread(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderFrameBase.cpp b/Source/WebCore/rendering/RenderFrameBase.cpp index be92c0fa8..da2dc5a12 100644 --- a/Source/WebCore/rendering/RenderFrameBase.cpp +++ b/Source/WebCore/rendering/RenderFrameBase.cpp @@ -114,10 +114,11 @@ bool RenderFrameBase::nodeAtPoint(const HitTestRequest& request, HitTestResult& if (childRoot) { LayoutPoint adjustedLocation = accumulatedOffset + location(); - HitTestLocation newHitTestLocation(locationInContainer, -toLayoutSize(adjustedLocation)); + LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset(); + HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset); HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest); - bool isInsideChildFrame = childRoot->layer()->hitTest(newHitTestRequest, newHitTestLocation, result); + bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, result); if (isInsideChildFrame) return true; diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 941375509..234cea28b 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -993,15 +993,8 @@ LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* rep if (cb->hasColumns()) cb->adjustRectForColumns(repaintRect); - if (cb->hasOverflowClip()) { - // cb->height() is inaccurate if we're in the middle of a layout of |cb|, so use the - // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint - // anyway if its size does change. - repaintRect.move(-cb->scrolledContentOffset()); // For overflow:auto/scroll/hidden. - - LayoutRect boxRect(LayoutPoint(), cb->cachedSizeForOverflowClip()); - repaintRect.intersect(boxRect); - } + if (cb->hasOverflowClip()) + cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect); cb->computeRectForRepaint(repaintContainer, repaintRect); @@ -1073,21 +1066,13 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout, // its controlClipRect will be wrong. For overflow clip we use the values cached by the layer. + rect.setLocation(topLeft); if (o->hasOverflowClip()) { RenderBox* containerBox = toRenderBox(o); - - // o->height() is inaccurate if we're in the middle of a layout of |o|, so use the - // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint - // anyway if its size does change. - topLeft -= containerBox->scrolledContentOffset(); // For overflow:auto/scroll/hidden. - - LayoutRect repaintRect(topLeft, rect.size()); - LayoutRect boxRect(LayoutPoint(), containerBox->cachedSizeForOverflowClip()); - rect = intersection(repaintRect, boxRect); + containerBox->applyCachedClipAndScrollOffsetForRepaint(rect); if (rect.isEmpty()) return; - } else - rect.setLocation(topLeft); + } if (containerSkipped) { // If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates. diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 30f759c5d..4daeecf93 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -400,9 +400,9 @@ void RenderLayer::updateLayerPositions(LayoutPoint* offsetFromRoot, UpdateLayerP if (flags & CheckForRepaint) { if (view && !view->printing()) { if (m_repaintStatus & NeedsFullRepaint) { - renderer()->repaintUsingContainer(repaintContainer, oldRepaintRect); + renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldRepaintRect)); if (m_repaintRect != oldRepaintRect) - renderer()->repaintUsingContainer(repaintContainer, m_repaintRect); + renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_repaintRect)); } else if (shouldRepaintAfterLayout()) renderer()->repaintAfterLayoutIfNeeded(repaintContainer, oldRepaintRect, oldOutlineBox, &m_repaintRect, &m_outlineBox); } @@ -1573,7 +1573,7 @@ bool RenderLayer::usesCompositedScrolling() const if (!scrollsOverflow() || !allowsScrolling()) return false; -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) return renderer()->style()->useTouchOverflowScrolling(); #else return false; @@ -1733,7 +1733,7 @@ void RenderLayer::scrollTo(int x, int y) // Just schedule a full repaint of our object. if (view && !usesCompositedScrolling()) - renderer()->repaintUsingContainer(repaintContainer, m_repaintRect); + renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_repaintRect)); // Schedule the scroll DOM event. if (renderer()->node()) @@ -3472,9 +3472,6 @@ bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestLocation& if (node && !result.URLElement()) result.setURLElement(static_cast<Element*>(node->enclosingLinkEventParentOrSelf())); - // Next set up the correct :hover/:active state along the new chain. - updateHoverActiveState(request, result); - // Now return whether we were inside this layer (this will always be true for the root // layer). return insideLayer; @@ -4506,118 +4503,6 @@ void RenderLayer::setParent(RenderLayer* parent) #endif } -static RenderObject* commonAncestor(RenderObject* obj1, RenderObject* obj2) -{ - if (!obj1 || !obj2) - return 0; - - for (RenderObject* currObj1 = obj1; currObj1; currObj1 = currObj1->hoverAncestor()) - for (RenderObject* currObj2 = obj2; currObj2; currObj2 = currObj2->hoverAncestor()) - if (currObj1 == currObj2) - return currObj1; - - return 0; -} - -void RenderLayer::updateHoverActiveState(const HitTestRequest& request, HitTestResult& result) -{ - // We don't update :hover/:active state when the result is marked as readOnly. - if (request.readOnly()) - return; - - Document* doc = renderer()->document(); - - Node* activeNode = doc->activeNode(); - if (activeNode && !request.active()) { - // We are clearing the :active chain because the mouse has been released. - for (RenderObject* curr = activeNode->renderer(); curr; curr = curr->parent()) { - if (curr->node() && !curr->isText()) { - curr->node()->setActive(false); - curr->node()->clearInActiveChain(); - } - } - doc->setActiveNode(0); - } else { - Node* newActiveNode = result.innerNode(); - if (!activeNode && newActiveNode && request.active() && !request.touchMove()) { - // We are setting the :active chain and freezing it. If future moves happen, they - // will need to reference this chain. - for (RenderObject* curr = newActiveNode->renderer(); curr; curr = curr->parent()) { - if (curr->node() && !curr->isText()) - curr->node()->setInActiveChain(); - } - doc->setActiveNode(newActiveNode); - } - } - // If the mouse has just been pressed, set :active on the chain. Those (and only those) - // nodes should remain :active until the mouse is released. - bool allowActiveChanges = !activeNode && doc->activeNode(); - - // If the mouse is down and if this is a mouse move event, we want to restrict changes in - // :hover/:active to only apply to elements that are in the :active chain that we froze - // at the time the mouse went down. - bool mustBeInActiveChain = request.active() && request.move(); - - RefPtr<Node> oldHoverNode = doc->hoverNode(); - // Clear the :hover chain when the touch gesture is over. - if (request.touchRelease()) { - if (oldHoverNode) { - for (RenderObject* curr = oldHoverNode->renderer(); curr; curr = curr->parent()) { - if (curr->node() && !curr->isText()) - curr->node()->setHovered(false); - } - doc->setHoverNode(0); - } - // A touch release can not set new hover or active target. - return; - } - - // Check to see if the hovered node has changed. - // If it hasn't, we do not need to do anything. - Node* newHoverNode = result.innerNode(); - if (newHoverNode && !newHoverNode->renderer()) - newHoverNode = result.innerNonSharedNode(); - - // Update our current hover node. - doc->setHoverNode(newHoverNode); - - // We have two different objects. Fetch their renderers. - RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; - RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; - - // Locate the common ancestor render object for the two renderers. - RenderObject* ancestor = commonAncestor(oldHoverObj, newHoverObj); - - Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; - Vector<RefPtr<Node>, 32> nodesToAddToChain; - - if (oldHoverObj != newHoverObj) { - // The old hover path only needs to be cleared up to (and not including) the common ancestor; - for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { - if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain())) - nodesToRemoveFromChain.append(curr->node()); - } - } - - // Now set the hover state for our new object up to the root. - for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { - if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain())) - nodesToAddToChain.append(curr->node()); - } - - size_t removeCount = nodesToRemoveFromChain.size(); - for (size_t i = 0; i < removeCount; ++i) { - nodesToRemoveFromChain[i]->setHovered(false); - } - - size_t addCount = nodesToAddToChain.size(); - for (size_t i = 0; i < addCount; ++i) { - if (allowActiveChanges) - nodesToAddToChain[i]->setActive(true); - nodesToAddToChain[i]->setHovered(true); - } -} - // Helper for the sorting of layers by z-index. static inline bool compareZIndex(RenderLayer* first, RenderLayer* second) { @@ -4801,7 +4686,7 @@ void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) // Since we're only painting non-composited layers, we know that they all share the same repaintContainer. void RenderLayer::repaintIncludingNonCompositingDescendants(RenderBoxModelObject* repaintContainer) { - renderer()->repaintUsingContainer(repaintContainer, renderer()->clippedOverflowRectForRepaint(repaintContainer)); + renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(renderer()->clippedOverflowRectForRepaint(repaintContainer))); for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) { if (!curr->isComposited()) diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 7c0953af4..8e026833d 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -130,6 +130,7 @@ inline ClipRect intersection(const ClipRect& a, const ClipRect& b) } class ClipRects { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<ClipRects> create() { @@ -227,6 +228,8 @@ enum ClipRectsType { }; struct ClipRectsCache { + WTF_MAKE_FAST_ALLOCATED; +public: ClipRectsCache() { #ifndef NDEBUG @@ -563,8 +566,6 @@ public: typedef unsigned CalculateLayerBoundsFlags; static IntRect calculateLayerBounds(const RenderLayer*, const RenderLayer* ancestorLayer, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags); - void updateHoverActiveState(const HitTestRequest&, HitTestResult&); - // WARNING: This method returns the offset for the parent as this is what updateLayerPositions expects. LayoutPoint computeOffsetFromRoot(bool& hasLayerOffset) const; diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index 26cd50f50..459e95148 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -200,10 +200,10 @@ void RenderLayerBacking::createPrimaryGraphicsLayer() } #endif - updateLayerOpacity(renderer()->style()); - updateLayerTransform(renderer()->style()); + updateOpacity(renderer()->style()); + updateTransform(renderer()->style()); #if ENABLE(CSS_FILTERS) - updateLayerFilters(renderer()->style()); + updateFilters(renderer()->style()); #endif #if ENABLE(CSS_COMPOSITING) updateLayerBlendMode(renderer()->style()); @@ -224,12 +224,12 @@ void RenderLayerBacking::destroyGraphicsLayers() m_scrollingContentsLayer = nullptr; } -void RenderLayerBacking::updateLayerOpacity(const RenderStyle* style) +void RenderLayerBacking::updateOpacity(const RenderStyle* style) { m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); } -void RenderLayerBacking::updateLayerTransform(const RenderStyle* style) +void RenderLayerBacking::updateTransform(const RenderStyle* style) { // FIXME: This could use m_owningLayer->transform(), but that currently has transform-origin // baked into it, and we don't want that. @@ -243,7 +243,7 @@ void RenderLayerBacking::updateLayerTransform(const RenderStyle* style) } #if ENABLE(CSS_FILTERS) -void RenderLayerBacking::updateLayerFilters(const RenderStyle* style) +void RenderLayerBacking::updateFilters(const RenderStyle* style) { m_canCompositeFilters = m_graphicsLayer->setFilters(style->filter()); } @@ -465,14 +465,14 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() // Set transform property, if it is not animating. We have to do this here because the transform // is affected by the layer dimensions. if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitTransform)) - updateLayerTransform(renderer()->style()); + updateTransform(renderer()->style()); // Set opacity, if it is not animating. if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity)) - updateLayerOpacity(renderer()->style()); + updateOpacity(renderer()->style()); #if ENABLE(CSS_FILTERS) - updateLayerFilters(renderer()->style()); + updateFilters(renderer()->style()); #endif #if ENABLE(CSS_COMPOSITING) @@ -1610,7 +1610,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here. if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) { // To ensure that the correct opacity is visible when the animation ends, also set the final opacity. - updateLayerOpacity(toStyle); + updateOpacity(toStyle); didAnimateOpacity = true; } } @@ -1624,7 +1624,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper transformVector.insert(new TransformAnimationValue(1, &toStyle->transform())); if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) { // To ensure that the correct transform is visible when the animation ends, also set the final transform. - updateLayerTransform(toStyle); + updateTransform(toStyle); didAnimateTransform = true; } } @@ -1639,7 +1639,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper filterVector.insert(new FilterAnimationValue(1, &toStyle->filter())); if (m_graphicsLayer->addAnimation(filterVector, IntSize(), filterAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), timeOffset)) { // To ensure that the correct filter is visible when the animation ends, also set the final filter. - updateLayerFilters(toStyle); + updateFilters(toStyle); didAnimateFilter = true; } } diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index 0508b52bb..78232709f 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -201,10 +201,10 @@ private: // Result is perspective origin in pixels. FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const; - void updateLayerOpacity(const RenderStyle*); - void updateLayerTransform(const RenderStyle*); + void updateOpacity(const RenderStyle*); + void updateTransform(const RenderStyle*); #if ENABLE(CSS_FILTERS) - void updateLayerFilters(const RenderStyle*); + void updateFilters(const RenderStyle*); #endif #if ENABLE(CSS_COMPOSITING) void updateLayerBlendMode(const RenderStyle*); diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index 46a97a57f..2a7cdd071 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -55,6 +55,7 @@ enum CompositingUpdateType { // There is one RenderLayerCompositor per RenderView. class RenderLayerCompositor : public GraphicsLayerClient { + WTF_MAKE_FAST_ALLOCATED; public: RenderLayerCompositor(RenderView*); ~RenderLayerCompositor(); diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.cpp b/Source/WebCore/rendering/RenderNamedFlowThread.cpp index 4e83cca9e..264aeb497 100644 --- a/Source/WebCore/rendering/RenderNamedFlowThread.cpp +++ b/Source/WebCore/rendering/RenderNamedFlowThread.cpp @@ -27,8 +27,14 @@ #include "RenderNamedFlowThread.h" #include "FlowThreadController.h" +#include "InlineTextBox.h" +#include "InspectorInstrumentation.h" +#include "Position.h" +#include "RenderInline.h" #include "RenderRegion.h" +#include "RenderText.h" #include "RenderView.h" +#include "Text.h" #include "WebKitNamedFlow.h" namespace WebCore { @@ -357,6 +363,7 @@ const AtomicString& RenderNamedFlowThread::flowThreadName() const void RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent() { RenderFlowThread::dispatchRegionLayoutUpdateEvent(); + InspectorInstrumentation::didUpdateRegionLayout(document(), m_namedFlow.get()); if (!m_regionLayoutUpdateEventTimer.isActive() && m_namedFlow->hasEventListeners()) m_regionLayoutUpdateEventTimer.startOneShot(0); @@ -393,4 +400,173 @@ bool RenderNamedFlowThread::isMarkedForDestruction() const return m_namedFlow->flowState() == WebKitNamedFlow::FlowStateNull; } +static bool isContainedInNodes(Vector<Node*> others, Node* node) +{ + for (size_t i = 0; i < others.size(); i++) { + Node* other = others.at(i); + if (other->contains(node)) + return true; + } + return false; +} + +static bool boxIntersectsRegion(LayoutUnit logicalTopForBox, LayoutUnit logicalBottomForBox, LayoutUnit logicalTopForRegion, LayoutUnit logicalBottomForRegion) +{ + bool regionIsEmpty = logicalBottomForRegion != MAX_LAYOUT_UNIT && logicalTopForRegion != MIN_LAYOUT_UNIT + && (logicalBottomForRegion - logicalTopForRegion) <= 0; + return (logicalBottomForBox - logicalTopForBox) > 0 + && !regionIsEmpty + && logicalTopForBox < logicalBottomForRegion && logicalTopForRegion < logicalBottomForBox; +} + +void RenderNamedFlowThread::getRanges(Vector<RefPtr<Range> >& rangeObjects, const RenderRegion* region) const +{ + LayoutUnit logicalTopForRegion; + LayoutUnit logicalBottomForRegion; + + // extend the first region top to contain everything up to its logical height + if (region->isFirstRegion()) + logicalTopForRegion = MIN_LAYOUT_UNIT; + else + logicalTopForRegion = region->logicalTopForFlowThreadContent(); + + // extend the last region to contain everything above its y() + if (region->isLastRegion()) + logicalBottomForRegion = MAX_LAYOUT_UNIT; + else + logicalBottomForRegion = region->logicalBottomForFlowThreadContent(); + + Vector<Node*> nodes; + // eliminate the contentNodes that are descendants of other contentNodes + for (NamedFlowContentNodes::const_iterator it = contentNodes().begin(); it != contentNodes().end(); ++it) { + Node* node = *it; + if (!isContainedInNodes(nodes, node)) + nodes.append(node); + } + + for (size_t i = 0; i < nodes.size(); i++) { + Node* contentNode = nodes.at(i); + if (!contentNode->renderer()) + continue; + + ExceptionCode ignoredException; + RefPtr<Range> range = Range::create(contentNode->document()); + bool foundStartPosition = false; + bool startsAboveRegion = true; + bool endsBelowRegion = true; + bool skipOverOutsideNodes = false; + Node* lastEndNode = 0; + + for (Node* node = contentNode; node; node = node->traverseNextNode(contentNode)) { + RenderObject* renderer = node->renderer(); + if (!renderer) + continue; + + LayoutRect boundingBox; + if (renderer->isRenderInline()) + boundingBox = toRenderInline(renderer)->linesBoundingBox(); + else if (renderer->isText()) + boundingBox = toRenderText(renderer)->linesBoundingBox(); + else { + boundingBox = toRenderBox(renderer)->frameRect(); + if (toRenderBox(renderer)->isRelPositioned()) + boundingBox.move(toRenderBox(renderer)->relativePositionLogicalOffset()); + } + + LayoutUnit offsetTop = renderer->containingBlock()->offsetFromLogicalTopOfFirstPage(); + const LayoutPoint logicalOffsetFromTop(isHorizontalWritingMode() ? ZERO_LAYOUT_UNIT : offsetTop, + isHorizontalWritingMode() ? offsetTop : ZERO_LAYOUT_UNIT); + + boundingBox.moveBy(logicalOffsetFromTop); + + LayoutUnit logicalTopForRenderer = region->logicalTopOfFlowThreadContentRect(boundingBox); + LayoutUnit logicalBottomForRenderer = region->logicalBottomOfFlowThreadContentRect(boundingBox); + + // if the bounding box of the current element doesn't intersect the region box + // close the current range only if the start element began inside the region, + // otherwise just move the start position after this node and keep skipping them until we found a proper start position. + if (!boxIntersectsRegion(logicalTopForRenderer, logicalBottomForRenderer, logicalTopForRegion, logicalBottomForRegion)) { + if (foundStartPosition) { + if (!startsAboveRegion) { + if (range->intersectsNode(node, ignoredException)) + range->setEndBefore(node, ignoredException); + rangeObjects.append(range->cloneRange(ignoredException)); + range = Range::create(contentNode->document()); + startsAboveRegion = true; + } else + skipOverOutsideNodes = true; + } + if (skipOverOutsideNodes) + range->setStartAfter(node, ignoredException); + foundStartPosition = false; + continue; + } + + // start position + if (logicalTopForRenderer < logicalTopForRegion && startsAboveRegion) { + if (renderer->isText()) { // Text crosses region top + // for Text elements, just find the last textbox that is contained inside the region and use its start() offset as start position + RenderText* textRenderer = toRenderText(renderer); + for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) { + if (offsetTop + box->logicalBottom() < logicalTopForRegion) + continue; + range->setStart(Position(toText(node), box->start())); + startsAboveRegion = false; + break; + } + } else { // node crosses region top + // for all elements, except Text, just set the start position to be before their children + startsAboveRegion = true; + range->setStart(Position(node, Position::PositionIsBeforeChildren)); + } + } else { // node starts inside region + // for elements that start inside the region, set the start position to be before them. If we found one, we will just skip the others until + // the range is closed. + if (startsAboveRegion) { + startsAboveRegion = false; + range->setStartBefore(node, ignoredException); + } + } + skipOverOutsideNodes = false; + foundStartPosition = true; + + // end position + if (logicalBottomForRegion < logicalBottomForRenderer && (endsBelowRegion || (!endsBelowRegion && !node->isDescendantOf(lastEndNode)))) { + // for Text elements, just find just find the last textbox that is contained inside the region and use its start()+len() offset as end position + if (renderer->isText()) { // Text crosses region bottom + RenderText* textRenderer = toRenderText(renderer); + InlineTextBox* lastBox = 0; + for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) { + if ((offsetTop + box->logicalTop()) < logicalBottomForRegion) { + lastBox = box; + continue; + } + ASSERT(lastBox); + if (lastBox) + range->setEnd(Position(toText(node), lastBox->start() + lastBox->len())); + break; + } + endsBelowRegion = false; + lastEndNode = node; + } else { // node crosses region bottom + // for all elements, except Text, just set the start position to be after their children + range->setEnd(Position(node, Position::PositionIsAfterChildren)); + endsBelowRegion = true; + lastEndNode = node; + } + } else { // node ends inside region + // for elements that ends inside the region, set the end position to be after them + // allow this end position to be changed only by other elements that are not descendants of the current end node + if (endsBelowRegion || (!endsBelowRegion && !node->isDescendantOf(lastEndNode))) { + range->setEndAfter(node, ignoredException); + endsBelowRegion = false; + lastEndNode = node; + } + } + } + if (foundStartPosition || skipOverOutsideNodes) + rangeObjects.append(range); + } +} + } diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.h b/Source/WebCore/rendering/RenderNamedFlowThread.h index a8b8b5131..3199307cf 100644 --- a/Source/WebCore/rendering/RenderNamedFlowThread.h +++ b/Source/WebCore/rendering/RenderNamedFlowThread.h @@ -70,6 +70,7 @@ public: const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; } bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); } bool isMarkedForDestruction() const; + void getRanges(Vector<RefPtr<Range> >&, const RenderRegion*) const; protected: void setMarkForDestruction(); diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 8bfd9f74d..214970a35 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -1277,7 +1277,7 @@ RenderBoxModelObject* RenderObject::containerForRepaint() const return repaintContainer; } -void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect& r, bool immediate) const +void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate) const { if (!repaintContainer) { view()->repaintViewRectangle(r, immediate); @@ -1304,7 +1304,7 @@ void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, if (!viewHasCompositedLayer || v->layer()->backing()->paintsIntoWindow()) { LayoutRect repaintRectangle = r; if (viewHasCompositedLayer && v->layer()->transform()) - repaintRectangle = v->layer()->transform()->mapRect(r); + repaintRectangle = enclosingIntRect(v->layer()->transform()->mapRect(r)); v->repaintViewRectangle(repaintRectangle, immediate); return; } @@ -1331,7 +1331,7 @@ void RenderObject::repaint(bool immediate) const return; // Don't repaint if we're printing. RenderBoxModelObject* repaintContainer = containerForRepaint(); - repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOverflowRectForRepaint(repaintContainer), immediate); + repaintUsingContainer(repaintContainer ? repaintContainer : view, pixelSnappedIntRect(clippedOverflowRectForRepaint(repaintContainer)), immediate); } void RenderObject::repaintRectangle(const LayoutRect& r, bool immediate) const @@ -1352,7 +1352,7 @@ void RenderObject::repaintRectangle(const LayoutRect& r, bool immediate) const RenderBoxModelObject* repaintContainer = containerForRepaint(); computeRectForRepaint(repaintContainer, dirtyRect); - repaintUsingContainer(repaintContainer ? repaintContainer : view, dirtyRect, immediate); + repaintUsingContainer(repaintContainer ? repaintContainer : view, pixelSnappedIntRect(dirtyRect), immediate); } IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const @@ -1387,9 +1387,9 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta repaintContainer = v; if (fullRepaint) { - repaintUsingContainer(repaintContainer, oldBounds); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds)); if (newBounds != oldBounds) - repaintUsingContainer(repaintContainer, newBounds); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds)); return true; } @@ -1398,27 +1398,27 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta LayoutUnit deltaLeft = newBounds.x() - oldBounds.x(); if (deltaLeft > 0) - repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height())); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height())); else if (deltaLeft < 0) - repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height())); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height())); LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); if (deltaRight > 0) - repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height())); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height())); else if (deltaRight < 0) - repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height())); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height())); LayoutUnit deltaTop = newBounds.y() - oldBounds.y(); if (deltaTop > 0) - repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop)); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop)); else if (deltaTop < 0) - repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop)); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop)); LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); if (deltaBottom > 0) - repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom)); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom)); else if (deltaBottom < 0) - repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom)); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom)); if (newOutlineBox == oldOutlineBox) return false; @@ -1443,7 +1443,7 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); if (rightRect.x() < right) { rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); - repaintUsingContainer(repaintContainer, rightRect); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRect)); } } LayoutUnit height = absoluteValue(newOutlineBox.height() - oldOutlineBox.height()); @@ -1462,7 +1462,7 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); if (bottomRect.y() < bottom) { bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y())); - repaintUsingContainer(repaintContainer, bottomRect); + repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRect)); } } return false; @@ -1507,16 +1507,8 @@ void RenderObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, } if (o->hasOverflowClip()) { - // o->height() is inaccurate if we're in the middle of a layout of |o|, so use the - // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint - // anyway if its size does change. RenderBox* boxParent = toRenderBox(o); - - LayoutRect repaintRect(rect); - repaintRect.move(-boxParent->scrolledContentOffset()); // For overflow:auto/scroll/hidden. - - LayoutRect boxRect(LayoutPoint(), boxParent->cachedSizeForOverflowClip()); - rect = intersection(repaintRect, boxRect); + boxParent->applyCachedClipAndScrollOffsetForRepaint(rect); if (rect.isEmpty()) return; } diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index b6aa16e19..3f3849f62 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -756,7 +756,7 @@ public: RenderBoxModelObject* containerForRepaint() const; // Actually do the repaint of rect r for this object which has been computed in the coordinate space // of repaintContainer. If repaintContainer is 0, repaint via the view. - void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect&, bool immediate = false) const; + void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect&, bool immediate = false) const; // Repaint the entire object. Called when, e.g., the color of a border changes, or when a border // style changes. diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index d895cd039..2b7e4252a 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -35,6 +35,7 @@ #include "HitTestResult.h" #include "IntRect.h" #include "PaintInfo.h" +#include "Range.h" #include "RenderBoxRegionInfo.h" #include "RenderNamedFlowThread.h" #include "RenderView.h" @@ -328,13 +329,18 @@ void RenderRegion::deleteAllRenderBoxRegionInfo() m_renderBoxRegionInfo.clear(); } -LayoutUnit RenderRegion::offsetFromLogicalTopOfFirstPage() const +LayoutUnit RenderRegion::logicalTopOfFlowThreadContentRect(const LayoutRect& rect) const { - if (!m_isValid || !m_flowThread) - return 0; - if (m_flowThread->isHorizontalWritingMode()) - return flowThreadPortionRect().y(); - return flowThreadPortionRect().x(); + if (!m_isValid || !flowThread()) + return ZERO_LAYOUT_UNIT; + return flowThread()->isHorizontalWritingMode() ? rect.y() : rect.x(); +} + +LayoutUnit RenderRegion::logicalBottomOfFlowThreadContentRect(const LayoutRect& rect) const +{ + if (!m_isValid || !flowThread()) + return ZERO_LAYOUT_UNIT; + return flowThread()->isHorizontalWritingMode() ? rect.maxY() : rect.maxX(); } void RenderRegion::setRegionObjectsRegionStyle() @@ -536,4 +542,10 @@ LayoutUnit RenderRegion::maxPreferredLogicalWidth() const return maxPreferredLogicalWidth + borderAndPaddingLogicalWidth(); } +void RenderRegion::getRanges(Vector<RefPtr<Range> >& rangeObjects) const +{ + RenderNamedFlowThread* namedFlow = view()->flowThreadController()->ensureRenderFlowThreadWithName(style()->regionThread()); + namedFlow->getRanges(rangeObjects, this); +} + } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderRegion.h b/Source/WebCore/rendering/RenderRegion.h index ee04ecc6d..3d9d5a8a2 100644 --- a/Source/WebCore/rendering/RenderRegion.h +++ b/Source/WebCore/rendering/RenderRegion.h @@ -78,8 +78,6 @@ public: void deleteAllRenderBoxRegionInfo(); - LayoutUnit offsetFromLogicalTopOfFirstPage() const; - bool isFirstRegion() const; bool isLastRegion() const; @@ -104,6 +102,13 @@ public: virtual LayoutUnit minPreferredLogicalWidth() const OVERRIDE; virtual LayoutUnit maxPreferredLogicalWidth() const OVERRIDE; + LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const; + LayoutUnit logicalBottomOfFlowThreadContentRect(const LayoutRect&) const; + LayoutUnit logicalTopForFlowThreadContent() const { return logicalTopOfFlowThreadContentRect(flowThreadPortionRect()); }; + LayoutUnit logicalBottomForFlowThreadContent() const { return logicalBottomOfFlowThreadContentRect(flowThreadPortionRect()); }; + + void getRanges(Vector<RefPtr<Range> >&) const; + // This method represents the logical height of the entire flow thread portion used by the region or set. // For RenderRegions it matches logicalPaginationHeight(), but for sets it is the height of all the pages // or columns added together. diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp index f765c38c4..1ebb1526e 100644 --- a/Source/WebCore/rendering/RenderReplaced.cpp +++ b/Source/WebCore/rendering/RenderReplaced.cpp @@ -437,12 +437,26 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHeight()); } +LayoutUnit RenderReplaced::computeMaxPreferredLogicalWidth() const +{ + Length logicalWidth = style()->logicalWidth(); + + // We cannot resolve any percent logical width here as the available logical + // width may not be set on our containing block. + if (logicalWidth.isPercent()) + return intrinsicLogicalWidth(); + + // FIXME: We shouldn't be calling a logical width computing function in preferred + // logical widths computation as the layout information is probably invalid. + return computeReplacedLogicalWidth(false); +} + void RenderReplaced::computePreferredLogicalWidths() { ASSERT(preferredLogicalWidthsDirty()); - LayoutUnit borderAndPadding = borderAndPaddingWidth(); - m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding; + LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); + m_maxPreferredLogicalWidth = computeMaxPreferredLogicalWidth() + borderAndPadding; if (style()->maxWidth().isFixed()) m_maxPreferredLogicalWidth = min<LayoutUnit>(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : ZERO_LAYOUT_UNIT)); diff --git a/Source/WebCore/rendering/RenderReplaced.h b/Source/WebCore/rendering/RenderReplaced.h index 9d7814394..7826ceba3 100644 --- a/Source/WebCore/rendering/RenderReplaced.h +++ b/Source/WebCore/rendering/RenderReplaced.h @@ -67,6 +67,7 @@ private: virtual bool canHaveChildren() const { return false; } + LayoutUnit computeMaxPreferredLogicalWidth() const; virtual void computePreferredLogicalWidths(); virtual void paintReplaced(PaintInfo&, const LayoutPoint&) { } diff --git a/Source/WebCore/rendering/RenderSelectionInfo.h b/Source/WebCore/rendering/RenderSelectionInfo.h index 8936a377e..a513372df 100644 --- a/Source/WebCore/rendering/RenderSelectionInfo.h +++ b/Source/WebCore/rendering/RenderSelectionInfo.h @@ -68,7 +68,7 @@ public: void repaint() { - m_object->repaintUsingContainer(m_repaintContainer, m_rect); + m_object->repaintUsingContainer(m_repaintContainer, enclosingIntRect(m_rect)); } LayoutRect rect() const { return m_rect; } @@ -89,7 +89,7 @@ public: void repaint() { - m_object->repaintUsingContainer(m_repaintContainer, m_rects); + m_object->repaintUsingContainer(m_repaintContainer, enclosingIntRect(m_rects)); } RenderBlock* block() const { return toRenderBlock(m_object); } diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index 66c37ec35..e4259c4f7 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -693,6 +693,9 @@ void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) { #if USE(NEW_THEME) m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForRenderer(o), r, o->style()->effectiveZoom()); +#else + UNUSED_PARAM(o); + UNUSED_PARAM(r); #endif } diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp index 276366c0b..ef650aded 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.cpp +++ b/Source/WebCore/rendering/RenderTreeAsText.cpp @@ -79,21 +79,6 @@ using namespace HTMLNames; static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const LayoutRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal); -static inline bool hasFractions(double val) -{ - static const double s_epsilon = 0.0001; - int ival = static_cast<int>(val); - double dval = static_cast<double>(ival); - return fabs(val - dval) > s_epsilon; -} - -String formatNumberRespectingIntegers(double value) -{ - if (!hasFractions(value)) - return String::number(static_cast<int>(value)); - return String::number(value, ShouldRoundDecimalPlaces, 2); -} - TextStream& operator<<(TextStream& ts, const IntRect& r) { return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height(); @@ -112,16 +97,16 @@ TextStream& operator<<(TextStream& ts, const FractionalLayoutPoint& p) TextStream& operator<<(TextStream& ts, const FloatPoint& p) { - ts << "(" << formatNumberRespectingIntegers(p.x()); - ts << "," << formatNumberRespectingIntegers(p.y()); + ts << "(" << TextStream::FormatNumberRespectingIntegers(p.x()); + ts << "," << TextStream::FormatNumberRespectingIntegers(p.y()); ts << ")"; return ts; } TextStream& operator<<(TextStream& ts, const FloatSize& s) { - ts << "width=" << formatNumberRespectingIntegers(s.width()); - ts << " height=" << formatNumberRespectingIntegers(s.height()); + ts << "width=" << TextStream::FormatNumberRespectingIntegers(s.width()); + ts << " height=" << TextStream::FormatNumberRespectingIntegers(s.height()); return ts; } diff --git a/Source/WebCore/rendering/RenderTreeAsText.h b/Source/WebCore/rendering/RenderTreeAsText.h index 849943068..53f348772 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.h +++ b/Source/WebCore/rendering/RenderTreeAsText.h @@ -28,7 +28,6 @@ #include "TextStream.h" #include <wtf/Forward.h> -#include <wtf/MathExtras.h> namespace WebCore { @@ -98,8 +97,6 @@ String counterValueForElement(Element*); String markerTextForListItem(Element*); -String formatNumberRespectingIntegers(double); - } // namespace WebCore #endif // RenderTreeAsText_h diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index 141ea52b6..25625edaa 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -87,7 +87,17 @@ RenderView::~RenderView() bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result) { - return layer()->hitTest(request, result); + return hitTest(request, result.hitTestLocation(), result); +} + +bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& location, HitTestResult& result) +{ + bool inside = layer()->hitTest(request, location, result); + + // Next set up the correct :hover/:active state along the new chain. + document()->updateHoverActiveState(request, result); + + return inside; } void RenderView::updateLogicalHeight() diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index e6d832b97..620f25693 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -48,6 +48,7 @@ public: virtual ~RenderView(); bool hitTest(const HitTestRequest&, HitTestResult&); + bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); virtual const char* renderName() const OVERRIDE { return "RenderView"; } diff --git a/Source/WebCore/rendering/TextAutosizer.cpp b/Source/WebCore/rendering/TextAutosizer.cpp index 4cd735a1c..598bbd7df 100644 --- a/Source/WebCore/rendering/TextAutosizer.cpp +++ b/Source/WebCore/rendering/TextAutosizer.cpp @@ -77,8 +77,26 @@ bool TextAutosizer::processSubtree(RenderObject* layoutRoot) return true; } +static bool contentHeightIsConstrained(const RenderBox* box) +{ + // FIXME: Propagate constrainedness down the tree, to avoid inefficiently walking back up from each box. + // FIXME: This code needs to take into account vertical writing modes. + // FIXME: Consider additional heuristics, such as ignoring fixed heights if the content is already overflowing before autosizing kicks in. + for (const RenderBox* container = box; container; container = container->containingBlock()) { + RenderStyle* style = container->style(); + if (style->overflowY() >= OSCROLL) + return false; + if (style->height().isSpecified() || style->maxHeight().isSpecified()) + return true; + } + return false; +} + void TextAutosizer::processBox(RenderBox* box, const IntSize& windowSize, const IntSize& layoutSize) { + if (contentHeightIsConstrained(box)) + return; + int logicalWindowWidth = box->isHorizontalWritingMode() ? windowSize.width() : windowSize.height(); int logicalLayoutWidth = box->isHorizontalWritingMode() ? layoutSize.width() : layoutSize.height(); // Ignore box width in excess of the layout width, to avoid extreme multipliers. diff --git a/Source/WebCore/rendering/WrapShapeInfo.h b/Source/WebCore/rendering/WrapShapeInfo.h index f996b6419..080b842a8 100644 --- a/Source/WebCore/rendering/WrapShapeInfo.h +++ b/Source/WebCore/rendering/WrapShapeInfo.h @@ -52,6 +52,7 @@ struct LineSegment { typedef Vector<LineSegment> SegmentList; class WrapShapeInfo { + WTF_MAKE_FAST_ALLOCATED; public: enum LineState { LINE_BEFORE_SHAPE, diff --git a/Source/WebCore/rendering/style/NinePieceImage.h b/Source/WebCore/rendering/style/NinePieceImage.h index 8f7ed8760..a44eed6a0 100644 --- a/Source/WebCore/rendering/style/NinePieceImage.h +++ b/Source/WebCore/rendering/style/NinePieceImage.h @@ -35,6 +35,7 @@ enum ENinePieceImageRule { }; class NinePieceImageData { + WTF_MAKE_FAST_ALLOCATED; public: NinePieceImageData() : m_image(0) diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index c50785295..7a117444d 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -110,7 +110,6 @@ class CursorList; class Font; class FontMetrics; class IntRect; -class MemoryObjectInfo; class Pair; class ShadowData; class StyleImage; @@ -953,19 +952,16 @@ public: #if ENABLE(TOUCH_EVENTS) Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; } #endif -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) bool useTouchOverflowScrolling() const { return rareInheritedData->useTouchOverflowScrolling; } #endif bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; } ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); } WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); } - // Lines have horizontal orientation; modes horizontal-tb or horizontal-bt. - bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; } - // Bottom of the line occurs earlier in the block; modes vertical-rl or horizontal-bt. - bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; } - // Block progression increases in the opposite direction to normal; modes vertical-rl or horizontal-bt. - bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; } + bool isHorizontalWritingMode() const { return WebCore::isHorizontalWritingMode(writingMode()); } + bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); } + bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedBlocksWritingMode(writingMode()); } #if ENABLE(CSS_IMAGE_ORIENTATION) ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); } @@ -1405,7 +1401,7 @@ public: #if ENABLE(TOUCH_EVENTS) void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); } #endif -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) void setUseTouchOverflowScrolling(bool v) { SET_VAR(rareInheritedData, useTouchOverflowScrolling, v); } #endif bool setTextSizeAdjust(bool); @@ -1727,7 +1723,7 @@ public: #if ENABLE(TOUCH_EVENTS) static Color initialTapHighlightColor(); #endif -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) static bool initialUseTouchOverflowScrolling() { return false; } #endif #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp index ea666d589..17330d935 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -88,7 +88,7 @@ StyleRareInheritedData::StyleRareInheritedData() , m_imageRendering(RenderStyle::initialImageRendering()) , m_lineSnap(RenderStyle::initialLineSnap()) , m_lineAlign(RenderStyle::initialLineAlign()) -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) , useTouchOverflowScrolling(RenderStyle::initialUseTouchOverflowScrolling()) #endif #if ENABLE(CSS_IMAGE_RESOLUTION) @@ -150,7 +150,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) , m_imageRendering(o.m_imageRendering) , m_lineSnap(o.m_lineSnap) , m_lineAlign(o.m_lineAlign) -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) , useTouchOverflowScrolling(o.useTouchOverflowScrolling) #endif #if ENABLE(CSS_IMAGE_RESOLUTION) @@ -215,7 +215,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const && overflowWrap == o.overflowWrap && nbspMode == o.nbspMode && khtmlLineBreak == o.khtmlLineBreak -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) && useTouchOverflowScrolling == o.useTouchOverflowScrolling #endif && textSizeAdjust == o.textSizeAdjust diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h index 60b4ff6d9..27d5c9ace 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h @@ -39,7 +39,6 @@ namespace WebCore { class CursorList; -class MemoryObjectInfo; class QuotesData; class ShadowData; @@ -104,7 +103,7 @@ public: unsigned m_imageRendering : 2; // EImageRendering unsigned m_lineSnap : 2; // LineSnap unsigned m_lineAlign : 1; // LineAlign -#if ENABLE(OVERFLOW_SCROLLING) +#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) unsigned useTouchOverflowScrolling: 1; #endif #if ENABLE(CSS_IMAGE_RESOLUTION) diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h index 251ffa319..bb67a3e62 100644 --- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -39,7 +39,6 @@ namespace WebCore { class AnimationList; -class MemoryObjectInfo; class ShadowData; class StyleDeprecatedFlexibleBoxData; #if ENABLE(CSS_FILTERS) diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h index 93bb6b367..22537b125 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h @@ -40,6 +40,8 @@ namespace WebCore { struct FilterData { + WTF_MAKE_FAST_ALLOCATED; +public: FilterData() : savedContext(0) , builded(false) diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h index d30a6b345..d799f756d 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h @@ -35,6 +35,8 @@ namespace WebCore { struct GradientData { + WTF_MAKE_FAST_ALLOCATED; +public: RefPtr<Gradient> gradient; AffineTransform userspaceTransform; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h index 70cbf0f01..9e39383bd 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h @@ -37,6 +37,8 @@ namespace WebCore { struct PatternData { + WTF_MAKE_FAST_ALLOCATED; +public: RefPtr<Pattern> pattern; AffineTransform transform; }; diff --git a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp index e3fd833a2..838d8a150 100755 --- a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp @@ -134,10 +134,10 @@ static void writeIfNotDefault(TextStream& ts, const char* name, ValueType value, TextStream& operator<<(TextStream& ts, const FloatRect& r) { - ts << "at (" << formatNumberRespectingIntegers(r.x()); - ts << "," << formatNumberRespectingIntegers(r.y()); - ts << ") size " << formatNumberRespectingIntegers(r.width()); - ts << "x" << formatNumberRespectingIntegers(r.height()); + ts << "at (" << TextStream::FormatNumberRespectingIntegers(r.x()); + ts << "," << TextStream::FormatNumberRespectingIntegers(r.y()); + ts << ") size " << TextStream::FormatNumberRespectingIntegers(r.width()); + ts << "x" << TextStream::FormatNumberRespectingIntegers(r.height()); return ts; } diff --git a/Source/WebCore/rendering/svg/SVGResources.h b/Source/WebCore/rendering/svg/SVGResources.h index ec43e38e3..0079b7309 100644 --- a/Source/WebCore/rendering/svg/SVGResources.h +++ b/Source/WebCore/rendering/svg/SVGResources.h @@ -113,6 +113,8 @@ private: // masker: 'container elements' and 'graphics elements' // -> a, circle, defs, ellipse, glyph, g, image, line, marker, mask, missing-glyph, path, pattern, polygon, polyline, rect, svg, switch, symbol, text, use struct ClipperFilterMaskerData { + WTF_MAKE_FAST_ALLOCATED; + public: ClipperFilterMaskerData() : clipper(0) #if ENABLE(FILTERS) @@ -137,6 +139,8 @@ private: // From SVG 1.1 2nd Edition // marker: line, path, polygon, polyline struct MarkerData { + WTF_MAKE_FAST_ALLOCATED; + public: MarkerData() : markerStart(0) , markerMid(0) @@ -159,6 +163,8 @@ private: // stroke: 'shapes' and 'text content elements' // -> altGlyph, circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tref, tspan struct FillStrokeData { + WTF_MAKE_FAST_ALLOCATED; + public: FillStrokeData() : fill(0) , stroke(0) |