Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1184)

Unified Diff: Source/core/rendering/line/LineWidth.cpp

Issue 460103002: Refactor ShapeOutsideInfo so it isn't mutated for each line (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for review comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/FloatingObjects.cpp ('k') | Source/core/rendering/shapes/ShapeOutsideInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/line/LineWidth.cpp
diff --git a/Source/core/rendering/line/LineWidth.cpp b/Source/core/rendering/line/LineWidth.cpp
index 7d763358f5e5ceef2d0a7bad3c66758c4271fb5e..fe51d904433a7cbd9e21a4e6a11cb16c1be2125c 100644
--- a/Source/core/rendering/line/LineWidth.cpp
+++ b/Source/core/rendering/line/LineWidth.cpp
@@ -66,17 +66,17 @@ void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat
if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logicalBottomForFloat(newFloat))
return;
- ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo();
- if (shapeOutsideInfo) {
+ ShapeOutsideDeltas shapeDeltas;
+ if (ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo()) {
LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
- shapeOutsideInfo->updateDeltasForContainingBlockLine(m_block, *newFloat, m_block.logicalHeight(), lineHeight);
+ shapeDeltas = shapeOutsideInfo->computeDeltasForContainingBlockLine(m_block, *newFloat, m_block.logicalHeight(), lineHeight);
}
if (newFloat->type() == FloatingObject::FloatLeft) {
float newLeft = m_block.logicalRightForFloat(newFloat).toFloat();
- if (shapeOutsideInfo) {
- if (shapeOutsideInfo->lineOverlapsShape())
- newLeft += shapeOutsideInfo->rightMarginBoxDelta();
+ if (shapeDeltas.isValid()) {
+ if (shapeDeltas.lineOverlapsShape())
+ newLeft += shapeDeltas.rightMarginBoxDelta();
else // Per the CSS Shapes spec, If the line doesn't overlap the shape, then ignore this shape for this line.
newLeft = m_left;
}
@@ -85,9 +85,9 @@ void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat
m_left = std::max<float>(m_left, newLeft);
} else {
float newRight = m_block.logicalLeftForFloat(newFloat).toFloat();
- if (shapeOutsideInfo) {
- if (shapeOutsideInfo->lineOverlapsShape())
- newRight += shapeOutsideInfo->leftMarginBoxDelta();
+ if (shapeDeltas.isValid()) {
+ if (shapeDeltas.lineOverlapsShape())
+ newRight += shapeDeltas.leftMarginBoxDelta();
else // Per the CSS Shapes spec, If the line doesn't overlap the shape, then ignore this shape for this line.
newRight = m_right;
}
« no previous file with comments | « Source/core/rendering/FloatingObjects.cpp ('k') | Source/core/rendering/shapes/ShapeOutsideInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698