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

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

Issue 1216223004: Avoid using floating point when not needed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: code review Created 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/multicol/very-tall-block-crash-expected.txt ('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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 if (offsetInFlowThread < m_logicalTopInFlowThread) 529 if (offsetInFlowThread < m_logicalTopInFlowThread)
530 return 0; 530 return 0;
531 // If we're laying out right now, we cannot constrain against some logical b ottom, since it 531 // If we're laying out right now, we cannot constrain against some logical b ottom, since it
532 // isn't known yet. Otherwise, just return the last column if we're past the logical bottom. 532 // isn't known yet. Otherwise, just return the last column if we're past the logical bottom.
533 if (mode == ClampToExistingColumns) { 533 if (mode == ClampToExistingColumns) {
534 if (offsetInFlowThread >= m_logicalBottomInFlowThread) 534 if (offsetInFlowThread >= m_logicalBottomInFlowThread)
535 return actualColumnCount() - 1; 535 return actualColumnCount() - 1;
536 } 536 }
537 537
538 if (m_columnHeight) 538 if (m_columnHeight)
539 return (offsetInFlowThread - m_logicalTopInFlowThread).toFloat() / m_col umnHeight.toFloat(); 539 return ((offsetInFlowThread - m_logicalTopInFlowThread) / m_columnHeight ).floor();
540 return 0; 540 return 0;
541 } 541 }
542 542
543 unsigned MultiColumnFragmentainerGroup::columnIndexAtVisualPoint(const LayoutPoi nt& visualPoint) const 543 unsigned MultiColumnFragmentainerGroup::columnIndexAtVisualPoint(const LayoutPoi nt& visualPoint) const
544 { 544 {
545 bool isColumnProgressionInline = m_columnSet.multiColumnFlowThread()->progre ssionIsInline(); 545 bool isColumnProgressionInline = m_columnSet.multiColumnFlowThread()->progre ssionIsInline();
546 bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode(); 546 bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode();
547 LayoutUnit columnLengthInColumnProgressionDirection = isColumnProgressionInl ine ? m_columnSet.pageLogicalWidth() : m_columnSet.pageLogicalHeight(); 547 LayoutUnit columnLengthInColumnProgressionDirection = isColumnProgressionInl ine ? m_columnSet.pageLogicalWidth() : m_columnSet.pageLogicalHeight();
548 LayoutUnit offsetInColumnProgressionDirection = isHorizontalWritingMode == i sColumnProgressionInline ? visualPoint.x() : visualPoint.y(); 548 LayoutUnit offsetInColumnProgressionDirection = isHorizontalWritingMode == i sColumnProgressionInline ? visualPoint.x() : visualPoint.y();
549 if (!m_columnSet.style()->isLeftToRightDirection() && isColumnProgressionInl ine) 549 if (!m_columnSet.style()->isLeftToRightDirection() && isColumnProgressionInl ine)
(...skipping 28 matching lines...) Expand all
578 append(MultiColumnFragmentainerGroup(m_columnSet)); 578 append(MultiColumnFragmentainerGroup(m_columnSet));
579 return last(); 579 return last();
580 } 580 }
581 581
582 void MultiColumnFragmentainerGroupList::deleteExtraGroups() 582 void MultiColumnFragmentainerGroupList::deleteExtraGroups()
583 { 583 {
584 shrink(1); 584 shrink(1);
585 } 585 }
586 586
587 } // namespace blink 587 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/multicol/very-tall-block-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698