| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Negative margins can cause our height to shrink below our minimal height
(border/padding). | 185 // Negative margins can cause our height to shrink below our minimal height
(border/padding). |
| 186 // If this happens, ensure that the computed height is increased to the mini
mal height. | 186 // If this happens, ensure that the computed height is increased to the mini
mal height. |
| 187 setLogicalHeight(std::max(logicalHeight() + afterEdge, beforeEdge + afterEdg
e)); | 187 setLogicalHeight(std::max(logicalHeight() + afterEdge, beforeEdge + afterEdg
e)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void RenderBlockFlow::adjustPositionedBlock(RenderBox* child) | 190 void RenderBlockFlow::adjustPositionedBlock(RenderBox* child) |
| 191 { | 191 { |
| 192 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(); | 192 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(); |
| 193 | 193 |
| 194 LayoutUnit logicalTop = logicalHeight(); | 194 LayoutUnit logicalTop = logicalHeight(); |
| 195 updateStaticInlinePositionForChild(child, logicalTop); | 195 updateStaticInlinePositionForChild(child); |
| 196 | 196 |
| 197 RenderLayer* childLayer = child->layer(); | 197 RenderLayer* childLayer = child->layer(); |
| 198 if (childLayer->staticBlockPosition() != logicalTop) { | 198 if (childLayer->staticBlockPosition() != logicalTop) { |
| 199 childLayer->setStaticBlockPosition(logicalTop); | 199 childLayer->setStaticBlockPosition(logicalTop); |
| 200 if (hasStaticBlockPosition) | 200 if (hasStaticBlockPosition) |
| 201 child->setChildNeedsLayout(MarkOnlyThis); | 201 child->setChildNeedsLayout(MarkOnlyThis); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() | 205 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() |
| 206 { | 206 { |
| 207 RootInlineBox* rootBox = createRootInlineBox(); | 207 RootInlineBox* rootBox = createRootInlineBox(); |
| 208 m_lineBoxes.appendLineBox(rootBox); | 208 m_lineBoxes.appendLineBox(rootBox); |
| 209 | 209 |
| 210 return rootBox; | 210 return rootBox; |
| 211 } | 211 } |
| 212 | 212 |
| 213 void RenderBlockFlow::deleteLineBoxTree() | 213 void RenderBlockFlow::deleteLineBoxTree() |
| 214 { | 214 { |
| 215 m_lineBoxes.deleteLineBoxTree(); | 215 m_lineBoxes.deleteLineBoxTree(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou
tUnit logicalTop) | 218 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child) |
| 219 { | 219 { |
| 220 if (child->style()->isOriginalDisplayInlineType()) | 220 if (child->style()->isOriginalDisplayInlineType()) |
| 221 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical
Top, false)); | 221 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(false))
; |
| 222 else | 222 else |
| 223 setStaticInlinePositionForChild(child, startOffsetForContent()); | 223 setStaticInlinePositionForChild(child, startOffsetForContent()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it inlinePosition) | 226 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it inlinePosition) |
| 227 { | 227 { |
| 228 child->layer()->setStaticInlinePosition(inlinePosition); | 228 child->layer()->setStaticInlinePosition(inlinePosition); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild
) | 231 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild
) |
| 232 { | 232 { |
| 233 RenderBlock::addChild(newChild, beforeChild); | 233 RenderBlock::addChild(newChild, beforeChild); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo
l fullRemoveInsert) | |
| 237 { | |
| 238 // FIXME(sky): Merge this into callers. | |
| 239 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); | |
| 240 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); | |
| 241 } | |
| 242 | |
| 243 void RenderBlockFlow::invalidatePaintForOverflow() | 236 void RenderBlockFlow::invalidatePaintForOverflow() |
| 244 { | 237 { |
| 245 // FIXME: We could tighten up the left and right invalidation points if we l
et layoutInlineChildren fill them in based off the particular lines | 238 // FIXME: We could tighten up the left and right invalidation points if we l
et layoutInlineChildren fill them in based off the particular lines |
| 246 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. | 239 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. |
| 247 LayoutUnit paintInvalidationLogicalLeft = logicalLeftVisualOverflow(); | 240 LayoutUnit paintInvalidationLogicalLeft = logicalLeftVisualOverflow(); |
| 248 LayoutUnit paintInvalidationLogicalRight = logicalRightVisualOverflow(); | 241 LayoutUnit paintInvalidationLogicalRight = logicalRightVisualOverflow(); |
| 249 if (hasOverflowClip()) { | 242 if (hasOverflowClip()) { |
| 250 // 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. | 243 // 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. |
| 251 // 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. | 244 // 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. |
| 252 // layoutInlineChildren should be patched to compute the entire paint in
validation rect. | 245 // layoutInlineChildren should be patched to compute the entire paint in
validation rect. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 269 // Hits in media/event-attributes.html | 262 // Hits in media/event-attributes.html |
| 270 DisableCompositingQueryAsserts disabler; | 263 DisableCompositingQueryAsserts disabler; |
| 271 | 264 |
| 272 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. | 265 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. |
| 273 } | 266 } |
| 274 | 267 |
| 275 m_paintInvalidationLogicalTop = 0; | 268 m_paintInvalidationLogicalTop = 0; |
| 276 m_paintInvalidationLogicalBottom = 0; | 269 m_paintInvalidationLogicalBottom = 0; |
| 277 } | 270 } |
| 278 | 271 |
| 279 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, bool preservePhase) | |
| 280 { | |
| 281 // FIXME(sky): Remove this. | |
| 282 } | |
| 283 | |
| 284 LayoutUnit RenderBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi
calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin
g) const | |
| 285 { | |
| 286 // FIXME(sky): Remove this. | |
| 287 LayoutUnit offset = fixedOffset; | |
| 288 return adjustLogicalLeftOffsetForLine(offset, applyTextIndent); | |
| 289 } | |
| 290 | |
| 291 LayoutUnit RenderBlockFlow::logicalRightOffsetForPositioningFloat(LayoutUnit log
icalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaini
ng) const | |
| 292 { | |
| 293 // FIXME(sky): Remove this. | |
| 294 LayoutUnit offset = fixedOffset; | |
| 295 return adjustLogicalRightOffsetForLine(offset, applyTextIndent); | |
| 296 } | |
| 297 | |
| 298 LayoutUnit RenderBlockFlow::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFrom
Floats, bool applyTextIndent) const | |
| 299 { | |
| 300 LayoutUnit left = offsetFromFloats; | |
| 301 | |
| 302 if (applyTextIndent && style()->isLeftToRightDirection()) | |
| 303 left += textIndentOffset(); | |
| 304 | |
| 305 return left; | |
| 306 } | |
| 307 | |
| 308 LayoutUnit RenderBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFro
mFloats, bool applyTextIndent) const | |
| 309 { | |
| 310 LayoutUnit right = offsetFromFloats; | |
| 311 | |
| 312 if (applyTextIndent && !style()->isLeftToRightDirection()) | |
| 313 right -= textIndentOffset(); | |
| 314 | |
| 315 return right; | |
| 316 } | |
| 317 | |
| 318 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) | |
| 319 { | |
| 320 // FIXME(sky): Remove this. | |
| 321 return false; | |
| 322 } | |
| 323 | |
| 324 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | |
| 325 { | |
| 326 // FIXME(sky): remove this. | |
| 327 return fixedOffset; | |
| 328 } | |
| 329 | |
| 330 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop
, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | |
| 331 { | |
| 332 // FIXME(sky): remove this. | |
| 333 return fixedOffset; | |
| 334 } | |
| 335 | |
| 336 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const Layo
utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 272 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const Layo
utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
| 337 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog
icalRight, const PaintInfo* paintInfo) | 273 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog
icalRight, const PaintInfo* paintInfo) |
| 338 { | 274 { |
| 339 GapRects result; | 275 GapRects result; |
| 340 | 276 |
| 341 bool containsStart = selectionState() == SelectionStart || selectionState()
== SelectionBoth; | 277 bool containsStart = selectionState() == SelectionStart || selectionState()
== SelectionBoth; |
| 342 | 278 |
| 343 if (!firstLineBox()) { | 279 if (!firstLineBox()) { |
| 344 if (containsStart) { | 280 if (containsStart) { |
| 345 // Go ahead and update our lastLogicalTop to be the bottom of the bl
ock. <hr>s or empty blocks with height can trip this | 281 // Go ahead and update our lastLogicalTop to be the bottom of the bl
ock. <hr>s or empty blocks with height can trip this |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // Go ahead and update our lastY to be the bottom of the last selected l
ine. | 319 // Go ahead and update our lastY to be the bottom of the last selected l
ine. |
| 384 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) +
lastSelectedLine->selectionBottom(); | 320 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) +
lastSelectedLine->selectionBottom(); |
| 385 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine
->selectionBottom()); | 321 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine
->selectionBottom()); |
| 386 lastLogicalRight = logicalRightSelectionOffset(rootBlock, lastSelectedLi
ne->selectionBottom()); | 322 lastLogicalRight = logicalRightSelectionOffset(rootBlock, lastSelectedLi
ne->selectionBottom()); |
| 387 } | 323 } |
| 388 return result; | 324 return result; |
| 389 } | 325 } |
| 390 | 326 |
| 391 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) | 327 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) |
| 392 { | 328 { |
| 393 LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false); | 329 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); |
| 394 if (logicalLeft == logicalLeftOffsetForContent()) | 330 if (logicalLeft == logicalLeftOffsetForContent()) |
| 395 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); | 331 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); |
| 396 | 332 |
| 397 RenderBlock* cb = this; | 333 RenderBlock* cb = this; |
| 398 while (cb != rootBlock) { | 334 while (cb != rootBlock) { |
| 399 logicalLeft += cb->logicalLeft(); | 335 logicalLeft += cb->logicalLeft(); |
| 400 cb = cb->containingBlock(); | 336 cb = cb->containingBlock(); |
| 401 } | 337 } |
| 402 return logicalLeft; | 338 return logicalLeft; |
| 403 } | 339 } |
| 404 | 340 |
| 405 LayoutUnit RenderBlockFlow::logicalRightSelectionOffset(RenderBlock* rootBlock,
LayoutUnit position) | 341 LayoutUnit RenderBlockFlow::logicalRightSelectionOffset(RenderBlock* rootBlock,
LayoutUnit position) |
| 406 { | 342 { |
| 407 LayoutUnit logicalRight = logicalRightOffsetForLine(position, false); | 343 LayoutUnit logicalRight = logicalRightOffsetForLine(false); |
| 408 if (logicalRight == logicalRightOffsetForContent()) | 344 if (logicalRight == logicalRightOffsetForContent()) |
| 409 return RenderBlock::logicalRightSelectionOffset(rootBlock, position); | 345 return RenderBlock::logicalRightSelectionOffset(rootBlock, position); |
| 410 | 346 |
| 411 RenderBlock* cb = this; | 347 RenderBlock* cb = this; |
| 412 while (cb != rootBlock) { | 348 while (cb != rootBlock) { |
| 413 logicalRight += cb->logicalLeft(); | 349 logicalRight += cb->logicalLeft(); |
| 414 cb = cb->containingBlock(); | 350 cb = cb->containingBlock(); |
| 415 } | 351 } |
| 416 return logicalRight; | 352 return logicalRight; |
| 417 } | 353 } |
| 418 | 354 |
| 419 RootInlineBox* RenderBlockFlow::createRootInlineBox() | 355 RootInlineBox* RenderBlockFlow::createRootInlineBox() |
| 420 { | 356 { |
| 421 return new RootInlineBox(*this); | 357 return new RootInlineBox(*this); |
| 422 } | 358 } |
| 423 | 359 |
| 424 } // namespace blink | 360 } // namespace blink |
| OLD | NEW |