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

Side by Side Diff: Source/core/paint/BlockPainter.cpp

Issue 591613003: Move painting code from RenderObject into a new ObjectPainter class. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge again. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/paint/BoxPainter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/BlockPainter.h" 6 #include "core/paint/BlockPainter.h"
7 7
8 #include "core/editing/Caret.h" 8 #include "core/editing/Caret.h"
9 #include "core/editing/FrameSelection.h" 9 #include "core/editing/FrameSelection.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 currLogicalLeftOffset -= (inlineDirectionSize + colGap); 273 currLogicalLeftOffset -= (inlineDirectionSize + colGap);
274 } 274 }
275 275
276 // Now paint the column rule. 276 // Now paint the column rule.
277 if (i < colCount - 1) { 277 if (i < colCount - 1) {
278 LayoutUnit ruleLeft = m_renderBlock.isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x( ) + m_renderBlock.borderLeft() + m_renderBlock.paddingLeft(); 278 LayoutUnit ruleLeft = m_renderBlock.isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x( ) + m_renderBlock.borderLeft() + m_renderBlock.paddingLeft();
279 LayoutUnit ruleRight = m_renderBlock.isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + m_renderBlock.contentWidth(); 279 LayoutUnit ruleRight = m_renderBlock.isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + m_renderBlock.contentWidth();
280 LayoutUnit ruleTop = m_renderBlock.isHorizontalWritingMode() ? p aintOffset.y() + m_renderBlock.borderTop() + m_renderBlock.paddingTop() : paintO ffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; 280 LayoutUnit ruleTop = m_renderBlock.isHorizontalWritingMode() ? p aintOffset.y() + m_renderBlock.borderTop() + m_renderBlock.paddingTop() : paintO ffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
281 LayoutUnit ruleBottom = m_renderBlock.isHorizontalWritingMode() ? ruleTop + m_renderBlock.contentHeight() : ruleTop + ruleThickness; 281 LayoutUnit ruleBottom = m_renderBlock.isHorizontalWritingMode() ? ruleTop + m_renderBlock.contentHeight() : ruleTop + ruleThickness;
282 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(rule Left, ruleTop, ruleRight, ruleBottom); 282 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(rule Left, ruleTop, ruleRight, ruleBottom);
283 m_renderBlock.drawLineForBoxSide(paintInfo.context, pixelSnapped RuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappe dRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); 283 ObjectPainter::drawLineForBoxSide(paintInfo.context, pixelSnappe dRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnapp edRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
284 } 284 }
285 285
286 ruleLogicalLeft = currLogicalLeftOffset; 286 ruleLogicalLeft = currLogicalLeftOffset;
287 } 287 }
288 } else { 288 } else {
289 bool topToBottom = !m_renderBlock.style()->isFlippedBlocksWritingMode(); 289 bool topToBottom = !m_renderBlock.style()->isFlippedBlocksWritingMode();
290 LayoutUnit ruleLeft = m_renderBlock.isHorizontalWritingMode() 290 LayoutUnit ruleLeft = m_renderBlock.isHorizontalWritingMode()
291 ? m_renderBlock.borderLeft() + m_renderBlock.paddingLeft() 291 ? m_renderBlock.borderLeft() + m_renderBlock.paddingLeft()
292 : colGap / 2 - colGap - ruleThickness / 2 + m_renderBlock.borderBefo re() + m_renderBlock.paddingBefore(); 292 : colGap / 2 - colGap - ruleThickness / 2 + m_renderBlock.borderBefo re() + m_renderBlock.paddingBefore();
293 LayoutUnit ruleWidth = m_renderBlock.isHorizontalWritingMode() ? m_rende rBlock.contentWidth() : ruleThickness; 293 LayoutUnit ruleWidth = m_renderBlock.isHorizontalWritingMode() ? m_rende rBlock.contentWidth() : ruleThickness;
(...skipping 16 matching lines...) Expand all
310 ? topToBottom ? BSTop : BSBottom 310 ? topToBottom ? BSTop : BSBottom
311 : topToBottom ? BSLeft : BSRight; 311 : topToBottom ? BSLeft : BSRight;
312 312
313 LayoutSize step(0, topToBottom ? colInfo->columnHeight() + colGap : -(co lInfo->columnHeight() + colGap)); 313 LayoutSize step(0, topToBottom ? colInfo->columnHeight() + colGap : -(co lInfo->columnHeight() + colGap));
314 if (!m_renderBlock.isHorizontalWritingMode()) 314 if (!m_renderBlock.isHorizontalWritingMode())
315 step = step.transposedSize(); 315 step = step.transposedSize();
316 316
317 for (unsigned i = 1; i < colCount; i++) { 317 for (unsigned i = 1; i < colCount; i++) {
318 ruleRect.move(step); 318 ruleRect.move(step);
319 IntRect pixelSnappedRuleRect = pixelSnappedIntRect(ruleRect); 319 IntRect pixelSnappedRuleRect = pixelSnappedIntRect(ruleRect);
320 m_renderBlock.drawLineForBoxSide(paintInfo.context, pixelSnappedRule Rect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRul eRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); 320 ObjectPainter::drawLineForBoxSide(paintInfo.context, pixelSnappedRul eRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRu leRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
321 } 321 }
322 } 322 }
323 } 323 }
324 324
325 void BlockPainter::paintColumnContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset, bool paintingFloats) 325 void BlockPainter::paintColumnContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset, bool paintingFloats)
326 { 326 {
327 // We need to do multiple passes, breaking up our child painting into strips . 327 // We need to do multiple passes, breaking up our child painting into strips .
328 GraphicsContext* context = paintInfo.context; 328 GraphicsContext* context = paintInfo.context;
329 ColumnInfo* colInfo = m_renderBlock.columnInfo(); 329 ColumnInfo* colInfo = m_renderBlock.columnInfo();
330 unsigned colCount = m_renderBlock.columnCount(colInfo); 330 unsigned colCount = m_renderBlock.columnCount(colInfo);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 RenderBlock* block = flow->containingBlock(); 467 RenderBlock* block = flow->containingBlock();
468 for ( ; block && block != &m_renderBlock; block = block->containingBlock ()) 468 for ( ; block && block != &m_renderBlock; block = block->containingBlock ())
469 accumulatedPaintOffset.moveBy(block->location()); 469 accumulatedPaintOffset.moveBy(block->location());
470 ASSERT(block); 470 ASSERT(block);
471 flow->paintOutline(info, accumulatedPaintOffset); 471 flow->paintOutline(info, accumulatedPaintOffset);
472 } 472 }
473 } 473 }
474 474
475 475
476 } // namespace blink 476 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/paint/BoxPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698