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

Side by Side Diff: Source/core/layout/MultiColumnFragmentainerGroup.cpp

Issue 1190153002: Make mapLocalToContainer() work properly for content that follows a column spanner. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 6
7 #include "core/layout/MultiColumnFragmentainerGroup.h" 7 #include "core/layout/MultiColumnFragmentainerGroup.h"
8 8
9 #include "core/layout/LayoutMultiColumnSet.h" 9 #include "core/layout/LayoutMultiColumnSet.h"
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // to encompass that remaining height and overflow. The idea is that we will generate 125 // to encompass that remaining height and overflow. The idea is that we will generate
126 // additional columns and pages to hold that overflow, since people do write bad 126 // additional columns and pages to hold that overflow, since people do write bad
127 // content like <body style="height:0px"> in multi-column layouts. 127 // content like <body style="height:0px"> in multi-column layouts.
128 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread( ); 128 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread( );
129 LayoutRect layoutRect = flowThread->layoutOverflowRect(); 129 LayoutRect layoutRect = flowThread->layoutOverflowRect();
130 m_logicalBottomInFlowThread = flowThread->isHorizontalWritingMode() ? layout Rect.maxY() : layoutRect.maxX(); 130 m_logicalBottomInFlowThread = flowThread->isHorizontalWritingMode() ? layout Rect.maxY() : layoutRect.maxX();
131 } 131 }
132 132
133 LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn it offsetInFlowThread) const 133 LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn it offsetInFlowThread) const
134 { 134 {
135 LayoutFlowThread* flowThread = m_columnSet.flowThread();
135 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread); 136 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread);
136 LayoutRect portionRect(flowThreadPortionRectAt(columnIndex)); 137 LayoutRect portionRect(flowThreadPortionRectAt(columnIndex));
137 m_columnSet.flipForWritingMode(portionRect); 138 flowThread->flipForWritingMode(portionRect);
138 LayoutSize translation(translationAtColumn(columnIndex)); 139 LayoutRect columnRect(columnRectAt(columnIndex));
139 // TODO(mstensho): need a rectangle (not a point) to flip for writing mode h ere, once we get support for multiple rows. 140 m_columnSet.flipForWritingMode(columnRect);
140 return toLayoutPoint(translation) - portionRect.location(); 141 LayoutSize translationRelativeToGroup = columnRect.location() - portionRect. location();
142 return translationRelativeToGroup + offsetFromColumnSet() + m_columnSet.topL eftLocationOffset() - flowThread->topLeftLocationOffset();
141 } 143 }
142 144
143 LayoutUnit MultiColumnFragmentainerGroup::columnLogicalTopForOffset(LayoutUnit o ffsetInFlowThread) const 145 LayoutUnit MultiColumnFragmentainerGroup::columnLogicalTopForOffset(LayoutUnit o ffsetInFlowThread) const
144 { 146 {
145 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread, AssumeNewColu mns); 147 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread, AssumeNewColu mns);
146 return logicalTopInFlowThreadAt(columnIndex); 148 return logicalTopInFlowThreadAt(columnIndex);
147 } 149 }
148 150
149 LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const La youtPoint& visualPoint) const 151 LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const La youtPoint& visualPoint) const
150 { 152 {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // amount of space shortage found during layout. 433 // amount of space shortage found during layout.
432 434
433 ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height! 435 ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height!
434 ASSERT(m_minSpaceShortage != LayoutFlowThread::maxLogicalHeight()); // If th is happens, we probably have a bug. 436 ASSERT(m_minSpaceShortage != LayoutFlowThread::maxLogicalHeight()); // If th is happens, we probably have a bug.
435 if (m_minSpaceShortage == LayoutFlowThread::maxLogicalHeight()) 437 if (m_minSpaceShortage == LayoutFlowThread::maxLogicalHeight())
436 return m_columnHeight; // So bail out rather than looping infinitely. 438 return m_columnHeight; // So bail out rather than looping infinitely.
437 439
438 return m_columnHeight + m_minSpaceShortage; 440 return m_columnHeight + m_minSpaceShortage;
439 } 441 }
440 442
441 LayoutSize MultiColumnFragmentainerGroup::translationAtColumn(unsigned columnInd ex) const
442 {
443 LayoutUnit logicalTopOffset;
444 LayoutUnit logicalLeftOffset;
445 LayoutUnit columnGap = m_columnSet.columnGap();
446 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) {
447 logicalLeftOffset = columnIndex * (m_columnSet.pageLogicalWidth() + colu mnGap);
448 if (!m_columnSet.style()->isLeftToRightDirection())
449 logicalLeftOffset = -logicalLeftOffset;
450 } else {
451 logicalTopOffset = columnIndex * (m_columnHeight + columnGap);
452 }
453
454 LayoutSize offset(logicalLeftOffset, logicalTopOffset);
455 return m_columnSet.isHorizontalWritingMode() ? offset : offset.transposedSiz e();
456 }
457
458 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con st 443 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con st
459 { 444 {
460 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth(); 445 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth();
461 LayoutUnit columnLogicalHeight = m_columnHeight; 446 LayoutUnit columnLogicalHeight = m_columnHeight;
462 LayoutUnit columnLogicalTop; 447 LayoutUnit columnLogicalTop;
463 LayoutUnit columnLogicalLeft; 448 LayoutUnit columnLogicalLeft;
464 LayoutUnit columnGap = m_columnSet.columnGap(); 449 LayoutUnit columnGap = m_columnSet.columnGap();
465 450
466 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) { 451 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) {
467 if (m_columnSet.style()->isLeftToRightDirection()) 452 if (m_columnSet.style()->isLeftToRightDirection())
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 append(MultiColumnFragmentainerGroup(m_columnSet)); 563 append(MultiColumnFragmentainerGroup(m_columnSet));
579 return last(); 564 return last();
580 } 565 }
581 566
582 void MultiColumnFragmentainerGroupList::deleteExtraGroups() 567 void MultiColumnFragmentainerGroupList::deleteExtraGroups()
583 { 568 {
584 shrink(1); 569 shrink(1);
585 } 570 }
586 571
587 } // namespace blink 572 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698