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

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

Issue 1887793002: Correct inline-block baseline calculation for multicol containers. (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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.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 /* 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 LayoutUnit blockOffset = isHorizontalWritingMode() ? visualPoint.y() : visua lPoint.x(); 338 LayoutUnit blockOffset = isHorizontalWritingMode() ? visualPoint.y() : visua lPoint.x();
339 const LayoutMultiColumnSet* columnSet = nullptr; 339 const LayoutMultiColumnSet* columnSet = nullptr;
340 for (const LayoutMultiColumnSet* candidate = firstMultiColumnSet(); candidat e; candidate = candidate->nextSiblingMultiColumnSet()) { 340 for (const LayoutMultiColumnSet* candidate = firstMultiColumnSet(); candidat e; candidate = candidate->nextSiblingMultiColumnSet()) {
341 columnSet = candidate; 341 columnSet = candidate;
342 if (candidate->logicalBottom() > blockOffset) 342 if (candidate->logicalBottom() > blockOffset)
343 break; 343 break;
344 } 344 }
345 return columnSet ? columnSet->visualPointToFlowThreadPoint(toLayoutPoint(vis ualPoint + location() - columnSet->location())) : visualPoint; 345 return columnSet ? columnSet->visualPointToFlowThreadPoint(toLayoutPoint(vis ualPoint + location() - columnSet->location())) : visualPoint;
346 } 346 }
347 347
348 int LayoutMultiColumnFlowThread::inlineBlockBaseline(LineDirectionMode lineDirec tion) const
349 {
350 LayoutUnit baselineInFlowThread = LayoutUnit(LayoutFlowThread::inlineBlockBa seline(lineDirection));
351 LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(baselineInFlowThrea d);
352 if (!columnSet)
353 return baselineInFlowThread.toInt();
354 return (baselineInFlowThread - columnSet->pageLogicalTopForOffset(baselineIn FlowThread)).ceil();
355 }
356
348 LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(Layout Unit offset) const 357 LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(Layout Unit offset) const
349 { 358 {
350 if (LayoutMultiColumnSet* columnSet = m_lastSetWorkedOn) { 359 if (LayoutMultiColumnSet* columnSet = m_lastSetWorkedOn) {
351 // Layout in progress. We are calculating the set heights as we speak, s o the column set range 360 // Layout in progress. We are calculating the set heights as we speak, s o the column set range
352 // information is not up-to-date. 361 // information is not up-to-date.
353 while (columnSet->logicalTopInFlowThread() > offset) { 362 while (columnSet->logicalTopInFlowThread() > offset) {
354 // Sometimes we have to use a previous set. This happens when we're working with a block 363 // Sometimes we have to use a previous set. This happens when we're working with a block
355 // that contains a spanner (so that there's a column set both before and after the 364 // that contains a spanner (so that there's a column set both before and after the
356 // spanner, and both sets contain said block). 365 // spanner, and both sets contain said block).
357 LayoutMultiColumnSet* previousSet = columnSet->previousSiblingMultiC olumnSet(); 366 LayoutMultiColumnSet* previousSet = columnSet->previousSiblingMultiC olumnSet();
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 } 1014 }
1006 if (canContainSpannerInParentFragmentationContext(*object)) 1015 if (canContainSpannerInParentFragmentationContext(*object))
1007 next = object->nextInPreOrder(&root); 1016 next = object->nextInPreOrder(&root);
1008 else 1017 else
1009 next = object->nextInPreOrderAfterChildren(&root); 1018 next = object->nextInPreOrderAfterChildren(&root);
1010 } 1019 }
1011 return true; 1020 return true;
1012 } 1021 }
1013 1022
1014 } // namespace blink 1023 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698