| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it inlinePosition) | 217 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it inlinePosition) |
| 218 { | 218 { |
| 219 child->layer()->setStaticInlinePosition(inlinePosition); | 219 child->layer()->setStaticInlinePosition(inlinePosition); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild
) | 222 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild
) |
| 223 { | 223 { |
| 224 RenderBlock::addChild(newChild, beforeChild); | 224 RenderBlock::addChild(newChild, beforeChild); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void RenderBlockFlow::invalidatePaintForOverflow() | |
| 228 { | |
| 229 // FIXME: We could tighten up the left and right invalidation points if we l
et RenderParagraph::layoutChildren fill them in based off the particular lines | |
| 230 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. | |
| 231 LayoutUnit paintInvalidationLogicalLeft = logicalLeftVisualOverflow(); | |
| 232 LayoutUnit paintInvalidationLogicalRight = logicalRightVisualOverflow(); | |
| 233 if (hasOverflowClip()) { | |
| 234 // If we have clipped overflow, we should use layout overflow as well, s
ince visual overflow from lines didn't propagate to our block's overflow. | |
| 235 // Note the old code did this as well but even for overflow:visible. The
addition of hasOverflowClip() at least tightens up the hack a bit. | |
| 236 // RenderParagraph::layoutChildren should be patched to compute the enti
re paint invalidation rect. | |
| 237 paintInvalidationLogicalLeft = std::min(paintInvalidationLogicalLeft, lo
gicalLeftLayoutOverflow()); | |
| 238 paintInvalidationLogicalRight = std::max(paintInvalidationLogicalRight,
logicalRightLayoutOverflow()); | |
| 239 } | |
| 240 | |
| 241 LayoutRect paintInvalidationRect = LayoutRect(paintInvalidationLogicalLeft,
m_paintInvalidationLogicalTop, paintInvalidationLogicalRight - paintInvalidation
LogicalLeft, m_paintInvalidationLogicalBottom - m_paintInvalidationLogicalTop); | |
| 242 | |
| 243 if (hasOverflowClip()) { | |
| 244 // Adjust the paint invalidation rect for scroll offset | |
| 245 paintInvalidationRect.move(-scrolledContentOffset()); | |
| 246 | |
| 247 // Don't allow this rect to spill out of our overflow box. | |
| 248 paintInvalidationRect.intersect(LayoutRect(LayoutPoint(), size())); | |
| 249 } | |
| 250 | |
| 251 // Make sure the rect is still non-empty after intersecting for overflow abo
ve | |
| 252 if (!paintInvalidationRect.isEmpty()) { | |
| 253 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. | |
| 254 } | |
| 255 | |
| 256 m_paintInvalidationLogicalTop = 0; | |
| 257 m_paintInvalidationLogicalBottom = 0; | |
| 258 } | |
| 259 | |
| 260 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) | 227 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) |
| 261 { | 228 { |
| 262 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); | 229 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); |
| 263 if (logicalLeft == logicalLeftOffsetForContent()) | 230 if (logicalLeft == logicalLeftOffsetForContent()) |
| 264 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); | 231 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); |
| 265 | 232 |
| 266 RenderBlock* cb = this; | 233 RenderBlock* cb = this; |
| 267 while (cb != rootBlock) { | 234 while (cb != rootBlock) { |
| 268 logicalLeft += cb->logicalLeft(); | 235 logicalLeft += cb->logicalLeft(); |
| 269 cb = cb->containingBlock(); | 236 cb = cb->containingBlock(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 float logicalLeft = logicalLeftOffsetForLine(false).toFloat(); | 368 float logicalLeft = logicalLeftOffsetForLine(false).toFloat(); |
| 402 float availableLogicalWidth = logicalRightOffsetForLine(false) - logicalLeft
; | 369 float availableLogicalWidth = logicalRightOffsetForLine(false) - logicalLeft
; |
| 403 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 370 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
| 404 | 371 |
| 405 if (!style()->isLeftToRightDirection()) | 372 if (!style()->isLeftToRightDirection()) |
| 406 return logicalWidth() - logicalLeft; | 373 return logicalWidth() - logicalLeft; |
| 407 return logicalLeft; | 374 return logicalLeft; |
| 408 } | 375 } |
| 409 | 376 |
| 410 } // namespace blink | 377 } // namespace blink |
| OLD | NEW |