| OLD | NEW |
| 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 Loading... |
| 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; |
| 2541 return (firstLineBox()->logicalTop() + | 2543 // logicalTop() gives the distance to 'over-edge', 'top' for horizontal and |
| 2544 // 'right' for vertical-lr and vertical-rl. However, as it happens in |
| 2545 // inlineBlockBaseline we will flip lines to compute the baseline in case of |
| 2546 // vertical-lr mode, hence we want the distance to 'left' edge. |
| 2547 // We perform the same operatio in LayoutBlockFlow::inlineBlockBaseline. |
| 2548 return ((styleRef().isFlippedLinesWritingMode() |
| 2549 ? logicalHeight() - firstLineBox()->logicalBottom() |
| 2550 : firstLineBox()->logicalTop()) + |
| 2542 fontData->getFontMetrics().ascent(firstRootBox()->baselineType())) | 2551 fontData->getFontMetrics().ascent(firstRootBox()->baselineType())) |
| 2543 .toInt(); | 2552 .toInt(); |
| 2544 } | 2553 } |
| 2545 return -1; | 2554 return -1; |
| 2546 } | 2555 } |
| 2547 | 2556 |
| 2548 int LayoutBlockFlow::inlineBlockBaseline( | 2557 int LayoutBlockFlow::inlineBlockBaseline( |
| 2549 LineDirectionMode lineDirection) const { | 2558 LineDirectionMode lineDirection) const { |
| 2550 // CSS2.1 states that the baseline of an 'inline-block' is: | 2559 // CSS2.1 states that the baseline of an 'inline-block' is: |
| 2551 // the baseline of the last line box in the normal flow, unless it has | 2560 // the baseline of the last line box in the normal flow, unless it has |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4602 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 4611 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
| 4603 } | 4612 } |
| 4604 | 4613 |
| 4605 void LayoutBlockFlow::invalidateDisplayItemClients( | 4614 void LayoutBlockFlow::invalidateDisplayItemClients( |
| 4606 PaintInvalidationReason invalidationReason) const { | 4615 PaintInvalidationReason invalidationReason) const { |
| 4607 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( | 4616 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( |
| 4608 invalidationReason); | 4617 invalidationReason); |
| 4609 } | 4618 } |
| 4610 | 4619 |
| 4611 } // namespace blink | 4620 } // namespace blink |
| OLD | NEW |