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

Side by Side Diff: Source/core/rendering/RenderMultiColumnSet.cpp

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 4 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 if (style()->visibility() != VISIBLE) 322 if (style()->visibility() != VISIBLE)
323 return; 323 return;
324 324
325 RenderBlock::paintObject(paintInfo, paintOffset); 325 RenderBlock::paintObject(paintInfo, paintOffset);
326 326
327 // FIXME: Right now we're only painting in the foreground phase. 327 // FIXME: Right now we're only painting in the foreground phase.
328 // Columns should technically respect phases and allow for background/float/ foreground overlap etc., just like 328 // Columns should technically respect phases and allow for background/float/ foreground overlap etc., just like
329 // RenderBlocks do. Note this is a pretty minor issue, since the old column implementation clipped columns 329 // RenderBlocks do. Note this is a pretty minor issue, since the old column implementation clipped columns
330 // anyway, thus making it impossible for them to overlap one another. It's a lso really unlikely that the columns 330 // anyway, thus making it impossible for them to overlap one another. It's a lso really unlikely that the columns
331 // would overlap another block. 331 // would overlap another block.
332 if (!m_flowThread || !isValid() || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 332 if (!m_flowThread || !isValid() || (paintInfo.getPhase() != PaintPhaseForegr ound && paintInfo.getPhase() != PaintPhaseSelection))
333 return; 333 return;
334 334
335 paintColumnRules(paintInfo, paintOffset); 335 paintColumnRules(paintInfo, paintOffset);
336 } 336 }
337 337
338 void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPo int& paintOffset) 338 void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPo int& paintOffset)
339 { 339 {
340 if (paintInfo.context->paintingDisabled()) 340 if (paintInfo.getContext()->paintingDisabled())
341 return; 341 return;
342 342
343 RenderStyle* blockStyle = toRenderMultiColumnBlock(parent())->style(); 343 RenderStyle* blockStyle = toRenderMultiColumnBlock(parent())->style();
344 const Color& ruleColor = resolveColor(blockStyle, CSSPropertyWebkitColumnRul eColor); 344 const Color& ruleColor = resolveColor(blockStyle, CSSPropertyWebkitColumnRul eColor);
345 bool ruleTransparent = blockStyle->columnRuleIsTransparent(); 345 bool ruleTransparent = blockStyle->columnRuleIsTransparent();
346 EBorderStyle ruleStyle = blockStyle->columnRuleStyle(); 346 EBorderStyle ruleStyle = blockStyle->columnRuleStyle();
347 LayoutUnit ruleThickness = blockStyle->columnRuleWidth(); 347 LayoutUnit ruleThickness = blockStyle->columnRuleWidth();
348 LayoutUnit colGap = columnGap(); 348 LayoutUnit colGap = columnGap();
349 bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent; 349 bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent;
350 if (!renderRule) 350 if (!renderRule)
351 return; 351 return;
352 352
353 unsigned colCount = columnCount(); 353 unsigned colCount = columnCount();
354 if (colCount <= 1) 354 if (colCount <= 1)
355 return; 355 return;
356 356
357 bool antialias = shouldAntialiasLines(paintInfo.context); 357 bool antialias = shouldAntialiasLines(paintInfo.getContext());
358 358
359 bool leftToRight = style()->isLeftToRightDirection(); 359 bool leftToRight = style()->isLeftToRightDirection();
360 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogic alWidth(); 360 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogic alWidth();
361 LayoutUnit ruleAdd = borderAndPaddingLogicalLeft(); 361 LayoutUnit ruleAdd = borderAndPaddingLogicalLeft();
362 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidt h(); 362 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidt h();
363 LayoutUnit inlineDirectionSize = computedColumnWidth(); 363 LayoutUnit inlineDirectionSize = computedColumnWidth();
364 BoxSide boxSide = isHorizontalWritingMode() 364 BoxSide boxSide = isHorizontalWritingMode()
365 ? leftToRight ? BSLeft : BSRight 365 ? leftToRight ? BSLeft : BSRight
366 : leftToRight ? BSTop : BSBottom; 366 : leftToRight ? BSTop : BSBottom;
367 367
368 for (unsigned i = 0; i < colCount; i++) { 368 for (unsigned i = 0; i < colCount; i++) {
369 // Move to the next position. 369 // Move to the next position.
370 if (leftToRight) { 370 if (leftToRight) {
371 ruleLogicalLeft += inlineDirectionSize + colGap / 2; 371 ruleLogicalLeft += inlineDirectionSize + colGap / 2;
372 currLogicalLeftOffset += inlineDirectionSize + colGap; 372 currLogicalLeftOffset += inlineDirectionSize + colGap;
373 } else { 373 } else {
374 ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); 374 ruleLogicalLeft -= (inlineDirectionSize + colGap / 2);
375 currLogicalLeftOffset -= (inlineDirectionSize + colGap); 375 currLogicalLeftOffset -= (inlineDirectionSize + colGap);
376 } 376 }
377 377
378 // Now paint the column rule. 378 // Now paint the column rule.
379 if (i < colCount - 1) { 379 if (i < colCount - 1) {
380 LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft(); 380 LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft();
381 LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleTh ickness : ruleLeft + contentWidth(); 381 LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleTh ickness : ruleLeft + contentWidth();
382 LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + b orderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; 382 LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + b orderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
383 LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + conten tHeight() : ruleTop + ruleThickness; 383 LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + conten tHeight() : ruleTop + ruleThickness;
384 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft , ruleTop, ruleRight, ruleBottom); 384 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft , ruleTop, ruleRight, ruleBottom);
385 drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixe lSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); 385 drawLineForBoxSide(paintInfo.getContext(), pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.max Y(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
386 } 386 }
387 387
388 ruleLogicalLeft = currLogicalLeftOffset; 388 ruleLogicalLeft = currLogicalLeftOffset;
389 } 389 }
390 } 390 }
391 391
392 void RenderMultiColumnSet::repaintFlowThreadContent(const LayoutRect& repaintRec t) const 392 void RenderMultiColumnSet::repaintFlowThreadContent(const LayoutRect& repaintRec t) const
393 { 393 {
394 // Figure out the start and end columns and only check within that range so that we don't walk the 394 // Figure out the start and end columns and only check within that range so that we don't walk the
395 // entire column set. Put the repaint rect into flow thread coordinates by f lipping it first. 395 // entire column set. Put the repaint rect into flow thread coordinates by f lipping it first.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 fragments.append(fragment); 508 fragments.append(fragment);
509 } 509 }
510 } 510 }
511 511
512 const char* RenderMultiColumnSet::renderName() const 512 const char* RenderMultiColumnSet::renderName() const
513 { 513 {
514 return "RenderMultiColumnSet"; 514 return "RenderMultiColumnSet";
515 } 515 }
516 516
517 } 517 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698