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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp

Issue 2115013002: Include column rules for LayoutMultiColumnSet paint invalidation rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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
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 // Reference: https://www.w3.org/TR/css3-multicol/#column-gaps-and-rules
485 const ComputedStyle& blockStyle = multiColumnBlockFlow()->styleRef();
486 bool ruleTransparent = blockStyle.columnRuleIsTransparent();
487 EBorderStyle ruleStyle = blockStyle.columnRuleStyle();
488 LayoutUnit ruleThickness(blockStyle.columnRuleWidth());
489 LayoutUnit colGap = columnGap();
490 bool renderRule = ruleStyle > BorderStyleHidden && !ruleTransparent;
491 if (!renderRule)
492 return false;
493
494 unsigned colCount = actualColumnCount();
495 if (colCount <= 1)
496 return false;
497
498 bool leftToRight = style()->isLeftToRightDirection();
499 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogic alWidth();
500 LayoutUnit ruleAdd = borderAndPaddingLogicalLeft();
501 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidt h();
502 LayoutUnit inlineDirectionSize = pageLogicalWidth();
503
504 for (unsigned i = 0; i < colCount; i++) {
505 // Move to the next position.
506 if (leftToRight) {
507 ruleLogicalLeft += inlineDirectionSize + colGap / 2;
508 currLogicalLeftOffset += inlineDirectionSize + colGap;
509 } else {
510 ruleLogicalLeft -= (inlineDirectionSize + colGap / 2);
511 currLogicalLeftOffset -= (inlineDirectionSize + colGap);
512 }
513
514 // Now compute the final bounds.
515 if (i < colCount - 1) {
516 LayoutUnit ruleLeft, ruleRight, ruleTop, ruleBottom;
517 if (isHorizontalWritingMode()) {
518 ruleLeft = paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
519 ruleRight = ruleLeft + ruleThickness;
520 ruleTop = paintOffset.y() + borderTop() + paddingTop();
521 ruleBottom = ruleTop + contentHeight();
522 } else {
523 ruleLeft = paintOffset.x() + borderLeft() + paddingLeft();
524 ruleRight = ruleLeft + contentWidth();
525 ruleTop = paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
526 ruleBottom = ruleTop + ruleThickness;
527 }
528
529 columnRuleBounds.append(LayoutRect(ruleLeft, ruleTop, ruleRight - ru leLeft, ruleBottom - ruleTop));
530 }
531
532 ruleLogicalLeft = currLogicalLeftOffset;
533 }
534 return true;
535 }
536
537 LayoutRect LayoutMultiColumnSet::localOverflowRectForPaintInvalidation() const
538 {
539 LayoutRect blockFlowBounds = LayoutBlockFlow::localOverflowRectForPaintInval idation();
540
541 // Now add in column rule bounds, if present.
542 Vector<LayoutRect> columnRuleBounds;
543 if (computeColumnRuleBounds(LayoutPoint(), columnRuleBounds)) {
544 for (auto& bound : columnRuleBounds)
545 blockFlowBounds.unite(bound);
546 }
547 return blockFlowBounds;
548 }
549
479 } // namespace blink 550 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698