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

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

Issue 1910053003: Get the right ascent/descent for the tallest vertically aligned container (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@396717-4
Patch Set: Updated 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/LayoutTests/platform/linux/transforms/svg-vs-css-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 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 { 453 {
454 // Use "central" (Ideographic) baseline if writing-mode is vertical-* and te xt-orientation is not sideways-*. 454 // Use "central" (Ideographic) baseline if writing-mode is vertical-* and te xt-orientation is not sideways-*.
455 // http://dev.w3.org/csswg/css-writing-modes-3/#text-baselines 455 // http://dev.w3.org/csswg/css-writing-modes-3/#text-baselines
456 if (!isHorizontal() && getLineLayoutItem().style(isFirstLineStyle())->getFon tDescription().isVerticalAnyUpright()) 456 if (!isHorizontal() && getLineLayoutItem().style(isFirstLineStyle())->getFon tDescription().isVerticalAnyUpright())
457 return IdeographicBaseline; 457 return IdeographicBaseline;
458 return AlphabeticBaseline; 458 return AlphabeticBaseline;
459 } 459 }
460 460
461 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i nt maxPositionTop, int maxPositionBottom) 461 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i nt maxPositionTop, int maxPositionBottom)
462 { 462 {
463 int originalMaxAscent = maxAscent;
464 int originalMaxDescent = maxDescent;
463 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 465 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
464 // The computed lineheight needs to be extended for the 466 // The computed lineheight needs to be extended for the
465 // positioned elements 467 // positioned elements
466 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) 468 if (curr->getLineLayoutItem().isOutOfFlowPositioned())
467 continue; // Positioned placeholders don't affect calculations. 469 continue; // Positioned placeholders don't affect calculations.
468 if (curr->verticalAlign() == VerticalAlignTop || curr->verticalAlign() = = VerticalAlignBottom) { 470 if (curr->verticalAlign() == VerticalAlignTop || curr->verticalAlign() = = VerticalAlignBottom) {
469 int lineHeight = curr->lineHeight(); 471 int lineHeight = curr->lineHeight().round();
470 if (curr->verticalAlign() == VerticalAlignTop) { 472 if (curr->verticalAlign() == VerticalAlignTop) {
471 if (maxAscent + maxDescent < lineHeight) 473 if (maxAscent + maxDescent < lineHeight)
472 maxDescent = lineHeight - maxAscent; 474 maxDescent = lineHeight - maxAscent;
473 } else { 475 } else {
474 if (maxAscent + maxDescent < lineHeight) 476 if (maxAscent + maxDescent < lineHeight)
475 maxAscent = lineHeight - maxDescent; 477 maxAscent = lineHeight - maxDescent;
476 } 478 }
477 479
478 if (maxAscent + maxDescent >= std::max(maxPositionTop, maxPositionBo ttom)) 480 if (maxAscent + maxDescent >= std::max(maxPositionTop, maxPositionBo ttom))
479 break; 481 break;
482 maxAscent = originalMaxAscent;
483 maxDescent = originalMaxDescent;
480 } 484 }
481 485
482 if (curr->isInlineFlowBox()) 486 if (curr->isInlineFlowBox())
483 toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDesce nt, maxPositionTop, maxPositionBottom); 487 toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDesce nt, maxPositionTop, maxPositionBottom);
484 } 488 }
485 } 489 }
486 490
487 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent, bool noQuirksMode, GlyphOverflowAndFal lbackFontsMap& textBoxDataMap, FontBaseline baselineType, VerticalPositionCache& verticalPositionCache) 491 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent, bool noQuirksMode, GlyphOverflowAndFal lbackFontsMap& textBoxDataMap, FontBaseline baselineType, VerticalPositionCache& verticalPositionCache)
488 { 492 {
489 // The primary purpose of this function is to compute the maximal ascent and descent values for 493 // The primary purpose of this function is to compute the maximal ascent and descent values for
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 ASSERT(child->prevOnLine() == prev); 1317 ASSERT(child->prevOnLine() == prev);
1314 prev = child; 1318 prev = child;
1315 } 1319 }
1316 ASSERT(prev == m_lastChild); 1320 ASSERT(prev == m_lastChild);
1317 #endif 1321 #endif
1318 } 1322 }
1319 1323
1320 #endif 1324 #endif
1321 1325
1322 } // namespace blink 1326 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/transforms/svg-vs-css-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698