OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 } | 469 } |
470 | 470 |
471 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const | 471 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const |
472 { | 472 { |
473 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); | 473 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); |
474 if (!isHorizontalWritingMode()) | 474 if (!isHorizontalWritingMode()) |
475 return portionRect.transposedRect(); | 475 return portionRect.transposedRect(); |
476 return portionRect; | 476 return portionRect; |
477 } | 477 } |
478 | 478 |
479 bool LayoutMultiColumnSet::computeColumnRuleBounds(const LayoutPoint& paintOffse t, Vector<LayoutRect>& columnRuleBounds) const | |
480 { | |
481 if (flowThread()->isLayoutPagedFlowThread()) | |
482 return false; | |
483 | |
484 const ComputedStyle& blockStyle = multiColumnBlockFlow()->styleRef(); | |
wkorman
2016/07/01 19:32:24
Maybe helpful to naive eng to link to spec in a co
chrishtr
2016/07/01 22:31:32
Done.
| |
485 bool ruleTransparent = blockStyle.columnRuleIsTransparent(); | |
486 EBorderStyle ruleStyle = blockStyle.columnRuleStyle(); | |
487 LayoutUnit ruleThickness(blockStyle.columnRuleWidth()); | |
488 LayoutUnit colGap = columnGap(); | |
489 bool renderRule = ruleStyle > BorderStyleHidden && !ruleTransparent; | |
490 if (!renderRule) | |
491 return false; | |
492 | |
493 unsigned colCount = actualColumnCount(); | |
494 if (colCount <= 1) | |
495 return false; | |
496 | |
497 bool leftToRight = style()->isLeftToRightDirection(); | |
498 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogic alWidth(); | |
499 LayoutUnit ruleAdd = borderAndPaddingLogicalLeft(); | |
500 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidt h(); | |
501 LayoutUnit inlineDirectionSize = pageLogicalWidth(); | |
502 | |
503 for (unsigned i = 0; i < colCount; i++) { | |
504 // Move to the next position. | |
505 if (leftToRight) { | |
506 ruleLogicalLeft += inlineDirectionSize + colGap / 2; | |
507 currLogicalLeftOffset += inlineDirectionSize + colGap; | |
508 } else { | |
509 ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); | |
510 currLogicalLeftOffset -= (inlineDirectionSize + colGap); | |
511 } | |
512 | |
513 // Now paint the column rule. | |
wkorman
2016/07/01 19:32:24
Update comment, just accumulating bounds vs painti
chrishtr
2016/07/01 22:31:32
Done.
| |
514 if (i < colCount - 1) { | |
515 LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft(); | |
wkorman
2016/07/01 19:32:24
nit: hard to read, maybe split into if/else block
chrishtr
2016/07/01 22:31:32
Good idea, done.
| |
516 LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleTh ickness : ruleLeft + contentWidth(); | |
517 LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + b orderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; | |
518 LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + conten tHeight() : ruleTop + ruleThickness; | |
519 | |
520 columnRuleBounds.append(LayoutRect(ruleLeft, ruleTop, ruleRight - ru leLeft, ruleBottom - ruleTop)); | |
521 } | |
522 | |
523 ruleLogicalLeft = currLogicalLeftOffset; | |
524 } | |
525 return true; | |
526 } | |
527 | |
528 LayoutRect LayoutMultiColumnSet::localOverflowRectForPaintInvalidation() const | |
529 { | |
530 LayoutRect blockFlowBounds = LayoutBlockFlow::localOverflowRectForPaintInval idation(); | |
531 | |
532 // Now add in column rule bounds, if present. | |
533 Vector<LayoutRect> columnRuleBounds; | |
534 if (computeColumnRuleBounds(LayoutPoint(), columnRuleBounds)) { | |
535 for (auto& bound : columnRuleBounds) | |
536 blockFlowBounds.unite(bound); | |
537 } | |
538 return blockFlowBounds; | |
539 } | |
540 | |
479 } // namespace blink | 541 } // namespace blink |
OLD | NEW |