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

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: Patch rebased and applied several refactoring and code clean up. Created 3 years, 11 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 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 for (const RootInlineBox* box = firstRootBox(); box; 2515 for (const RootInlineBox* box = firstRootBox(); box;
2516 box = box->nextRootBox()) { 2516 box = box->nextRootBox()) {
2517 count++; 2517 count++;
2518 if (box == stopRootInlineBox) 2518 if (box == stopRootInlineBox)
2519 break; 2519 break;
2520 } 2520 }
2521 return count; 2521 return count;
2522 } 2522 }
2523 2523
2524 int LayoutBlockFlow::firstLineBoxBaseline() const { 2524 int LayoutBlockFlow::firstLineBoxBaseline() const {
2525 if (isWritingModeRoot() && !isRubyRun()) 2525 if (isWritingModeRoot() && !isRubyRun() && !isGridItem())
2526 return -1; 2526 return -1;
2527 if (!childrenInline()) 2527 if (!childrenInline())
2528 return LayoutBlock::firstLineBoxBaseline(); 2528 return LayoutBlock::firstLineBoxBaseline();
2529 if (firstLineBox()) { 2529 if (firstLineBox()) {
2530 const SimpleFontData* fontData = style(true)->font().primaryFont(); 2530 const SimpleFontData* fontData = style(true)->font().primaryFont();
2531 DCHECK(fontData); 2531 DCHECK(fontData);
2532 if (!fontData) 2532 if (!fontData)
2533 return -1; 2533 return -1;
2534 return (firstLineBox()->logicalTop() + 2534 return ((styleRef().isFlippedLinesWritingMode()
2535 ? logicalHeight() - firstLineBox()->logicalBottom()
2536 : firstLineBox()->logicalTop()) +
svillar 2017/01/19 09:41:25 I don't fully understand this change but it does r
jfernandez 2017/01/19 16:31:48 I can add more tests, indeed, since this line fixe
2535 fontData->getFontMetrics().ascent(firstRootBox()->baselineType())) 2537 fontData->getFontMetrics().ascent(firstRootBox()->baselineType()))
2536 .toInt(); 2538 .toInt();
2537 } 2539 }
2538 return -1; 2540 return -1;
2539 } 2541 }
2540 2542
2541 int LayoutBlockFlow::inlineBlockBaseline( 2543 int LayoutBlockFlow::inlineBlockBaseline(
2542 LineDirectionMode lineDirection) const { 2544 LineDirectionMode lineDirection) const {
2543 // CSS2.1 states that the baseline of an 'inline-block' is: 2545 // CSS2.1 states that the baseline of an 'inline-block' is:
2544 // the baseline of the last line box in the normal flow, unless it has 2546 // the baseline of the last line box in the normal flow, unless it has
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
4598 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4600 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4599 } 4601 }
4600 4602
4601 void LayoutBlockFlow::invalidateDisplayItemClients( 4603 void LayoutBlockFlow::invalidateDisplayItemClients(
4602 PaintInvalidationReason invalidationReason) const { 4604 PaintInvalidationReason invalidationReason) const {
4603 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4605 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4604 invalidationReason); 4606 invalidationReason);
4605 } 4607 }
4606 4608
4607 } // namespace blink 4609 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698