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

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

Issue 259993006: Cleanup: Replace adjustForColumns() / offsetForColumns() with columnOffset(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 3440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 ColumnInfo* colInfo = columnInfo(); 3451 ColumnInfo* colInfo = columnInfo();
3452 LayoutUnit columnLogicalHeight = colInfo->columnHeight(); 3452 LayoutUnit columnLogicalHeight = colInfo->columnHeight();
3453 LayoutUnit expandedLogicalHeight = borderBefore() + paddingBefore() + column Count(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollba rLogicalHeight(); 3453 LayoutUnit expandedLogicalHeight = borderBefore() + paddingBefore() + column Count(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollba rLogicalHeight();
3454 3454
3455 if (isHorizontalWritingMode()) 3455 if (isHorizontalWritingMode())
3456 rect.setY(expandedLogicalHeight - rect.maxY()); 3456 rect.setY(expandedLogicalHeight - rect.maxY());
3457 else 3457 else
3458 rect.setX(expandedLogicalHeight - rect.maxX()); 3458 rect.setX(expandedLogicalHeight - rect.maxX());
3459 } 3459 }
3460 3460
3461 void RenderBlock::adjustForColumns(LayoutSize& offset, const LayoutPoint& point) const 3461 LayoutSize RenderBlock::columnOffset(const LayoutPoint& point) const
3462 { 3462 {
3463 if (!hasColumns()) 3463 if (!hasColumns())
3464 return; 3464 return LayoutSize();
3465 3465
3466 ColumnInfo* colInfo = columnInfo(); 3466 ColumnInfo* colInfo = columnInfo();
3467 3467
3468 LayoutUnit logicalLeft = logicalLeftOffsetForContent(); 3468 LayoutUnit logicalLeft = logicalLeftOffsetForContent();
3469 unsigned colCount = columnCount(colInfo); 3469 unsigned colCount = columnCount(colInfo);
3470 LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth(); 3470 LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth();
3471 LayoutUnit colLogicalHeight = colInfo->columnHeight(); 3471 LayoutUnit colLogicalHeight = colInfo->columnHeight();
3472 3472
3473 for (unsigned i = 0; i < colCount; ++i) { 3473 for (unsigned i = 0; i < colCount; ++i) {
3474 // Compute the edges for a given column in the block progression directi on. 3474 // Compute the edges for a given column in the block progression directi on.
3475 LayoutRect sliceRect = LayoutRect(logicalLeft, borderBefore() + paddingB efore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight); 3475 LayoutRect sliceRect = LayoutRect(logicalLeft, borderBefore() + paddingB efore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight);
3476 if (!isHorizontalWritingMode()) 3476 if (!isHorizontalWritingMode())
3477 sliceRect = sliceRect.transposedRect(); 3477 sliceRect = sliceRect.transposedRect();
3478 3478
3479 LayoutUnit logicalOffset = i * colLogicalHeight; 3479 LayoutUnit logicalOffset = i * colLogicalHeight;
3480 3480
3481 // Now we're in the same coordinate space as the point. See if it is in side the rectangle. 3481 // Now we're in the same coordinate space as the point. See if it is in side the rectangle.
3482 if (isHorizontalWritingMode()) { 3482 if (isHorizontalWritingMode()) {
3483 if (point.y() >= sliceRect.y() && point.y() < sliceRect.maxY()) { 3483 if (point.y() >= sliceRect.y() && point.y() < sliceRect.maxY()) {
3484 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) 3484 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis)
3485 offset.expand(columnRectAt(colInfo, i).x() - logicalLeft, -l ogicalOffset); 3485 return LayoutSize(columnRectAt(colInfo, i).x() - logicalLeft , -logicalOffset);
3486 else 3486 return LayoutSize(0, columnRectAt(colInfo, i).y() - logicalOffse t - borderBefore() - paddingBefore());
3487 offset.expand(0, columnRectAt(colInfo, i).y() - logicalOffse t - borderBefore() - paddingBefore());
3488 return;
3489 } 3487 }
3490 } else { 3488 } else {
3491 if (point.x() >= sliceRect.x() && point.x() < sliceRect.maxX()) { 3489 if (point.x() >= sliceRect.x() && point.x() < sliceRect.maxX()) {
3492 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) 3490 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis)
3493 offset.expand(-logicalOffset, columnRectAt(colInfo, i).y() - logicalLeft); 3491 return LayoutSize(-logicalOffset, columnRectAt(colInfo, i).y () - logicalLeft);
3494 else 3492 return LayoutSize(columnRectAt(colInfo, i).x() - logicalOffset - borderBefore() - paddingBefore(), 0);
3495 offset.expand(columnRectAt(colInfo, i).x() - logicalOffset - borderBefore() - paddingBefore(), 0);
3496 return;
3497 } 3493 }
3498 } 3494 }
3499 } 3495 }
3496
3497 return LayoutSize();
3500 } 3498 }
3501 3499
3502 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay outUnit& maxLogicalWidth) const 3500 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay outUnit& maxLogicalWidth) const
3503 { 3501 {
3504 if (childrenInline()) { 3502 if (childrenInline()) {
3505 // FIXME: Remove this const_cast. 3503 // FIXME: Remove this const_cast.
3506 toRenderBlockFlow(const_cast<RenderBlock*>(this))->computeInlinePreferre dLogicalWidths(minLogicalWidth, maxLogicalWidth); 3504 toRenderBlockFlow(const_cast<RenderBlock*>(this))->computeInlinePreferre dLogicalWidths(minLogicalWidth, maxLogicalWidth);
3507 } else { 3505 } else {
3508 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); 3506 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
3509 } 3507 }
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
5020 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5021 { 5019 {
5022 showRenderObject(); 5020 showRenderObject();
5023 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5024 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5025 } 5023 }
5026 5024
5027 #endif 5025 #endif
5028 5026
5029 } // namespace WebCore 5027 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698