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

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: Fixed several bug and added new tests. Created 4 years, 1 month 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 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 for (const RootInlineBox* box = firstRootBox(); box; 2483 for (const RootInlineBox* box = firstRootBox(); box;
2484 box = box->nextRootBox()) { 2484 box = box->nextRootBox()) {
2485 count++; 2485 count++;
2486 if (box == stopRootInlineBox) 2486 if (box == stopRootInlineBox)
2487 break; 2487 break;
2488 } 2488 }
2489 return count; 2489 return count;
2490 } 2490 }
2491 2491
2492 int LayoutBlockFlow::firstLineBoxBaseline() const { 2492 int LayoutBlockFlow::firstLineBoxBaseline() const {
2493 if (isWritingModeRoot() && !isRubyRun()) 2493 if (isWritingModeRoot() && !isRubyRun() && !isGridItem())
2494 return -1; 2494 return -1;
2495 if (!childrenInline()) 2495 if (!childrenInline())
2496 return LayoutBlock::firstLineBoxBaseline(); 2496 return LayoutBlock::firstLineBoxBaseline();
2497 if (firstLineBox()) { 2497 if (firstLineBox()) {
2498 const SimpleFontData* fontData = style(true)->font().primaryFont(); 2498 const SimpleFontData* fontData = style(true)->font().primaryFont();
2499 DCHECK(fontData); 2499 DCHECK(fontData);
2500 if (!fontData) 2500 if (!fontData)
2501 return -1; 2501 return -1;
2502 return (firstLineBox()->logicalTop() + 2502 return (firstLineBox()->logicalTop() +
2503 fontData->getFontMetrics().ascent(firstRootBox()->baselineType())) 2503 (firstLineBox()->isHorizontal()
2504 ? fontData->getFontMetrics().ascent(
2505 firstRootBox()->baselineType())
2506 : fontData->getFontMetrics().descent(
2507 firstRootBox()->baselineType())))
kojii 2016/11/15 04:21:15 My intuition tells me that using descent is only c
jfernandez 2016/11/16 11:51:24 Yes, you are totally right. using descent only mak
kojii 2016/11/16 17:18:06 Thank you for doing the extensive research, and so
jfernandez 2016/11/16 18:50:07 I understand, I think we can still implement some
2504 .toInt(); 2508 .toInt();
2505 } 2509 }
2506 return -1; 2510 return -1;
2507 } 2511 }
2508 2512
2509 int LayoutBlockFlow::inlineBlockBaseline( 2513 int LayoutBlockFlow::inlineBlockBaseline(
2510 LineDirectionMode lineDirection) const { 2514 LineDirectionMode lineDirection) const {
2511 // CSS2.1 states that the baseline of an 'inline-block' is: 2515 // CSS2.1 states that the baseline of an 'inline-block' is:
2512 // the baseline of the last line box in the normal flow, unless it has 2516 // the baseline of the last line box in the normal flow, unless it has
2513 // either no in-flow line boxes or if its 'overflow' property has a computed 2517 // either no in-flow line boxes or if its 'overflow' property has a computed
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4548 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4545 } 4549 }
4546 4550
4547 void LayoutBlockFlow::invalidateDisplayItemClients( 4551 void LayoutBlockFlow::invalidateDisplayItemClients(
4548 PaintInvalidationReason invalidationReason) const { 4552 PaintInvalidationReason invalidationReason) const {
4549 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4553 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4550 invalidationReason); 4554 invalidationReason);
4551 } 4555 }
4552 4556
4553 } // namespace blink 4557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698