| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // Hits in media/event-attributes.html | 253 // Hits in media/event-attributes.html |
| 254 DisableCompositingQueryAsserts disabler; | 254 DisableCompositingQueryAsserts disabler; |
| 255 | 255 |
| 256 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. | 256 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. |
| 257 } | 257 } |
| 258 | 258 |
| 259 m_paintInvalidationLogicalTop = 0; | 259 m_paintInvalidationLogicalTop = 0; |
| 260 m_paintInvalidationLogicalBottom = 0; | 260 m_paintInvalidationLogicalBottom = 0; |
| 261 } | 261 } |
| 262 | 262 |
| 263 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const Layo
utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | |
| 264 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog
icalRight, const PaintInfo* paintInfo) | |
| 265 { | |
| 266 GapRects result; | |
| 267 | |
| 268 bool containsStart = selectionState() == SelectionStart || selectionState()
== SelectionBoth; | |
| 269 | |
| 270 if (!firstLineBox()) { | |
| 271 if (containsStart) { | |
| 272 // Go ahead and update our lastLogicalTop to be the bottom of the bl
ock. <hr>s or empty blocks with height can trip this | |
| 273 // case. | |
| 274 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock
) + logicalHeight(); | |
| 275 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, logicalHeigh
t()); | |
| 276 lastLogicalRight = logicalRightSelectionOffset(rootBlock, logicalHei
ght()); | |
| 277 } | |
| 278 return result; | |
| 279 } | |
| 280 | |
| 281 RootInlineBox* lastSelectedLine = 0; | |
| 282 RootInlineBox* curr; | |
| 283 for (curr = firstRootBox(); curr && !curr->hasSelectedChildren(); curr = cur
r->nextRootBox()) { } | |
| 284 | |
| 285 // Now paint the gaps for the lines. | |
| 286 for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) { | |
| 287 LayoutUnit selTop = curr->selectionTopAdjustedForPrecedingBlock(); | |
| 288 LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock(); | |
| 289 | |
| 290 if (!containsStart && !lastSelectedLine && selectionState() != Selection
Start && selectionState() != SelectionBoth) { | |
| 291 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPos
ition, offsetFromRootBlock, lastLogicalTop, | |
| 292 lastLogicalLeft, lastLogicalRight, selTop, paintInfo)); | |
| 293 } | |
| 294 | |
| 295 LayoutRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth()
, selTop + selHeight); | |
| 296 logicalRect.move(offsetFromRootBlock); | |
| 297 LayoutRect physicalRect = rootBlock->logicalRectToPhysicalRect(rootBlock
PhysicalPosition, logicalRect); | |
| 298 if (!paintInfo || (physicalRect.y() < paintInfo->rect.maxY() && physical
Rect.maxY() > paintInfo->rect.y())) | |
| 299 result.unite(curr->lineSelectionGap(rootBlock, rootBlockPhysicalPosi
tion, offsetFromRootBlock, selTop, selHeight, paintInfo)); | |
| 300 | |
| 301 lastSelectedLine = curr; | |
| 302 } | |
| 303 | |
| 304 if (containsStart && !lastSelectedLine) { | |
| 305 // VisibleSelection must start just after our last line. | |
| 306 lastSelectedLine = lastRootBox(); | |
| 307 } | |
| 308 | |
| 309 if (lastSelectedLine && selectionState() != SelectionEnd && selectionState()
!= SelectionBoth) { | |
| 310 // Go ahead and update our lastY to be the bottom of the last selected l
ine. | |
| 311 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) +
lastSelectedLine->selectionBottom(); | |
| 312 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine
->selectionBottom()); | |
| 313 lastLogicalRight = logicalRightSelectionOffset(rootBlock, lastSelectedLi
ne->selectionBottom()); | |
| 314 } | |
| 315 return result; | |
| 316 } | |
| 317 | |
| 318 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) | 263 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) |
| 319 { | 264 { |
| 320 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); | 265 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); |
| 321 if (logicalLeft == logicalLeftOffsetForContent()) | 266 if (logicalLeft == logicalLeftOffsetForContent()) |
| 322 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); | 267 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); |
| 323 | 268 |
| 324 RenderBlock* cb = this; | 269 RenderBlock* cb = this; |
| 325 while (cb != rootBlock) { | 270 while (cb != rootBlock) { |
| 326 logicalLeft += cb->logicalLeft(); | 271 logicalLeft += cb->logicalLeft(); |
| 327 cb = cb->containingBlock(); | 272 cb = cb->containingBlock(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 float logicalLeft = logicalLeftOffsetForLine(false).toFloat(); | 404 float logicalLeft = logicalLeftOffsetForLine(false).toFloat(); |
| 460 float availableLogicalWidth = logicalRightOffsetForLine(false) - logicalLeft
; | 405 float availableLogicalWidth = logicalRightOffsetForLine(false) - logicalLeft
; |
| 461 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 406 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
| 462 | 407 |
| 463 if (!style()->isLeftToRightDirection()) | 408 if (!style()->isLeftToRightDirection()) |
| 464 return logicalWidth() - logicalLeft; | 409 return logicalWidth() - logicalLeft; |
| 465 return logicalLeft; | 410 return logicalLeft; |
| 466 } | 411 } |
| 467 | 412 |
| 468 } // namespace blink | 413 } // namespace blink |
| OLD | NEW |