diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering')
50 files changed, 315 insertions, 878 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp b/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp index f5787226fab..ea8f36eda58 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp @@ -29,8 +29,8 @@ #include "core/rendering/FilterEffectRenderer.h" #include "core/dom/Document.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/page/Page.h" #include "core/platform/FloatConversion.h" #include "core/platform/graphics/ColorSpace.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp b/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp index d09665d7fea..96c55aec951 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp @@ -27,7 +27,6 @@ #include "XLinkNames.h" #include "core/dom/DocumentMarkerController.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" @@ -35,6 +34,7 @@ #include "core/html/HTMLPlugInImageElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" #include "core/platform/Scrollbar.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp b/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp index 58212803b40..393d2cb36dc 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp @@ -29,7 +29,6 @@ #include "core/dom/NodeRenderingTraversal.h" #include "core/dom/shadow/ShadowRoot.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLAreaElement.h" #include "core/html/HTMLImageElement.h" @@ -38,6 +37,7 @@ #include "core/html/HTMLTextAreaElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" #include "core/platform/Scrollbar.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h b/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h index 4e348f22380..5ff00c5db8e 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h +++ b/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h @@ -61,7 +61,7 @@ struct PaintInfo { , renderRegion(region) , outlineObjects(newOutlineObjects) , overlapTestRequests(overlapTestRequests) - , m_paintContainer(newPaintContainer) + , paintContainer(newPaintContainer) { } @@ -101,7 +101,6 @@ struct PaintInfo { } static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); } - const RenderLayerModelObject* paintContainer() const { return m_paintContainer; } // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout rendering/. GraphicsContext* context; @@ -112,10 +111,7 @@ struct PaintInfo { RenderRegion* renderRegion; ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children OverlapTestRequestMap* overlapTestRequests; - -private: - - const RenderLayerModelObject* m_paintContainer; // the layer object that originates the current painting + const RenderLayerModelObject* paintContainer; // the layer object that originates the current painting }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp index e94a24f4835..d40b5f2007f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp @@ -224,20 +224,18 @@ static void removeBlockFromDescendantAndContainerMaps(RenderBlock* block, Tracke RenderBlock::~RenderBlock() { + if (m_floatingObjects) + deleteAllValues(m_floatingObjects->set()); + if (hasColumns()) gColumnInfoMap->take(this); + if (gPercentHeightDescendantsMap) removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendantsMap, gPercentHeightContainerMap); if (gPositionedDescendantsMap) removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMap, gPositionedContainerMap); } -RenderBlock::FloatingObjects::~FloatingObjects() -{ - // FIXME: m_set should use OwnPtr instead. - deleteAllValues(m_set); -} - RenderBlock* RenderBlock::createAnonymous(Document* document) { RenderBlock* renderer = new RenderBlock(0); @@ -970,20 +968,17 @@ static void getInlineRun(RenderObject* start, RenderObject* boundary, } while (!sawInline); } -void RenderBlock::FloatingObjects::clearLineBoxTreePointers() -{ - // Clear references to originating lines, since the lines are being deleted - FloatingObjectSetIterator end = m_set.end(); - for (FloatingObjectSetIterator it = m_set.begin(); it != end; ++it) { - ASSERT(!((*it)->originatingLine()) || (*it)->originatingLine()->renderer() == m_renderer); - (*it)->setOriginatingLine(0); - } -} - void RenderBlock::deleteLineBoxTree() { - if (containsFloats()) - m_floatingObjects->clearLineBoxTreePointers(); + if (containsFloats()) { + // Clear references to originating lines, since the lines are being deleted + const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); + FloatingObjectSetIterator end = floatingObjectSet.end(); + for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { + ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->renderer() == this); + (*it)->m_originatingLine = 0; + } + } m_lineBoxes.deleteLineBoxTree(); if (AXObjectCache* cache = document()->existingAXObjectCache()) @@ -1420,21 +1415,6 @@ void RenderBlock::layout() invalidateBackgroundObscurationStatus(); } -void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*) -{ - RenderBox::imageChanged(image); - - if (!parent()) - return; - - ShapeValue* shapeValue = style()->shapeInside(); - if (shapeValue && shapeValue->image() && shapeValue->image()->data() == image) { - ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo(); - shapeInsideInfo->dirtyShapeSize(); - markShapeInsideDescendantsForLayout(); - } -} - void RenderBlock::updateShapeInsideInfoAfterStyleChange(const ShapeValue* shapeInside, const ShapeValue* oldShapeInside) { // FIXME: A future optimization would do a deep comparison for equality. @@ -1803,7 +1783,7 @@ void RenderBlock::addOverflowFromFloats() for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; if (r->isDescendant()) - addOverflowFromChild(r->renderer(), IntSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); + addOverflowFromChild(r->m_renderer, IntSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); } } @@ -2733,11 +2713,6 @@ bool RenderBlock::simplifiedLayout() if (needsSimplifiedNormalFlowLayout()) simplifiedNormalFlowLayout(); - // Make sure a forced break is applied after the content if we are a flow thread in a simplified layout. - // This ensures the size information is correctly computed for the last auto-height region receiving content. - if (isRenderFlowThread()) - toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom()); - // Lay out our positioned objects if our positioned child bit is set. // Also, if an absolute position element inside a relative positioned container moves, and the absolute element has a fixed position // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the @@ -2902,11 +2877,9 @@ void RenderBlock::repaintOverhangingFloats(bool paintAllDescendants) // Only repaint the object if it is overhanging, is not in its own layer, and // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter // condition is replaced with being a descendant of us. - if (r->logicalBottom(isHorizontalWritingMode()) > logicalHeight() - && !r->renderer()->hasSelfPaintingLayer() - && (r->shouldPaint() || (paintAllDescendants && r->renderer()->isDescendantOf(this)))) { - r->renderer()->repaint(); - r->renderer()->repaintOverhangingFloats(false); + if (logicalBottomForFloat(r) > logicalHeight() && ((paintAllDescendants && r->m_renderer->isDescendantOf(this)) || r->shouldPaint()) && !r->m_renderer->hasSelfPaintingLayer()) { + r->m_renderer->repaint(); + r->m_renderer->repaintOverhangingFloats(false); } } } @@ -3267,21 +3240,20 @@ void RenderBlock::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paintOffs for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; // Only paint the object if our m_shouldPaint flag is set. - if (r->shouldPaint() && !r->renderer()->hasSelfPaintingLayer()) { + if (r->shouldPaint() && !r->m_renderer->hasSelfPaintingLayer()) { PaintInfo currentPaintInfo(paintInfo); currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; - // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner. - LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->renderer()->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->renderer()->y())); - r->renderer()->paint(currentPaintInfo, childPoint); + LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y())); + r->m_renderer->paint(currentPaintInfo, childPoint); if (!preservePhase) { currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); currentPaintInfo.phase = PaintPhaseFloat; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); currentPaintInfo.phase = PaintPhaseForeground; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); currentPaintInfo.phase = PaintPhaseOutline; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); } } } @@ -3495,7 +3467,7 @@ GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& r FloatingObject* r = *it; LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(r), offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(r), - r->renderer()->width(), r->renderer()->height()); + r->m_renderer->width(), r->m_renderer->height()); rootBlock->flipForWritingMode(floatBox); floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y()); paintInfo->context->clipOut(pixelSnappedIntRect(floatBox)); @@ -3934,14 +3906,14 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o) o->computeAndSetBlockDirectionMargins(this); } - newObj->setLogicalWidth(logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o), isHorizontalWritingMode()); + setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o)); if (ShapeOutsideInfo* shapeOutside = o->shapeOutsideInfo()) shapeOutside->setShapeSize(logicalWidthForChild(o), logicalHeightForChild(o)); newObj->setShouldPaint(!o->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will. newObj->setIsDescendant(true); - newObj->setRenderer(o); + newObj->m_renderer = o; m_floatingObjects->add(newObj); @@ -3956,8 +3928,8 @@ void RenderBlock::removeFloatingObject(RenderBox* o) if (it != floatingObjectSet.end()) { FloatingObject* r = *it; if (childrenInline()) { - LayoutUnit logicalTop = r->logicalTop(isHorizontalWritingMode()); - LayoutUnit logicalBottom = r->logicalBottom(isHorizontalWritingMode()); + LayoutUnit logicalTop = logicalTopForFloat(r); + LayoutUnit logicalBottom = logicalBottomForFloat(r); // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTop == LayoutUnit::max()) @@ -3968,19 +3940,19 @@ void RenderBlock::removeFloatingObject(RenderBox* o) // accomplished by pretending they have a height of 1. logicalBottom = max(logicalBottom, logicalTop + 1); } - if (r->originatingLine()) { + if (r->m_originatingLine) { if (!selfNeedsLayout()) { - ASSERT(r->originatingLine()->renderer() == this); - r->originatingLine()->markDirty(); + ASSERT(r->m_originatingLine->renderer() == this); + r->m_originatingLine->markDirty(); } #if !ASSERT_DISABLED - r->setOriginatingLine(0); + r->m_originatingLine = 0; #endif } markLinesDirtyInBlockRange(0, logicalBottom); } m_floatingObjects->remove(r); - ASSERT(!r->originatingLine()); + ASSERT(!r->m_originatingLine); delete r; } } @@ -3993,9 +3965,9 @@ void RenderBlock::removeFloatingObjectsBelow(FloatingObject* lastFloat, int logi const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObject* curr = floatingObjectSet.last(); - while (curr != lastFloat && (!curr->isPlaced() || curr->logicalTop(isHorizontalWritingMode()) >= logicalOffset)) { + while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(curr) >= logicalOffset)) { m_floatingObjects->remove(curr); - ASSERT(!curr->originatingLine()); + ASSERT(!curr->m_originatingLine); delete curr; if (floatingObjectSet.isEmpty()) break; @@ -4021,7 +3993,7 @@ LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* fl } else logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); - LayoutUnit floatLogicalWidth = min(floatingObject->logicalWidth(isHorizontalWritingMode()), logicalRightOffset - logicalLeftOffset); // The width we look for. + LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); // The width we look for. LayoutUnit floatLogicalLeft; @@ -4038,7 +4010,7 @@ LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* fl // Have to re-evaluate all of our offsets, since they may have changed. logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset. logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset. - floatLogicalWidth = min(floatingObject->logicalWidth(isHorizontalWritingMode()), logicalRightOffset - logicalLeftOffset); + floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); } } floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft); @@ -4053,10 +4025,10 @@ LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* fl // Have to re-evaluate all of our offsets, since they may have changed. logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset. logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset. - floatLogicalWidth = min(floatingObject->logicalWidth(isHorizontalWritingMode()), logicalRightOffset - logicalLeftOffset); + floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); } } - floatLogicalLeft -= floatingObject->logicalWidth(isHorizontalWritingMode()); // Use the original width of the float here, since the local variable + floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the original width of the float here, since the local variable // |floatLogicalWidth| was capped to the available line width. // See fast/block/float/clamped-right-float.html. } @@ -4097,7 +4069,7 @@ bool RenderBlock::positionNewFloats() // The float cannot start above the top position of the last positioned float. if (lastPlacedFloatingObject) - logicalTop = max(lastPlacedFloatingObject->logicalTop(isHorizontalWritingMode()), logicalTop); + logicalTop = max(logicalTopForFloat(lastPlacedFloatingObject), logicalTop); FloatingObjectSetIterator end = floatingObjectSet.end(); // Now walk through the set of unpositioned floats and place them. @@ -4120,7 +4092,7 @@ bool RenderBlock::positionNewFloats() LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, logicalTop); - floatingObject->setLogicalLeft(floatLogicalLocation.x(), isHorizontalWritingMode()); + setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); @@ -4147,10 +4119,10 @@ bool RenderBlock::positionNewFloats() } if (newLogicalTop != floatLogicalLocation.y()) { - floatingObject->setPaginationStrut(newLogicalTop - floatLogicalLocation.y()); + floatingObject->m_paginationStrut = newLogicalTop - floatLogicalLocation.y(); floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop); - floatingObject->setLogicalLeft(floatLogicalLocation.x(), isHorizontalWritingMode()); + setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); @@ -4161,9 +4133,9 @@ bool RenderBlock::positionNewFloats() } } - floatingObject->setLogicalTop(floatLogicalLocation.y(), isHorizontalWritingMode()); + setLogicalTopForFloat(floatingObject, floatLogicalLocation.y()); - floatingObject->setLogicalHeight(logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox), isHorizontalWritingMode()); + setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox)); m_floatingObjects->addPlacedObject(floatingObject); @@ -4254,7 +4226,7 @@ void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) } } -inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom) +static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom) { if (objectTop >= floatBottom || objectBottom < floatTop) return false; @@ -4275,48 +4247,41 @@ inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, } template<> -inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) +bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const { - LayoutUnit logicalRight = floatingObject->logicalRight(m_renderer->isHorizontalWritingMode()); - if (logicalRight > m_offset) { - m_offset = logicalRight; + if (m_renderer->logicalRightForFloat(floatingObject) > m_offset) { + m_offset = m_renderer->logicalRightForFloat(floatingObject); return true; } return false; } template<> -inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) +bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const { - LayoutUnit logicalLeft = floatingObject->logicalLeft(m_renderer->isHorizontalWritingMode()); - if (logicalLeft < m_offset) { - m_offset = logicalLeft; + if (m_renderer->logicalLeftForFloat(floatingObject) < m_offset) { + m_offset = m_renderer->logicalLeftForFloat(floatingObject); return true; } return false; } template <RenderBlock::FloatingObject::Type FloatTypeValue> -inline void RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) +inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) const { const FloatingObject* floatingObject = interval.data(); - if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom)) + if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lowValue, m_highValue)) return; - // Make sure the float hasn't changed since it was added to the placed floats tree. + // All the objects returned from the tree should be already placed. ASSERT(floatingObject->isPlaced()); - ASSERT(interval.low() == floatingObject->pixelSnappedLogicalTop(m_renderer->isHorizontalWritingMode())); - ASSERT(interval.high() == floatingObject->pixelSnappedLogicalBottom(m_renderer->isHorizontalWritingMode())); + ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingObject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lowValue, m_highValue)); bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); - if (floatIsNewExtreme) - m_outermostFloat = floatingObject; -} + if (floatIsNewExtreme && m_heightRemaining) + *m_heightRemaining = m_renderer->logicalBottomForFloat(floatingObject) - m_lowValue; -template <RenderBlock::FloatingObject::Type FloatTypeValue> -LayoutUnit RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::getHeightRemaining() const -{ - return m_outermostFloat ? m_outermostFloat->logicalBottom(m_renderer->isHorizontalWritingMode()) - m_lineTop : LayoutUnit(1); + m_last = floatingObject; } LayoutUnit RenderBlock::textIndentOffset() const @@ -4353,16 +4318,16 @@ LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay { LayoutUnit left = fixedOffset; if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { - ComputeFloatOffsetAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left); - m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); - if (heightRemaining) - *heightRemaining = adapter.getHeightRemaining(); + *heightRemaining = 1; + + FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemaining); + m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); - const FloatingObject* outermostFloat = adapter.outermostFloat(); - if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) { - if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOutsideInfo()) { - shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, outermostFloat->logicalTop(isHorizontalWritingMode()), logicalHeight); + const FloatingObject* lastFloat = adapter.lastFloat(); + if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { + if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) { + shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); left += shapeOutside->rightSegmentMarginBoxDelta(); } } @@ -4413,17 +4378,17 @@ LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La { LayoutUnit right = fixedOffset; if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { + if (heightRemaining) + *heightRemaining = 1; + LayoutUnit rightFloatOffset = fixedOffset; - ComputeFloatOffsetAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset); + FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, heightRemaining); m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); - if (heightRemaining) - *heightRemaining = adapter.getHeightRemaining(); - - const FloatingObject* outermostFloat = adapter.outermostFloat(); - if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) { - if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOutsideInfo()) { - shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, outermostFloat->logicalTop(isHorizontalWritingMode()), logicalHeight); + const FloatingObject* lastFloat = adapter.lastFloat(); + if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { + if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) { + shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); } } @@ -4481,7 +4446,7 @@ LayoutUnit RenderBlock::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight) co FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; - LayoutUnit floatBottom = r->logicalBottom(isHorizontalWritingMode()); + LayoutUnit floatBottom = logicalBottomForFloat(r); if (floatBottom > logicalHeight) bottom = min(floatBottom, bottom); } @@ -4499,7 +4464,7 @@ LayoutUnit RenderBlock::lowestFloatLogicalBottom(FloatingObject::Type floatType) for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; if (r->isPlaced() && r->type() & floatType) - lowestFloatBottom = max(lowestFloatBottom, r->logicalBottom(isHorizontalWritingMode())); + lowestFloatBottom = max(lowestFloatBottom, logicalBottomForFloat(r)); } return lowestFloatBottom; } @@ -4534,7 +4499,7 @@ void RenderBlock::clearFloats() for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* floatingObject = *it; if (!floatingObject->isDescendant()) - oldIntrudingFloatSet.add(floatingObject->renderer()); + oldIntrudingFloatSet.add(floatingObject->m_renderer); } } @@ -4558,7 +4523,7 @@ void RenderBlock::clearFloats() FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* f = *it; - floatMap.add(f->renderer(), f); + floatMap.add(f->m_renderer, f); } } else { deleteAllValues(floatingObjectSet); @@ -4610,11 +4575,11 @@ void RenderBlock::clearFloats() FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* f = *it; - FloatingObject* oldFloatingObject = floatMap.get(f->renderer()); - LayoutUnit logicalBottom = f->logicalBottom(isHorizontalWritingMode()); + FloatingObject* oldFloatingObject = floatMap.get(f->m_renderer); + LayoutUnit logicalBottom = logicalBottomForFloat(f); if (oldFloatingObject) { - LayoutUnit oldLogicalBottom = oldFloatingObject->logicalBottom(isHorizontalWritingMode()); - if (f->logicalWidth(isHorizontalWritingMode()) != oldFloatingObject->logicalWidth(isHorizontalWritingMode()) || f->logicalLeft(isHorizontalWritingMode()) != oldFloatingObject->logicalLeft(isHorizontalWritingMode())) { + LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloatingObject); + if (logicalWidthForFloat(f) != logicalWidthForFloat(oldFloatingObject) || logicalLeftForFloat(f) != logicalLeftForFloat(oldFloatingObject)) { changeLogicalTop = 0; changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); } else { @@ -4622,18 +4587,18 @@ void RenderBlock::clearFloats() changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom)); changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); } - LayoutUnit logicalTop = f->logicalTop(isHorizontalWritingMode()); - LayoutUnit oldLogicalTop = oldFloatingObject->logicalTop(isHorizontalWritingMode()); + LayoutUnit logicalTop = logicalTopForFloat(f); + LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject); if (logicalTop != oldLogicalTop) { changeLogicalTop = min(changeLogicalTop, min(logicalTop, oldLogicalTop)); changeLogicalBottom = max(changeLogicalBottom, max(logicalTop, oldLogicalTop)); } } - floatMap.remove(f->renderer()); - if (oldFloatingObject->originatingLine() && !selfNeedsLayout()) { - ASSERT(oldFloatingObject->originatingLine()->renderer() == this); - oldFloatingObject->originatingLine()->markDirty(); + floatMap.remove(f->m_renderer); + if (oldFloatingObject->m_originatingLine && !selfNeedsLayout()) { + ASSERT(oldFloatingObject->m_originatingLine->renderer() == this); + oldFloatingObject->m_originatingLine->markDirty(); } delete oldFloatingObject; } else { @@ -4648,7 +4613,7 @@ void RenderBlock::clearFloats() FloatingObject* floatingObject = (*it).value; if (!floatingObject->isDescendant()) { changeLogicalTop = 0; - changeLogicalBottom = max(changeLogicalBottom, floatingObject->logicalBottom(isHorizontalWritingMode())); + changeLogicalBottom = max(changeLogicalBottom, logicalBottomForFloat(floatingObject)); } } deleteAllValues(floatMap); @@ -4663,7 +4628,7 @@ void RenderBlock::clearFloats() const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it) - oldIntrudingFloatSet.remove((*it)->renderer()); + oldIntrudingFloatSet.remove((*it)->m_renderer); if (!oldIntrudingFloatSet.isEmpty()) markAllDescendantsWithFloatsForLayout(); } @@ -4685,22 +4650,22 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) { FloatingObject* r = *childIt; - LayoutUnit logicalBottomForFloat = min(r->logicalBottom(isHorizontalWritingMode()), LayoutUnit::max() - childLogicalTop); + LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(r), LayoutUnit::max() - childLogicalTop); LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; lowestFloatLogicalBottom = max(lowestFloatLogicalBottom, logicalBottom); if (logicalBottom > logicalHeight()) { // If the object is not in the list, we add it now. - if (!containsFloat(r->renderer())) { + if (!containsFloat(r->m_renderer)) { LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-childLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft); FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size())); - floatingObj->setRenderer(r->renderer()); + floatingObj->m_renderer = r->m_renderer; // The nearest enclosing layer always paints the float (so that zindex and stacking // behaves properly). We always want to propagate the desire to paint the float as // far out as we can, to the outermost block that overlaps the float, stopping only // if we hit a self-painting layer boundary. - if (r->renderer()->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) + if (r->m_renderer->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) r->setShouldPaint(false); else floatingObj->setShouldPaint(false); @@ -4713,8 +4678,8 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP m_floatingObjects->add(floatingObj); } } else { - if (makeChildPaintOtherFloats && !r->shouldPaint() && !r->renderer()->hasSelfPaintingLayer() - && r->renderer()->isDescendantOf(child) && r->renderer()->enclosingFloatPaintingLayer() == child->enclosingFloatPaintingLayer()) { + if (makeChildPaintOtherFloats && !r->shouldPaint() && !r->m_renderer->hasSelfPaintingLayer() + && r->m_renderer->isDescendantOf(child) && r->m_renderer->enclosingFloatPaintingLayer() == child->enclosingFloatPaintingLayer()) { // The float is not overhanging from this block, so if it is a descendant of the child, the child should // paint it (the other case is that it is intruding into the child), unless it has its own layer or enclosing // layer. @@ -4726,7 +4691,7 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP // Since the float doesn't overhang, it didn't get put into our list. We need to go ahead and add its overflow in to the // child now. if (r->isDescendant()) - child->addOverflowFromChild(r->renderer(), LayoutSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); + child->addOverflowFromChild(r->m_renderer, LayoutSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); } } return lowestFloatLogicalBottom; @@ -4742,7 +4707,7 @@ bool RenderBlock::hasOverhangingFloat(RenderBox* renderer) if (it == floatingObjectSet.end()) return false; - return (*it)->logicalBottom(isHorizontalWritingMode()) > logicalHeight(); + return logicalBottomForFloat(*it) > logicalHeight(); } void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOffset, LayoutUnit logicalTopOffset) @@ -4759,7 +4724,7 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOf FloatingObjectSetIterator prevEnd = prevSet.end(); for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd; ++prevIt) { FloatingObject* r = *prevIt; - if (r->logicalBottom(isHorizontalWritingMode()) > logicalTopOffset) { + if (logicalBottomForFloat(r) > logicalTopOffset) { if (!m_floatingObjects || !m_floatingObjects->set().contains(r)) { LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOffset, logicalTopOffset) : LayoutSize(logicalTopOffset, logicalLeftOffset); FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size())); @@ -4777,7 +4742,7 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOf } floatingObj->setShouldPaint(false); // We are not in the direct inheritance chain for this float. We will never paint it. - floatingObj->setRenderer(r->renderer()); + floatingObj->m_renderer = r->m_renderer; // We create the floating object list lazily. if (!m_floatingObjects) @@ -5031,11 +4996,11 @@ bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& re for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { --it; FloatingObject* floatingObject = *it; - if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSelfPaintingLayer()) { - LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x(); - LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->y(); + if (floatingObject->shouldPaint() && !floatingObject->m_renderer->hasSelfPaintingLayer()) { + LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x(); + LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y(); LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset)); - if (floatingObject->renderer()->hitTest(request, result, locationInContainer, childPoint)) { + if (floatingObject->m_renderer->hitTest(request, result, locationInContainer, childPoint)) { updateHitTestResult(result, locationInContainer.point() - toLayoutSize(childPoint)); return true; } @@ -6926,8 +6891,8 @@ void RenderBlock::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& FloatingObject* r = *it; // Only examine the object if our m_shouldPaint flag is set. if (r->shouldPaint()) { - LayoutUnit floatLeft = xPositionForFloatIncludingMargin(r) - r->renderer()->x(); - LayoutUnit floatRight = floatLeft + r->renderer()->width(); + LayoutUnit floatLeft = xPositionForFloatIncludingMargin(r) - r->m_renderer->x(); + LayoutUnit floatRight = floatLeft + r->m_renderer->width(); left = min(left, floatLeft); right = max(right, floatRight); } @@ -7695,7 +7660,7 @@ LayoutUnit RenderBlock::offsetFromLogicalTopOfFirstPage() const // 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->renderer() == this); + // ASSERT(layoutState->m_renderer == this); LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(); @@ -7967,9 +7932,6 @@ void RenderBlock::createFloatingObjects() inline void RenderBlock::FloatingObjects::clear() { - // FIXME: This should call deleteAllValues, except RenderBlock::clearFloats - // like to play fast and loose with ownership of these pointers. - // If we move to OwnPtr that will fix this ownership oddness. m_set.clear(); m_placedFloatsTree.clear(); m_leftObjectsCount = 0; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h index f124d9dac70..06300e892bb 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h @@ -455,7 +455,6 @@ public: } ShapeInsideInfo* layoutShapeInsideInfo() const; bool allowsShapeInsideInfoSharing() const { return !isInline() && !isFloating(); } - virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; protected: virtual void willBeDestroyed(); @@ -655,7 +654,7 @@ private: bool everHadLayout; }; - class FloatingObject { + struct FloatingObject { WTF_MAKE_NONCOPYABLE(FloatingObject); WTF_MAKE_FAST_ALLOCATED; public: // Note that Type uses bits so you can use FloatLeftRight as a mask to query for both left and right. @@ -712,12 +711,12 @@ private: bool isPlaced() const { return m_isPlaced; } void setIsPlaced(bool placed = true) { m_isPlaced = placed; } - LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } - LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); } - LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } - LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); } - LayoutUnit width() const { return m_frameRect.width(); } - LayoutUnit height() const { return m_frameRect.height(); } + inline LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } + inline LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); } + inline LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } + inline LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); } + inline LayoutUnit width() const { return m_frameRect.width(); } + inline LayoutUnit height() const { return m_frameRect.height(); } void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); } void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); } @@ -727,9 +726,6 @@ private: const LayoutRect& frameRect() const { ASSERT(isPlaced()); return m_frameRect; } void setFrameRect(const LayoutRect& frameRect) { ASSERT(!isInPlacedTree()); m_frameRect = frameRect; } - int paginationStrut() const { return m_paginationStrut; } - void setPaginationStrut(int strut) { m_paginationStrut = strut; } - #ifndef NDEBUG bool isInPlacedTree() const { return m_isInPlacedTree; } void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } @@ -740,57 +736,12 @@ private: bool isDescendant() const { return m_isDescendant; } void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } - // FIXME: Callers of these methods are dangerous and should be whitelisted explicitly or removed. - void setRenderer(RenderBox* renderer) { m_renderer = renderer; } - RootInlineBox* originatingLine() const { return m_originatingLine; } - void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line; } - - LayoutUnit logicalTop(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? y() : x(); } - LayoutUnit logicalBottom(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? maxY() : maxX(); } - LayoutUnit logicalLeft(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? x() : y(); } - LayoutUnit logicalRight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? maxX() : maxY(); } - LayoutUnit logicalWidth(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? width() : height(); } - - int pixelSnappedLogicalTop(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedY() : frameRect().pixelSnappedX(); } - int pixelSnappedLogicalBottom(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedMaxY() : frameRect().pixelSnappedMaxX(); } - int pixelSnappedLogicalLeft(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedX() : frameRect().pixelSnappedY(); } - int pixelSnappedLogicalRight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedMaxX() : frameRect().pixelSnappedMaxY(); } - - void setLogicalTop(LayoutUnit logicalTop, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setY(logicalTop); - else - setX(logicalTop); - } - void setLogicalLeft(LayoutUnit logicalLeft, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setX(logicalLeft); - else - setY(logicalLeft); - } - void setLogicalHeight(LayoutUnit logicalHeight, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setHeight(logicalHeight); - else - setWidth(logicalHeight); - } - void setLogicalWidth(LayoutUnit logicalWidth, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setWidth(logicalWidth); - else - setHeight(logicalWidth); - } - - private: RenderBox* m_renderer; RootInlineBox* m_originatingLine; LayoutRect m_frameRect; - int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this need 32-bits? + int m_paginationStrut; + private: unsigned m_type : 2; // Type (left or right aligned) unsigned m_shouldPaint : 1; unsigned m_isDescendant : 1; @@ -802,6 +753,46 @@ private: LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&) const; + LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); } + LayoutUnit logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); } + LayoutUnit logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); } + LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); } + LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); } + + int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedY() : child->frameRect().pixelSnappedX(); } + int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedMaxY() : child->frameRect().pixelSnappedMaxX(); } + int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedX() : child->frameRect().pixelSnappedY(); } + int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedMaxX() : child->frameRect().pixelSnappedMaxY(); } + + void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop) + { + if (isHorizontalWritingMode()) + child->setY(logicalTop); + else + child->setX(logicalTop); + } + void setLogicalLeftForFloat(FloatingObject* child, LayoutUnit logicalLeft) + { + if (isHorizontalWritingMode()) + child->setX(logicalLeft); + else + child->setY(logicalLeft); + } + void setLogicalHeightForFloat(FloatingObject* child, LayoutUnit logicalHeight) + { + if (isHorizontalWritingMode()) + child->setHeight(logicalHeight); + else + child->setWidth(logicalHeight); + } + void setLogicalWidthForFloat(FloatingObject* child, LayoutUnit logicalWidth) + { + if (isHorizontalWritingMode()) + child->setWidth(logicalWidth); + else + child->setHeight(logicalWidth); + } + LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const { if (isHorizontalWritingMode()) @@ -1158,13 +1149,13 @@ public: protected: struct FloatingObjectHashFunctions { - static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::Hash::hash(key->renderer()); } - static bool equal(FloatingObject* a, FloatingObject* b) { return a->renderer() == b->renderer(); } + static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::Hash::hash(key->m_renderer); } + static bool equal(FloatingObject* a, FloatingObject* b) { return a->m_renderer == b->m_renderer; } static const bool safeToCompareToEmptyOrDeleted = true; }; struct FloatingObjectHashTranslator { static unsigned hash(RenderBox* key) { return DefaultHash<RenderBox*>::Hash::hash(key); } - static bool equal(FloatingObject* a, RenderBox* b) { return a->renderer() == b; } + static bool equal(FloatingObject* a, RenderBox* b) { return a->m_renderer == b; } }; typedef ListHashSet<FloatingObject*, 4, FloatingObjectHashFunctions> FloatingObjectSet; typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; @@ -1173,39 +1164,46 @@ protected: typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> IntervalArena; template <FloatingObject::Type FloatTypeValue> - class ComputeFloatOffsetAdapter { + class FloatIntervalSearchAdapter { public: typedef FloatingObjectInterval IntervalType; - ComputeFloatOffsetAdapter(const RenderBlock* renderer, int lineTop, int lineBottom, LayoutUnit& offset) + FloatIntervalSearchAdapter(const RenderBlock* renderer, int lowValue, int highValue, LayoutUnit& offset, LayoutUnit* heightRemaining) : m_renderer(renderer) - , m_lineTop(lineTop) - , m_lineBottom(lineBottom) + , m_lowValue(lowValue) + , m_highValue(highValue) , m_offset(offset) - , m_outermostFloat(0) + , m_heightRemaining(heightRemaining) + , m_last(0) { } - inline int lowValue() const { return m_lineTop; } - inline int highValue() const { return m_lineBottom; } - void collectIfNeeded(const IntervalType&); + inline int lowValue() const { return m_lowValue; } + inline int highValue() const { return m_highValue; } + void collectIfNeeded(const IntervalType&) const; // When computing the offset caused by the floats on a given line, if // the outermost float on that line has a shape-outside, the inline // content that butts up against that float must be positioned using // the contours of the shape, not the margin box of the float. - const FloatingObject* outermostFloat() const { return m_outermostFloat; } - - LayoutUnit getHeightRemaining() const; + // We save the last float encountered so that the offset can be + // computed correctly by the code using this adapter. + const FloatingObject* lastFloat() const { return m_last; } private: - bool updateOffsetIfNeeded(const FloatingObject*); + bool updateOffsetIfNeeded(const FloatingObject*) const; const RenderBlock* m_renderer; - int m_lineTop; - int m_lineBottom; + int m_lowValue; + int m_highValue; LayoutUnit& m_offset; - const FloatingObject* m_outermostFloat; + LayoutUnit* m_heightRemaining; + // This member variable is mutable because the collectIfNeeded method + // is declared as const, even though it doesn't actually respect that + // contract. It modifies other member variables via loopholes in the + // const behavior. Instead of using loopholes, I decided it was better + // to make the fact that this is modified in a const method explicit. + mutable const FloatingObject* m_last; }; void createFloatingObjects(); @@ -1215,8 +1213,6 @@ public: class FloatingObjects { WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; public: - ~FloatingObjects(); - void clear(); void add(FloatingObject*); void remove(FloatingObject*); @@ -1232,7 +1228,6 @@ public: computePlacedFloatsTreeIfNeeded(); return m_placedFloatsTree; } - void clearLineBoxTreePointers(); private: FloatingObjects(const RenderBlock*, bool horizontalWritingMode); void computePlacedFloatsTree(); diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp index cbe77432e6a..f16fcb63493 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp @@ -161,7 +161,7 @@ inline void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight) inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::FloatingObject* newFloat) { LayoutUnit height = m_block->logicalHeight(); - if (height < newFloat->logicalTop(m_block->isHorizontalWritingMode()) || height >= newFloat->logicalBottom(m_block->isHorizontalWritingMode())) + if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->logicalBottomForFloat(newFloat)) return; // When floats with shape outside are stacked, the floats are positioned based on the margin box of the float, @@ -179,7 +179,7 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) { previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideInfo(); if (previousShapeOutsideInfo) { - previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), previousFloat->logicalTop(m_block->isHorizontalWritingMode()), logicalHeightForLine(m_block, m_isFirstLine)); + previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), m_block->logicalTopForFloat(previousFloat), logicalHeightForLine(m_block, m_isFirstLine)); } break; } @@ -187,10 +187,10 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo(); if (shapeOutsideInfo) - shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), newFloat->logicalTop(m_block->isHorizontalWritingMode()), logicalHeightForLine(m_block, m_isFirstLine)); + shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), m_block->logicalTopForFloat(newFloat), logicalHeightForLine(m_block, m_isFirstLine)); if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { - float newLeft = newFloat->logicalRight(m_block->isHorizontalWritingMode()); + float newLeft = m_block->logicalRightForFloat(newFloat); if (previousShapeOutsideInfo) newLeft -= previousShapeOutsideInfo->rightSegmentMarginBoxDelta(); if (shapeOutsideInfo) @@ -200,7 +200,7 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa newLeft += floorToInt(m_block->textIndentOffset()); m_left = max<float>(m_left, newLeft); } else { - float newRight = newFloat->logicalLeft(m_block->isHorizontalWritingMode()); + float newRight = m_block->logicalLeftForFloat(newFloat); if (previousShapeOutsideInfo) newRight -= previousShapeOutsideInfo->leftSegmentMarginBoxDelta(); if (shapeOutsideInfo) @@ -1226,8 +1226,8 @@ inline BidiRun* RenderBlock::handleTrailingSpaces(BidiRunList<BidiRun>& bidiRuns void RenderBlock::appendFloatingObjectToLastLine(FloatingObject* floatingObject) { - ASSERT(!floatingObject->originatingLine()); - floatingObject->setOriginatingLine(lastRootBox()); + ASSERT(!floatingObject->m_originatingLine); + floatingObject->m_originatingLine = lastRootBox(); lastRootBox()->appendFloat(floatingObject->renderer()); } @@ -1881,7 +1881,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin for (; it != end; ++it) { FloatingObject* f = *it; appendFloatingObjectToLastLine(f); - ASSERT(f->renderer() == layoutState.floats()[layoutState.floatIndex()].object); + ASSERT(f->m_renderer == layoutState.floats()[layoutState.floatIndex()].object); // If a float's geometry has changed, give up on syncing with clean lines. if (layoutState.floats()[layoutState.floatIndex()].rect != f->frameRect()) checkForEndLineMatch = false; @@ -1975,8 +1975,8 @@ void RenderBlock::linkToEndLineIfNeeded(LineLayoutState& layoutState) Vector<RenderBox*>::iterator end = cleanLineFloats->end(); for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { FloatingObject* floatingObject = insertFloatingObject(*f); - ASSERT(!floatingObject->originatingLine()); - floatingObject->setOriginatingLine(line); + ASSERT(!floatingObject->m_originatingLine); + floatingObject->m_originatingLine = line; setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChild(*f) + delta); positionNewFloats(); } @@ -2266,8 +2266,8 @@ RootInlineBox* RenderBlock::determineStartPosition(LineLayoutState& layoutState, Vector<RenderBox*>::iterator end = cleanLineFloats->end(); for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { FloatingObject* floatingObject = insertFloatingObject(*f); - ASSERT(!floatingObject->originatingLine()); - floatingObject->setOriginatingLine(line); + ASSERT(!floatingObject->m_originatingLine); + floatingObject->m_originatingLine = line; setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChild(*f)); positionNewFloats(); ASSERT(layoutState.floats()[numCleanFloats].object == *f); @@ -2374,7 +2374,7 @@ bool RenderBlock::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutState FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* f = *it; - if (f->logicalBottom(isHorizontalWritingMode()) >= logicalTop && f->logicalBottom(isHorizontalWritingMode()) < logicalBottom) + if (logicalBottomForFloat(f) >= logicalTop && logicalBottomForFloat(f) < logicalBottom) return false; } @@ -2832,7 +2832,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re // If it does, position it now, otherwise, position // it after moving to next line (in newLine() func) // FIXME: Bug 110372: Properly position multiple stacked floats with non-rectangular shape outside. - if (floatsFitOnLine && width.fitsOnLine(f->logicalWidth(m_block->isHorizontalWritingMode()))) { + if (floatsFitOnLine && width.fitsOnLine(m_block->logicalWidthForFloat(f))) { m_block->positionNewFloatOnLine(f, lastFloatFromPreviousLine, lineInfo, width); if (lBreak.m_obj == current.m_obj) { ASSERT(!lBreak.m_pos); @@ -3401,14 +3401,14 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec // We only connect floats to lines for pagination purposes if the floats occur at the start of // the line and the previous line had a hard break (so this line is either the first in the block // or follows a <br>). - if (!newFloat->paginationStrut() || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty()) + if (!newFloat->m_paginationStrut || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty()) return true; const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); ASSERT(floatingObjectSet.last() == newFloat); - LayoutUnit floatLogicalTop = newFloat->logicalTop(isHorizontalWritingMode()); - int paginationStrut = newFloat->paginationStrut(); + LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat); + int paginationStrut = newFloat->m_paginationStrut; if (floatLogicalTop - paginationStrut != logicalHeight() + lineInfo.floatPaginationStrut()) return true; @@ -3421,18 +3421,18 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec FloatingObject* f = *it; if (f == lastFloatFromPreviousLine) break; - if (f->logicalTop(isHorizontalWritingMode()) == logicalHeight() + lineInfo.floatPaginationStrut()) { - f->setPaginationStrut(paginationStrut + f->paginationStrut()); - RenderBox* o = f->renderer(); + if (logicalTopForFloat(f) == logicalHeight() + lineInfo.floatPaginationStrut()) { + f->m_paginationStrut += paginationStrut; + RenderBox* o = f->m_renderer; setLogicalTopForChild(o, logicalTopForChild(o) + marginBeforeForChild(o) + paginationStrut); if (o->isRenderBlock()) toRenderBlock(o)->setChildNeedsLayout(MarkOnlyThis); o->layoutIfNeeded(); // Save the old logical top before calling removePlacedObject which will set // isPlaced to false. Otherwise it will trigger an assert in logicalTopForFloat. - LayoutUnit oldLogicalTop = f->logicalTop(isHorizontalWritingMode()); + LayoutUnit oldLogicalTop = logicalTopForFloat(f); m_floatingObjects->removePlacedObject(f); - f->setLogicalTop(oldLogicalTop + paginationStrut, isHorizontalWritingMode()); + setLogicalTopForFloat(f, oldLogicalTop + paginationStrut); m_floatingObjects->addPlacedObject(f); } } diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp index 73e76a60597..bb53fd51cde 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp @@ -808,8 +808,6 @@ IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con IntSize offset; IntPoint point = frameView->windowToContents(windowPoint); IntRect box(absoluteBoundingBoxRect()); - if (isRenderView()) - box.moveBy(frameView->windowToContents(IntPoint())); if (point.x() < box.x() + autoscrollBeltSize) point.move(-autoscrollBeltSize, 0); diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp index 0a753c1dea0..9d0d58990de 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp @@ -595,9 +595,6 @@ void RenderGrid::resolveContentBasedTrackSizingFunctionsForItems(TrackSizingDire tracks.append(&track); } - if (tracks.isEmpty()) - return; - LayoutUnit additionalBreadthSpace = (this->*sizingFunction)(gridItem, direction, columnTracks); for (size_t trackIndexForSpace = initialTrackIndex; trackIndexForSpace <= finalTrackIndex; ++trackIndexForSpace) { GridTrack& track = (direction == ForColumns) ? columnTracks[trackIndexForSpace] : rowTracks[trackIndexForSpace]; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp index f9be3be4de0..ce48656440e 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp @@ -30,11 +30,11 @@ #include "HTMLNames.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLAreaElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLMapElement.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/platform/graphics/Font.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp index 61301870230..4a38fdd251d 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "core/rendering/RenderImageResource.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/platform/graphics/Image.h" #include "core/rendering/RenderObject.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h index 6cffb71841d..d222111e4d2 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h @@ -26,8 +26,8 @@ #ifndef RenderImageResource_h #define RenderImageResource_h -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/graphics/Image.h" #include "core/platform/graphics/LayoutSize.h" #include "core/rendering/style/StyleImage.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp index 9c3b03e8062..ec9023582a4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "core/rendering/RenderImageResourceStyleImage.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderObject.h" #include "core/rendering/style/StyleFetchedImage.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp index 282e6e0568d..c8991f2d933 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp @@ -30,11 +30,11 @@ #include "CSSPropertyNames.h" #include "HTMLNames.h" #include "RuntimeEnabledFeatures.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLIFrameElement.h" #include "core/html/HTMLMediaElement.h" #include "core/html/canvas/CanvasRenderingContext.h" #include "core/inspector/InspectorInstrumentation.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Chrome.h" #include "core/page/FrameView.h" #include "core/page/Settings.h" @@ -1708,7 +1708,7 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const CSSAnimationDat for (size_t i = 0; i < numKeyframes; ++i) { const KeyframeValue& currentKeyframe = keyframes[i]; const RenderStyle* keyframeStyle = currentKeyframe.style(); - double key = currentKeyframe.key(); + float key = currentKeyframe.key(); if (!keyframeStyle) continue; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp index 8a6b4e39b14..abad09d6e25 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp @@ -31,8 +31,8 @@ #include "core/rendering/RenderLayerFilterInfo.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" #include "core/platform/graphics/filters/custom/CustomFilterProgram.h" #include "core/rendering/FilterEffectRenderer.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h index 4e44b3f2f7a..ad29a02d9e2 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h @@ -31,7 +31,7 @@ #define RenderLayerFilterInfo_h #include "core/dom/Element.h" -#include "core/fetch/DocumentResource.h" +#include "core/loader/cache/DocumentResource.h" #include "core/platform/graphics/LayoutRect.h" #include "core/platform/graphics/filters/FilterOperation.h" #include "core/platform/graphics/filters/custom/CustomFilterProgramClient.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp index c2dea3be02e..d63728e4514 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp @@ -26,7 +26,7 @@ #include "core/rendering/RenderListMarker.h" #include "core/dom/Document.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/platform/graphics/Font.h" #include "core/platform/graphics/GraphicsContextStateSaver.h" #include "core/rendering/RenderLayer.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp index 1e4bafeefd2..58bbf327ced 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp @@ -673,11 +673,10 @@ static inline bool objectIsRelayoutBoundary(const RenderObject* object) return true; } -void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot, SubtreeLayoutScope* layouter) +void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot) { ASSERT(!scheduleRelayout || !newRoot); ASSERT(!isSetNeedsLayoutForbidden()); - ASSERT(!layouter || this != layouter->root()); RenderObject* object = container(); RenderObject* last = this; @@ -723,12 +722,6 @@ void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderOb ASSERT(!object->isSetNeedsLayoutForbidden()); } - if (layouter) { - layouter->addRendererToLayout(object); - if (object == layouter->root()) - return; - } - if (object == newRoot) return; @@ -1128,7 +1121,7 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset, RenderStyle* style) { Vector<IntRect> focusRingRects; - addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer()); + addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer); if (style->outlineStyleIsAuto()) paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); else @@ -1871,8 +1864,6 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style) updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_style->borderImage().image() : 0); updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0); - updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0); - // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen // during styleDidChange (it's used by clippedOverflowRectForRepaint()). if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline)) @@ -2114,12 +2105,6 @@ void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage) } } -void RenderObject::updateShapeImage(const ShapeValue* oldShapeValue, const ShapeValue* newShapeValue) -{ - if (oldShapeValue || newShapeValue) - updateImage(oldShapeValue ? oldShapeValue->image() : 0, newShapeValue ? newShapeValue->image() : 0); -} - LayoutRect RenderObject::viewRect() const { return view()->viewRect(); @@ -2671,14 +2656,6 @@ void RenderObject::destroyAndCleanupAnonymousWrappers() // WARNING: |this| is deleted here. } -void RenderObject::removeShapeImageClient(ShapeValue* shapeValue) -{ - if (!shapeValue) - return; - if (StyleImage* shapeImage = shapeValue->image()) - shapeImage->removeClient(this); -} - void RenderObject::destroy() { willBeDestroyed(); @@ -2704,8 +2681,6 @@ void RenderObject::postDestroy() if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) maskBoxImage->removeClient(this); - - removeShapeImageClient(m_style->shapeInside()); } delete this; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h index 451e9587e61..4d34112f885 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h @@ -29,14 +29,13 @@ #include "core/dom/DocumentStyleSheetCollection.h" #include "core/dom/Element.h" #include "core/dom/Position.h" -#include "core/fetch/ImageResourceClient.h" +#include "core/loader/cache/ImageResourceClient.h" #include "core/platform/graphics/FloatQuad.h" #include "core/platform/graphics/LayoutRect.h" #include "core/platform/graphics/transforms/TransformationMatrix.h" #include "core/rendering/PaintPhase.h" #include "core/rendering/RenderObjectChildList.h" #include "core/rendering/ScrollBehavior.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/RenderStyle.h" #include "core/rendering/style/StyleInheritedData.h" #include "wtf/HashSet.h" @@ -622,10 +621,10 @@ public: Element* offsetParent() const; - void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0, SubtreeLayoutScope* = 0); - void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayoutScope* = 0); + void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0); + void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain); void clearNeedsLayout(); - void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayoutScope* = 0); + void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain); void setNeedsPositionedMovementLayout(); void setNeedsSimplifiedNormalFlowLayout(); void setPreferredLogicalWidthsDirty(bool, MarkingBehavior = MarkContainingBlockChain); @@ -664,7 +663,6 @@ public: void updateFillImages(const FillLayer*, const FillLayer*); void updateImage(StyleImage*, StyleImage*); - void updateShapeImage(const ShapeValue*, const ShapeValue*); virtual void paint(PaintInfo&, const LayoutPoint&); @@ -1072,8 +1070,6 @@ private: return styleColor; } - void removeShapeImageClient(ShapeValue*); - #ifndef NDEBUG void checkBlockPositionedObjectsNeedLayout(); #endif @@ -1244,14 +1240,14 @@ inline bool RenderObject::isBeforeOrAfterContent() const return isBeforeContent() || isAfterContent(); } -inline void RenderObject::setNeedsLayout(MarkingBehavior markParents, SubtreeLayoutScope* layouter) +inline void RenderObject::setNeedsLayout(MarkingBehavior markParents) { ASSERT(!isSetNeedsLayoutForbidden()); bool alreadyNeededLayout = m_bitfields.needsLayout(); m_bitfields.setNeedsLayout(true); if (!alreadyNeededLayout) { - if (markParents == MarkContainingBlockChain && (!layouter || layouter->root() != this)) - markContainingBlocksForLayout(true, 0, layouter); + if (markParents == MarkContainingBlockChain) + markContainingBlocksForLayout(); if (hasLayer()) setLayerNeedsFullRepaint(); } @@ -1271,14 +1267,13 @@ inline void RenderObject::clearNeedsLayout() #endif } -inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, SubtreeLayoutScope* layouter) +inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents) { ASSERT(!isSetNeedsLayoutForbidden()); bool alreadyNeededLayout = normalChildNeedsLayout(); setNormalChildNeedsLayout(true); - // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and remove the MarkingBehavior argument entirely. - if (!alreadyNeededLayout && markParents == MarkContainingBlockChain && (!layouter || layouter->root() != this)) - markContainingBlocksForLayout(true, 0, layouter); + if (!alreadyNeededLayout && markParents == MarkContainingBlockChain) + markContainingBlocksForLayout(); } inline void RenderObject::setNeedsPositionedMovementLayout() diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp index ab322b8902a..4e4244c7b7f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp @@ -24,7 +24,6 @@ #include "config.h" #include "core/rendering/RenderSearchField.h" -#include "core/dom/shadow/ShadowRoot.h" #include "core/html/HTMLInputElement.h" #include "core/html/shadow/ShadowElementNames.h" @@ -48,12 +47,12 @@ RenderSearchField::~RenderSearchField() inline Element* RenderSearchField::searchDecorationElement() const { - return inputElement()->userAgentShadowRoot()->getElementById(ShadowElementNames::searchDecoration()); + return inputElement()->uaShadowElementById(ShadowElementNames::searchDecoration()); } inline Element* RenderSearchField::cancelButtonElement() const { - return inputElement()->userAgentShadowRoot()->getElementById(ShadowElementNames::clearButton()); + return inputElement()->uaShadowElementById(ShadowElementNames::clearButton()); } LayoutUnit RenderSearchField::computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp index 7ea9fa2f72d..12ea553e69d 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp @@ -40,7 +40,6 @@ #include "core/rendering/RenderTableCol.h" #include "core/rendering/RenderTableSection.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/CollapsedBorderValue.h" #include "core/rendering/style/StyleInheritedData.h" @@ -423,11 +422,9 @@ void RenderTable::layout() LayoutUnit oldLogicalWidth = logicalWidth(); updateLogicalWidth(); - SubtreeLayoutScope layouter(this); - if (logicalWidth() != oldLogicalWidth) { for (unsigned i = 0; i < m_captions.size(); i++) - layouter.setNeedsLayout(m_captions[i]); + m_captions[i]->setNeedsLayout(MarkOnlyThis); } // FIXME: The optimisation below doesn't work since the internal table // layout could have changed. we need to add a flag to the table @@ -447,7 +444,7 @@ void RenderTable::layout() if (child->isTableSection()) { RenderTableSection* section = toRenderTableSection(child); if (m_columnLogicalWidthChanged) - layouter.setChildNeedsLayout(section); + section->setChildNeedsLayout(MarkOnlyThis); section->layoutIfNeeded(); totalSectionLogicalHeight += section->calcRowLogicalHeight(); if (collapsing) diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp index 25ae144ebb6..b67203d5d16 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp @@ -34,7 +34,6 @@ #include "core/rendering/PaintInfo.h" #include "core/rendering/RenderTableCol.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/CollapsedBorderValue.h" using namespace std; @@ -163,7 +162,7 @@ void RenderTableCell::computePreferredLogicalWidths() } } -void RenderTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& layouter) +void RenderTableCell::computeIntrinsicPadding(int rowHeight) { int oldIntrinsicPaddingBefore = intrinsicPaddingBefore(); int oldIntrinsicPaddingAfter = intrinsicPaddingAfter(); @@ -201,19 +200,20 @@ void RenderTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& // FIXME: Changing an intrinsic padding shouldn't trigger a relayout as it only shifts the cell inside the row but // doesn't change the logical height. if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingAfter != oldIntrinsicPaddingAfter) - layouter.setNeedsLayout(this); + setNeedsLayout(MarkOnlyThis); } void RenderTableCell::updateLogicalWidth() { } -void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLayoutScope& layouter) +void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth) { if (tableLayoutLogicalWidth == logicalWidth()) return; - layouter.setNeedsLayout(this); + setNeedsLayout(MarkOnlyThis); + row()->setChildNeedsLayout(MarkOnlyThis); if (!table()->selfNeedsLayout() && checkForRepaintDuringLayout()) repaint(); @@ -224,8 +224,6 @@ void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLa void RenderTableCell::layout() { - ASSERT(needsLayout()); - StackStats::LayoutCheckPoint layoutCheckPoint; updateFirstLetter(); @@ -239,8 +237,7 @@ void RenderTableCell::layout() if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselinePosition() > section()->rowBaseline(rowIndex())) { int newIntrinsicPaddingBefore = max<LayoutUnit>(0, intrinsicPaddingBefore() - max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline)); setIntrinsicPaddingBefore(newIntrinsicPaddingBefore); - SubtreeLayoutScope layouter(this); - layouter.setNeedsLayout(this); + setNeedsLayout(MarkOnlyThis); layoutBlock(cellWidthChanged()); } diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h index 9a0da52dfc8..14dac6000f4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h @@ -35,8 +35,6 @@ static const unsigned maxColumnIndex = 0x1FFFFFFE; // 536,870,910 enum IncludeBorderColorOrNot { DoNotIncludeBorderColor, IncludeBorderColor }; -class SubtreeLayoutScope; - class RenderTableCell FINAL : public RenderBlock { public: explicit RenderTableCell(Element*); @@ -105,7 +103,7 @@ public: } - void setCellLogicalWidth(int constrainedLogicalWidth, SubtreeLayoutScope&); + void setCellLogicalWidth(int constrainedLogicalWidth); virtual int borderLeft() const; virtual int borderRight() const; @@ -133,7 +131,7 @@ public: return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH; } - void computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&); + void computeIntrinsicPadding(int rowHeight); void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp index 4831a49e1d6..ce0dd03491f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp @@ -28,6 +28,7 @@ #include "HTMLNames.h" #include "core/html/HTMLTableColElement.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderTable.h" #include "core/rendering/RenderTableCell.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp index dc1d16c8f0b..3fae9224901 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp @@ -27,12 +27,11 @@ #include "HTMLNames.h" #include "core/dom/Document.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/HitTestResult.h" #include "core/rendering/PaintInfo.h" #include "core/rendering/RenderTableCell.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/StyleInheritedData.h" namespace WebCore { @@ -85,7 +84,7 @@ void RenderTableRow::styleDidChange(StyleDifference diff, const RenderStyle* old for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) { if (!childBox->isTableCell()) continue; - childBox->setChildNeedsLayout(); + childBox->setChildNeedsLayout(MarkOnlyThis); } } } @@ -166,10 +165,9 @@ void RenderTableRow::layout() for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isTableCell()) { - SubtreeLayoutScope layouter(child); RenderTableCell* cell = toRenderTableCell(child); if (!cell->needsLayout() && paginated && view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(cell, cell->logicalTop()) != cell->pageLogicalOffset()) - layouter.setChildNeedsLayout(cell); + cell->setChildNeedsLayout(MarkOnlyThis); if (child->needsLayout()) { cell->computeAndSetBlockDirectionMargins(table()); diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp index d55550b194e..80938ccfce4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp @@ -35,7 +35,6 @@ #include "core/rendering/RenderTableCol.h" #include "core/rendering/RenderTableRow.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "wtf/HashSet.h" #include "wtf/Vector.h" @@ -613,7 +612,6 @@ void RenderTableSection::layout() const Vector<int>& columnPos = table()->columnPositions(); - SubtreeLayoutScope layouter(this); for (unsigned r = 0; r < m_grid.size(); ++r) { Row& row = m_grid[r].row; unsigned cols = row.size(); @@ -633,7 +631,7 @@ void RenderTableSection::layout() endCol++; } int tableLayoutLogicalWidth = columnPos[endCol] - columnPos[startColumn] - table()->hBorderSpacing(); - cell->setCellLogicalWidth(tableLayoutLogicalWidth, layouter); + cell->setCellLogicalWidth(tableLayoutLogicalWidth); } if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) @@ -738,11 +736,6 @@ int RenderTableSection::distributeExtraLogicalHeightToRows(int extraLogicalHeigh return extraLogicalHeight - remainingExtraLogicalHeight; } -static bool shouldFlexCellChild(RenderObject* cellDescendant) -{ - return cellDescendant->isReplaced() || (cellDescendant->isBox() && toRenderBox(cellDescendant)->scrollsOverflow()); -} - void RenderTableSection::layoutRows() { #ifndef NDEBUG @@ -802,24 +795,33 @@ void RenderTableSection::layoutRows() bool flexAllChildren = cell->style()->logicalHeight().isFixed() || (!table()->style()->logicalHeight().isAuto() && rHeight != cell->logicalHeight()); - for (RenderObject* child = cell->firstChild(); child; child = child->nextSibling()) { - if (!child->isText() && child->style()->logicalHeight().isPercent() - && (flexAllChildren || shouldFlexCellChild(child)) - && (!child->isTable() || toRenderTable(child)->hasSections())) { - cellChildrenFlex = true; - break; + for (RenderObject* o = cell->firstChild(); o; o = o->nextSibling()) { + if (!o->isText() && o->style()->logicalHeight().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) { + // Tables with no sections do not flex. + if (!o->isTable() || toRenderTable(o)->hasSections()) { + o->setNeedsLayout(MarkOnlyThis); + cellChildrenFlex = true; + } } } - if (!cellChildrenFlex) { - if (TrackedRendererListHashSet* percentHeightDescendants = cell->percentHeightDescendants()) { - TrackedRendererListHashSet::iterator end = percentHeightDescendants->end(); - for (TrackedRendererListHashSet::iterator it = percentHeightDescendants->begin(); it != end; ++it) { - if (flexAllChildren || shouldFlexCellChild(*it)) { - cellChildrenFlex = true; + if (TrackedRendererListHashSet* percentHeightDescendants = cell->percentHeightDescendants()) { + TrackedRendererListHashSet::iterator end = percentHeightDescendants->end(); + for (TrackedRendererListHashSet::iterator it = percentHeightDescendants->begin(); it != end; ++it) { + RenderBox* box = *it; + if (!box->isReplaced() && !box->scrollsOverflow() && !flexAllChildren) + continue; + + while (box != cell) { + if (box->normalChildNeedsLayout()) + break; + box->setChildNeedsLayout(MarkOnlyThis); + box = box->containingBlock(); + ASSERT(box); + if (!box) break; - } } + cellChildrenFlex = true; } } @@ -838,15 +840,14 @@ void RenderTableSection::layoutRows() } } - SubtreeLayoutScope layouter(cell); - cell->computeIntrinsicPadding(rHeight, layouter); + cell->computeIntrinsicPadding(rHeight); LayoutRect oldCellRect = cell->frameRect(); setLogicalPositionForCell(cell, c); if (!cell->needsLayout() && view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(cell, cell->logicalTop()) != cell->pageLogicalOffset()) - layouter.setChildNeedsLayout(cell); + cell->setChildNeedsLayout(MarkOnlyThis); cell->layoutIfNeeded(); diff --git a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.cpp b/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.cpp deleted file mode 100644 index c3bfefe745a..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/rendering/SubtreeLayoutScope.h" - -#include "core/page/FrameView.h" -#include "core/rendering/RenderObject.h" - -namespace WebCore { - -SubtreeLayoutScope::SubtreeLayoutScope(RenderObject* root) - : m_root(root) -{ - RELEASE_ASSERT(m_root->document()->view()->isInLayout()); -} - -SubtreeLayoutScope::~SubtreeLayoutScope() -{ - RELEASE_ASSERT(!m_root->needsLayout()); - -#ifndef NDEBUG - for (HashSet<RenderObject*>::iterator it = m_renderersToLayout.begin(); it != m_renderersToLayout.end(); ++it) { - RenderObject* renderer = *it; - // FIXME: Thie patter is really common. Move it into an assertRendererLaidOut function. - if (renderer->needsLayout()) - showRenderTree(renderer); - ASSERT(!renderer->needsLayout()); - } -#endif -} - -void SubtreeLayoutScope::setNeedsLayout(RenderObject* descendant) -{ - ASSERT(descendant->isDescendantOf(m_root)); - descendant->setNeedsLayout(MarkContainingBlockChain, this); -} - -void SubtreeLayoutScope::setChildNeedsLayout(RenderObject* descendant) -{ - ASSERT(descendant->isDescendantOf(m_root)); - descendant->setChildNeedsLayout(MarkContainingBlockChain, this); -} - -void SubtreeLayoutScope::addRendererToLayout(RenderObject* renderer) -{ -#ifndef NDEBUG - m_renderersToLayout.add(renderer); -#endif -} - -} diff --git a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.h b/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.h deleted file mode 100644 index 792fb7f6a1b..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SubtreeLayoutScope_h -#define SubtreeLayoutScope_h - -#include "wtf/HashSet.h" - -// This is the way to mark a subtree as needing layout during layout, -// e.g. for the purposes of doing a multipass layout. -// -// It should only be used during layout. Outside of layout, you should -// just call renderer->setNeedsLayout() directly. -// -// It ensures that you don't accidentally mark part of the tree as -// needing layout and not actually lay it out. - -// FIXME: Assert that this is only used during layout and that -// MarkOnlyThis is never used outside of layout. - -namespace WebCore { - -class RenderObject; - -class SubtreeLayoutScope { -public: - SubtreeLayoutScope(RenderObject* root); - ~SubtreeLayoutScope(); - - void setNeedsLayout(RenderObject* descendant); - void setChildNeedsLayout(RenderObject* descendant); - - RenderObject* root() { return m_root; } - void addRendererToLayout(RenderObject* renderer); - -private: - RenderObject* m_root; - -#ifndef NDEBUG - HashSet<RenderObject*> m_renderersToLayout; -#endif -}; - -} - -#endif diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.cpp deleted file mode 100644 index a57958071a0..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/rendering/shapes/RasterShape.h" - -#include "core/rendering/shapes/ShapeInterval.h" -#include "wtf/MathExtras.h" - -namespace WebCore { - -IntRect RasterShapeIntervals::bounds() const -{ - if (!m_bounds) - m_bounds = adoptPtr(new IntRect(m_region.bounds())); - return *m_bounds; -} - -void RasterShapeIntervals::addInterval(int y, int x1, int x2) -{ - m_region.unite(Region(IntRect(x1, y, x2 - x1, 1))); - m_bounds.clear(); -} - -static inline IntRect alignedRect(IntRect r, int y1, int y2) -{ - return IntRect(r.x(), y1, r.width(), y2 - y1); -} - -void RasterShapeIntervals::getIncludedIntervals(int y1, int y2, SegmentList& result) const -{ - ASSERT(y2 >= y1); - - IntRect lineRect(bounds().x(), y1, bounds().width(), y2 - y1); - Region lineRegion(lineRect); - lineRegion.intersect(m_region); - if (lineRegion.isEmpty()) - return; - - Vector<IntRect> lineRects = lineRegion.rects(); - ASSERT(lineRects.size() > 0); - - Region segmentsRegion(lineRect); - Region intervalsRegion; - - // The loop below uses Regions to compute the intersection of the horizontal - // shape intervals that fall within the line's box. - - int lineY = lineRects[0].y(); - for (unsigned i = 0; i < lineRects.size(); ++i) { - if (lineRects[i].y() != lineY) { - segmentsRegion.intersect(intervalsRegion); - intervalsRegion = Region(); - } - intervalsRegion.unite(Region(alignedRect(lineRects[i], y1, y2))); - lineY = lineRects[i].y(); - } - if (!intervalsRegion.isEmpty()) - segmentsRegion.intersect(intervalsRegion); - - Vector<IntRect> segmentRects = segmentsRegion.rects(); - for (unsigned i = 0; i < segmentRects.size(); ++i) - result.append(LineSegment(segmentRects[i].x(), segmentRects[i].maxX())); -} - -const RasterShapeIntervals& RasterShape::marginIntervals() const -{ - ASSERT(shapeMargin() >= 0); - if (!shapeMargin()) - return *m_intervals; - - // FIXME: add support for non-zero margin, see https://code.google.com/p/chromium/issues/detail?id=252737. - return *m_intervals; -} - -const RasterShapeIntervals& RasterShape::paddingIntervals() const -{ - ASSERT(shapePadding() >= 0); - if (!shapePadding()) - return *m_intervals; - - // FIXME: add support for non-zero padding, see https://code.google.com/p/chromium/issues/detail?id=252737. - return *m_intervals; -} - -void RasterShape::getExcludedIntervals(LayoutUnit, LayoutUnit, SegmentList&) const -{ - // FIXME: this method is only a stub, see https://code.google.com/p/chromium/issues/detail?id=252737. -} - -void RasterShape::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const -{ - const RasterShapeIntervals& intervals = paddingIntervals(); - if (intervals.isEmpty()) - return; - - float y1 = logicalTop; - float y2 = logicalTop + logicalHeight; - - if (y1 < intervals.bounds().y() || y2 > intervals.bounds().maxY()) - return; - - intervals.getIncludedIntervals(y1, y2, result); -} - -bool RasterShape::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTop, const LayoutSize& minLogicalIntervalSize, LayoutUnit& result) const -{ - float minIntervalTop = minLogicalIntervalTop; - float minIntervalHeight = minLogicalIntervalSize.height(); - float minIntervalWidth = minLogicalIntervalSize.width(); - - const RasterShapeIntervals& intervals = paddingIntervals(); - if (intervals.isEmpty() || minIntervalWidth > intervals.bounds().width()) - return false; - - float minY = std::max<float>(intervals.bounds().y(), minIntervalTop); - float maxY = minY + minIntervalHeight; - - if (maxY > intervals.bounds().maxY()) - return false; - - // FIXME: complete this method, see https://code.google.com/p/chromium/issues/detail?id=252737. - - result = minY; - return true; -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.h b/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.h deleted file mode 100644 index 84bed9cf25d..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RasterShape_h -#define RasterShape_h - -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/Region.h" -#include "core/rendering/shapes/Shape.h" -#include "wtf/Assertions.h" -#include "wtf/Vector.h" - -namespace WebCore { - -class RasterShapeIntervals { -public: - RasterShapeIntervals() { } - - IntRect bounds() const; - bool isEmpty() const { return m_region.isEmpty(); } - void addInterval(int y, int x1, int x2); - void getIncludedIntervals(int y1, int y2, SegmentList&) const; - -private: - Region m_region; - mutable OwnPtr<IntRect> m_bounds; // Cached value of m_region.bounds(). -}; - -class RasterShape : public Shape { - WTF_MAKE_NONCOPYABLE(RasterShape); -public: - RasterShape(PassOwnPtr<RasterShapeIntervals> intervals) - : Shape() - , m_intervals(intervals) - { - } - - virtual LayoutRect shapeMarginLogicalBoundingBox() const OVERRIDE { return static_cast<LayoutRect>(marginIntervals().bounds()); } - virtual LayoutRect shapePaddingLogicalBoundingBox() const OVERRIDE { return static_cast<LayoutRect>(paddingIntervals().bounds()); } - virtual bool isEmpty() const OVERRIDE { return m_intervals->isEmpty(); } - virtual void getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList&) const OVERRIDE; - virtual void getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList&) const OVERRIDE; - virtual bool firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTop, const LayoutSize& minLogicalIntervalSize, LayoutUnit&) const OVERRIDE; - -private: - const RasterShapeIntervals& marginIntervals() const; - const RasterShapeIntervals& paddingIntervals() const; - - OwnPtr<RasterShapeIntervals> m_intervals; -}; - -} // namespace WebCore - -#endif // RasterShape_h diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp index b325c073aa5..60d003bad86 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp @@ -31,12 +31,9 @@ #include "core/rendering/shapes/Shape.h" #include "core/css/LengthFunctions.h" -#include "core/fetch/ImageResource.h" #include "core/platform/graphics/FloatSize.h" -#include "core/platform/graphics/ImageBuffer.h" #include "core/platform/graphics/WindRule.h" #include "core/rendering/shapes/PolygonShape.h" -#include "core/rendering/shapes/RasterShape.h" #include "core/rendering/shapes/RectangleShape.h" #include "wtf/MathExtras.h" #include "wtf/OwnPtr.h" @@ -201,45 +198,4 @@ PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS return shape.release(); } -PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float threshold, const LayoutSize&, WritingMode writingMode, Length margin, Length padding) -{ - ASSERT(styleImage && styleImage->isImageResource() && styleImage->cachedImage() && styleImage->cachedImage()->image()); - - OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals()); - - Image* image = styleImage->cachedImage()->image(); - const IntSize& imageSize = image->size(); - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize); - if (imageBuffer) { - GraphicsContext* graphicsContext = imageBuffer->context(); - graphicsContext->drawImage(image, IntPoint()); - - RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImageData(IntRect(IntPoint(), imageSize)); - unsigned pixelArrayLength = pixelArray->length(); - unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. - uint8_t alphaPixelThreshold = threshold * 255; - - ASSERT(static_cast<unsigned>(imageSize.width() * imageSize.height() * 4) == pixelArrayLength); - - for (int y = 0; y < imageSize.height(); ++y) { - int startX = -1; - for (int x = 0; x < imageSize.width() && pixelArrayOffset < pixelArrayLength; ++x, pixelArrayOffset += 4) { - uint8_t alpha = pixelArray->item(pixelArrayOffset); - if ((startX == -1) && alpha > alphaPixelThreshold) { - startX = x; - } else if (startX != -1 && (alpha <= alphaPixelThreshold || x == imageSize.width() - 1)) { - intervals->addInterval(y, startX, x); - startX = -1; - } - } - } - } - - OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release())); - rasterShape->m_writingMode = writingMode; - rasterShape->m_margin = floatValueForLength(margin, 0); - rasterShape->m_padding = floatValueForLength(padding, 0); - return rasterShape.release(); -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h index b1ea954b3fd..6e257c96e54 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h @@ -33,7 +33,6 @@ #include "core/platform/graphics/LayoutRect.h" #include "core/platform/text/WritingMode.h" #include "core/rendering/style/BasicShapes.h" -#include "core/rendering/style/StyleImage.h" #include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" @@ -61,7 +60,6 @@ typedef Vector<LineSegment> SegmentList; class Shape { public: static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, Length margin, Length padding); - static PassOwnPtr<Shape> createShape(const StyleImage*, float threshold, const LayoutSize& logicalBoxSize, WritingMode, Length margin, Length padding); virtual ~Shape() { } diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp index 54f97abf40f..78341a38445 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp @@ -41,26 +41,12 @@ const Shape* ShapeInfo<RenderType, shapeGetter, intervalGetter>::computedShape() if (Shape* shape = m_shape.get()) return shape; - const LayoutSize logicalBoxSize(m_shapeLogicalWidth, m_shapeLogicalHeight); - WritingMode writingMode = m_renderer->style()->writingMode(); - Length margin = m_renderer->style()->shapeMargin(); - Length padding = m_renderer->style()->shapePadding(); - const ShapeValue* shapeValue = (m_renderer->style()->*shapeGetter)(); - ASSERT(shapeValue); + ShapeValue* shapeValue = (m_renderer->style()->*shapeGetter)(); + BasicShape* shape = (shapeValue && shapeValue->type() == ShapeValue::Shape) ? shapeValue->shape() : 0; - switch (shapeValue->type()) { - case ShapeValue::Shape: - ASSERT(shapeValue->shape()); - m_shape = Shape::createShape(shapeValue->shape(), logicalBoxSize, writingMode, margin, padding); - break; - case ShapeValue::Image: - ASSERT(shapeValue->image()); - m_shape = Shape::createShape(shapeValue->image(), 0, logicalBoxSize, writingMode, margin, padding); - break; - default: - ASSERT_NOT_REACHED(); - } + ASSERT(shape); + m_shape = Shape::createShape(shape, LayoutSize(m_shapeLogicalWidth, m_shapeLogicalHeight), m_renderer->style()->writingMode(), m_renderer->style()->shapeMargin(), m_renderer->style()->shapePadding()); ASSERT(m_shape); return m_shape.get(); } diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp index 8c63f6c4d74..01dff4951f8 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp @@ -44,19 +44,11 @@ LineSegmentRange::LineSegmentRange(const InlineIterator& start, const InlineIter bool ShapeInsideInfo::isEnabledFor(const RenderBlock* renderer) { ShapeValue* shapeValue = renderer->style()->resolvedShapeInside(); - if (!shapeValue) + if (!shapeValue || shapeValue->type() != ShapeValue::Shape) return false; - switch (shapeValue->type()) { - case ShapeValue::Shape: - return shapeValue->shape() && shapeValue->shape()->type() != BasicShape::BasicShapeInsetRectangleType; - case ShapeValue::Image: - return shapeValue->isImageValid(); - case ShapeValue::Outside: - return false; - } - - return false; + BasicShape* shape = shapeValue->shape(); + return shape && shape->type() != BasicShape::BasicShapeInsetRectangleType; } bool ShapeInsideInfo::adjustLogicalLineTop(float minSegmentWidth) diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp index ed58e303568..76f52ddc461 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp @@ -35,20 +35,8 @@ namespace WebCore { bool ShapeOutsideInfo::isEnabledFor(const RenderBox* box) { - ShapeValue* shapeValue = box->style()->shapeOutside(); - if (!box->isFloatingWithShapeOutside() || !shapeValue) - return false; - - switch (shapeValue->type()) { - case ShapeValue::Shape: - return shapeValue->shape(); - case ShapeValue::Image: - return false; - case ShapeValue::Outside: - return false; - } - - return false; + ShapeValue* value = box->style()->shapeOutside(); + return box->isFloatingWithShapeOutside() && value->type() == ShapeValue::Shape && value->shape(); } bool ShapeOutsideInfo::computeSegmentsForContainingBlockLine(LayoutUnit lineTop, LayoutUnit floatTop, LayoutUnit lineHeight) diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp index 093d796b6e7..9d20a1c666a 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp @@ -36,7 +36,7 @@ void KeyframeValue::addProperties(const StylePropertySet* propertySet) CSSPropertyID property = propertySet->propertyAt(i).id(); // Timing-function within keyframes is special, because it is not animated; it just // describes the timing function between this keyframe and the next. - if (property != CSSPropertyWebkitAnimationTimingFunction && property != CSSPropertyAnimationTimingFunction) + if (property != CSSPropertyWebkitAnimationTimingFunction) addProperty(property); } } diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h index 4d5e207317b..5a5cf92ec04 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h @@ -40,7 +40,7 @@ class StylePropertySet; class KeyframeValue { public: - KeyframeValue(double key, PassRefPtr<RenderStyle> style) + KeyframeValue(float key, PassRefPtr<RenderStyle> style) : m_key(key) , m_style(style) { @@ -51,14 +51,14 @@ public: bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); } const HashSet<CSSPropertyID>& properties() const { return m_properties; } - double key() const { return m_key; } - void setKey(double key) { m_key = key; } + float key() const { return m_key; } + void setKey(float key) { m_key = key; } const RenderStyle* style() const { return m_style.get(); } void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } private: - double m_key; + float m_key; HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe. RefPtr<RenderStyle> m_style; }; diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp index bc5c3399257..4ec55815a8f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp @@ -169,10 +169,7 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const || stroke->paintUri != other->stroke->paintUri || stroke->miterLimit != other->stroke->miterLimit || stroke->dashArray != other->stroke->dashArray - || stroke->dashOffset != other->stroke->dashOffset - || stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintColor - || stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri - || stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintType) + || stroke->dashOffset != other->stroke->dashOffset) return StyleDifferenceLayout; // Only the stroke-opacity case remains, where we only need a repaint. diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h index bb71dab440a..b72d2518665 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h @@ -30,7 +30,6 @@ #ifndef ShapeValue_h #define ShapeValue_h -#include "core/fetch/ImageResource.h" #include "core/rendering/style/BasicShapes.h" #include "core/rendering/style/StyleImage.h" #include "wtf/PassRefPtr.h" @@ -63,12 +62,9 @@ public: ShapeValueType type() const { return m_type; } BasicShape* shape() const { return m_shape.get(); } - StyleImage* image() const { return m_image.get(); } - bool isImageValid() const { return image() && image()->cachedImage() && image()->cachedImage()->hasImage(); } void setImage(PassRefPtr<StyleImage> image) { - ASSERT(type() == Image); if (m_image != image) m_image = image; } diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h index 18be011b566..167821769ac 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h @@ -30,9 +30,9 @@ #ifndef StyleCustomFilterProgram_h #define StyleCustomFilterProgram_h -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/ShaderResource.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/ShaderResource.h" #include "core/platform/graphics/filters/custom/CustomFilterProgram.h" #include "core/rendering/style/StyleShader.h" #include "weborigin/KURL.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp index 31dc65a0452..e09447510e2 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp @@ -24,7 +24,7 @@ #include "config.h" #include "core/rendering/style/StyleFetchedImage.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderObject.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h index 9ea82f51778..b9effd9c2cd 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h @@ -24,8 +24,8 @@ #ifndef StyleFetchedImage_h #define StyleFetchedImage_h -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/rendering/style/StyleImage.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp index 04a8d9d5961..b9e9d52c190 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp @@ -27,7 +27,7 @@ #include "core/rendering/style/StyleFetchedImageSet.h" #include "core/css/CSSImageSetValue.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderObject.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h index 178ec3c87b0..3e431e23388 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h @@ -26,8 +26,8 @@ #ifndef StyleFetchedImageSet_h #define StyleFetchedImageSet_h -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/graphics/LayoutSize.h" #include "core/rendering/style/StyleImage.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp index 13a8b98c36a..2b6c6c24e4e 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp @@ -32,7 +32,7 @@ #include "core/rendering/style/StyleFetchedShader.h" #include "core/css/CSSPrimitiveValue.h" -#include "core/fetch/ShaderResource.h" +#include "core/loader/cache/ShaderResource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h index 104a90cc871..88e54112d14 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h @@ -30,7 +30,7 @@ #ifndef StyleFetchedShader_h #define StyleFetchedShader_h -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/rendering/style/StyleShader.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp b/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp index b2a9feb84f3..ab598e38444 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp @@ -33,8 +33,8 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSPrimitiveValueMappings.h" #include "core/dom/Element.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/platform/graphics/filters/FilterEffect.h" #include "core/platform/graphics/filters/SourceAlpha.h" #include "core/rendering/svg/RenderSVGResourceFilter.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp index 9da09f9d9f0..92a96dd3949 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp @@ -127,7 +127,7 @@ bool RenderSVGResourceClipper::pathOnlyClipping(GraphicsContext* context, const } } // Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary. - if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); @@ -152,7 +152,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons m_clipper.set(object, new ClipperData); bool shouldCreateClipData = false; - AffineTransform animatedLocalTransform = toSVGClipPathElement(node())->animatedLocalTransform(); + AffineTransform animatedLocalTransform = static_cast<SVGClipPathElement*>(node())->animatedLocalTransform(); ClipperData* clipperData = m_clipper.get(object); if (!clipperData->clipMaskImage) { if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox)) @@ -208,7 +208,8 @@ bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData ASSERT(maskContext); AffineTransform maskContentTransformation; - if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node()); + if (clipPath->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { maskContentTransformation.translate(objectBoundingBox.x(), objectBoundingBox.y()); maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); maskContext->concatCTM(maskContentTransformation); @@ -276,7 +277,7 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect() continue; m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates())); } - m_clipBoundaries = toSVGClipPathElement(node())->animatedLocalTransform().mapRect(m_clipBoundaries); + m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTransform().mapRect(m_clipBoundaries); } bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) @@ -285,7 +286,7 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin if (!SVGRenderSupport::pointInClippingArea(this, point)) return false; - SVGClipPathElement* clipPathElement = toSVGClipPathElement(node()); + SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node()); if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); @@ -319,7 +320,7 @@ FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) if (m_clipBoundaries.isEmpty()) calculateClipContentRepaintRect(); - if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { FloatRect objectBoundingBox = object->objectBoundingBox(); AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h index 69ee9865220..32e4971c9fe 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h @@ -52,7 +52,7 @@ public: bool hitTestClipContent(const FloatRect&, const FloatPoint&); - SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElement(node())->clipPathUnitsCurrentValue(); } + SVGUnitTypes::SVGUnitType clipPathUnits() const { return static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue(); } static RenderSVGResourceType s_resourceType; private: diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp index f2068b80ac5..a1fbae363e6 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp @@ -35,7 +35,7 @@ RenderSVGTextPath::RenderSVGTextPath(Element* element) Path RenderSVGTextPath::layoutPath() const { - SVGTextPathElement* textPathElement = toSVGTextPathElement(node()); + SVGTextPathElement* textPathElement = static_cast<SVGTextPathElement*>(node()); Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->hrefCurrentValue(), textPathElement->document()); if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag)) return Path(); @@ -56,17 +56,17 @@ Path RenderSVGTextPath::layoutPath() const float RenderSVGTextPath::startOffset() const { - return toSVGTextPathElement(node())->startOffsetCurrentValue().valueAsPercentage(); + return static_cast<SVGTextPathElement*>(node())->startOffsetCurrentValue().valueAsPercentage(); } bool RenderSVGTextPath::exactAlignment() const { - return toSVGTextPathElement(node())->spacingCurrentValue() == SVGTextPathSpacingExact; + return static_cast<SVGTextPathElement*>(node())->spacingCurrentValue() == SVGTextPathSpacingExact; } bool RenderSVGTextPath::stretchMethod() const { - return toSVGTextPathElement(node())->methodCurrentValue() == SVGTextPathMethodStretch; + return static_cast<SVGTextPathElement*>(node())->methodCurrentValue() == SVGTextPathMethodStretch; } } |