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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp

Issue 1919453002: Support for mapping from outer/visual to flowthread coord space in nested multicol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return 0; 57 return 0;
58 // TODO(mstensho): Introduce an interval tree or similar to speed up this. 58 // TODO(mstensho): Introduce an interval tree or similar to speed up this.
59 for (unsigned index = 0; index < m_fragmentainerGroups.size(); index++) { 59 for (unsigned index = 0; index < m_fragmentainerGroups.size(); index++) {
60 const auto& row = m_fragmentainerGroups[index]; 60 const auto& row = m_fragmentainerGroups[index];
61 if (row.logicalTopInFlowThread() <= flowThreadOffset && row.logicalBotto mInFlowThread() > flowThreadOffset) 61 if (row.logicalTopInFlowThread() <= flowThreadOffset && row.logicalBotto mInFlowThread() > flowThreadOffset)
62 return index; 62 return index;
63 } 63 }
64 return m_fragmentainerGroups.size() - 1; 64 return m_fragmentainerGroups.size() - 1;
65 } 65 }
66 66
67 const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV isualPoint(const LayoutPoint&) const 67 const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV isualPoint(const LayoutPoint& visualPoint) const
68 { 68 {
69 // FIXME: implement this, once we have support for multiple rows. 69 LayoutUnit blockOffset = isHorizontalWritingMode() ? visualPoint.y() : visua lPoint.x();
70 return m_fragmentainerGroups.first(); 70 for (unsigned index = 0; index < m_fragmentainerGroups.size(); index++) {
71 const auto& row = m_fragmentainerGroups[index];
72 if (row.logicalTop() + row.logicalHeight() > blockOffset)
73 return row;
74 }
75 return m_fragmentainerGroups.last();
eae 2016/04/22 19:35:39 Do we need to assert that there is at least one en
mstensho (USE GERRIT) 2016/04/22 19:46:00 I was thinking that it really shouldn't be necessa
71 } 76 }
72 77
73 LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF lowThread) const 78 LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF lowThread) const
74 { 79 {
75 const MultiColumnFragmentainerGroup &lastRow = lastFragmentainerGroup(); 80 const MultiColumnFragmentainerGroup &lastRow = lastFragmentainerGroup();
76 if (!lastRow.logicalHeight()) { 81 if (!lastRow.logicalHeight()) {
77 // In the first layout pass of an auto-height multicol container, height isn't set. No need 82 // In the first layout pass of an auto-height multicol container, height isn't set. No need
78 // to perform the series of complicated dance steps below to figure out that we should 83 // to perform the series of complicated dance steps below to figure out that we should
79 // simply return 0. Bail now. 84 // simply return 0. Bail now.
80 ASSERT(m_fragmentainerGroups.size() == 1); 85 ASSERT(m_fragmentainerGroups.size() == 1);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 472
468 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const 473 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const
469 { 474 {
470 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); 475 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread());
471 if (!isHorizontalWritingMode()) 476 if (!isHorizontalWritingMode())
472 return portionRect.transposedRect(); 477 return portionRect.transposedRect();
473 return portionRect; 478 return portionRect;
474 } 479 }
475 480
476 } // namespace blink 481 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698