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

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

Issue 1407633003: [css-grid] Implementation of Baseline Self-Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improving the skipped tesst by solving some rounding issues Created 3 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 for (const RootInlineBox* box = firstRootBox(); box; 2522 for (const RootInlineBox* box = firstRootBox(); box;
2523 box = box->nextRootBox()) { 2523 box = box->nextRootBox()) {
2524 count++; 2524 count++;
2525 if (box == stopRootInlineBox) 2525 if (box == stopRootInlineBox)
2526 break; 2526 break;
2527 } 2527 }
2528 return count; 2528 return count;
2529 } 2529 }
2530 2530
2531 int LayoutBlockFlow::firstLineBoxBaseline() const { 2531 int LayoutBlockFlow::firstLineBoxBaseline() const {
2532 if (isWritingModeRoot() && !isRubyRun()) 2532 // Orthogonal grid items can participante in baseline alignment along column
2533 // axis.
2534 if (isWritingModeRoot() && !isRubyRun() && !isGridItem())
2533 return -1; 2535 return -1;
2534 if (!childrenInline()) 2536 if (!childrenInline())
2535 return LayoutBlock::firstLineBoxBaseline(); 2537 return LayoutBlock::firstLineBoxBaseline();
2536 if (firstLineBox()) { 2538 if (firstLineBox()) {
2537 const SimpleFontData* fontData = style(true)->font().primaryFont(); 2539 const SimpleFontData* fontData = style(true)->font().primaryFont();
2538 DCHECK(fontData); 2540 DCHECK(fontData);
2539 if (!fontData) 2541 if (!fontData)
2540 return -1; 2542 return -1;
2543 // fontMetrics 'ascent' is the distance above the baseline to the 'over'
2544 // edge, which is 'top' for horizontal and 'right' for vertical-lr and
2545 // vertical-rl. However, firstLineBox()->logicalTop() gives the offset from
2546 // the 'left' edge for vertical-lr, hence we need to use the Font Metrics
2547 // 'descent' instead. The result should be handled accordingly by the caller
2548 // as a 'descent' value, in order to compute properly the max baseline.
2549 if (styleRef().isFlippedLinesWritingMode()) {
2550 return (firstLineBox()->logicalTop() +
2551 fontData->getFontMetrics().descent(
2552 firstRootBox()->baselineType()))
2553 .toInt();
2554 }
2541 return (firstLineBox()->logicalTop() + 2555 return (firstLineBox()->logicalTop() +
2542 fontData->getFontMetrics().ascent(firstRootBox()->baselineType())) 2556 fontData->getFontMetrics().ascent(firstRootBox()->baselineType()))
2543 .toInt(); 2557 .toInt();
2544 } 2558 }
2545 return -1; 2559 return -1;
2546 } 2560 }
2547 2561
2548 int LayoutBlockFlow::inlineBlockBaseline( 2562 int LayoutBlockFlow::inlineBlockBaseline(
2549 LineDirectionMode lineDirection) const { 2563 LineDirectionMode lineDirection) const {
2550 // CSS2.1 states that the baseline of an 'inline-block' is: 2564 // CSS2.1 states that the baseline of an 'inline-block' is:
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
4602 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4616 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4603 } 4617 }
4604 4618
4605 void LayoutBlockFlow::invalidateDisplayItemClients( 4619 void LayoutBlockFlow::invalidateDisplayItemClients(
4606 PaintInvalidationReason invalidationReason) const { 4620 PaintInvalidationReason invalidationReason) const {
4607 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4621 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4608 invalidationReason); 4622 invalidationReason);
4609 } 4623 }
4610 4624
4611 } // namespace blink 4625 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698