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

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

Issue 1312713005: [Line Layout API] Add rubyBase to LineLayoutRubyRun (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/api/LineLayoutRubyRun.h ('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 14 matching lines...) Expand all
25 #include "core/layout/HitTestResult.h" 25 #include "core/layout/HitTestResult.h"
26 #include "core/layout/LayoutBlock.h" 26 #include "core/layout/LayoutBlock.h"
27 #include "core/layout/LayoutInline.h" 27 #include "core/layout/LayoutInline.h"
28 #include "core/layout/LayoutListMarker.h" 28 #include "core/layout/LayoutListMarker.h"
29 #include "core/layout/LayoutObjectInlines.h" 29 #include "core/layout/LayoutObjectInlines.h"
30 #include "core/layout/LayoutRubyBase.h" 30 #include "core/layout/LayoutRubyBase.h"
31 #include "core/layout/LayoutRubyRun.h" 31 #include "core/layout/LayoutRubyRun.h"
32 #include "core/layout/LayoutRubyText.h" 32 #include "core/layout/LayoutRubyText.h"
33 #include "core/layout/LayoutView.h" 33 #include "core/layout/LayoutView.h"
34 #include "core/layout/api/LineLayoutBox.h" 34 #include "core/layout/api/LineLayoutBox.h"
35 #include "core/layout/api/LineLayoutRubyRun.h"
35 #include "core/layout/line/GlyphOverflow.h" 36 #include "core/layout/line/GlyphOverflow.h"
36 #include "core/layout/line/InlineTextBox.h" 37 #include "core/layout/line/InlineTextBox.h"
37 #include "core/layout/line/RootInlineBox.h" 38 #include "core/layout/line/RootInlineBox.h"
38 #include "core/paint/BoxPainter.h" 39 #include "core/paint/BoxPainter.h"
39 #include "core/paint/InlineFlowBoxPainter.h" 40 #include "core/paint/InlineFlowBoxPainter.h"
40 #include "core/style/ShadowList.h" 41 #include "core/style/ShadowList.h"
41 #include "platform/fonts/Font.h" 42 #include "platform/fonts/Font.h"
42 43
43 #include <math.h> 44 #include <math.h>
44 45
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 if (childAffectsTopBottomPos) { 644 if (childAffectsTopBottomPos) {
644 if (curr->layoutObject().isRubyRun()) { 645 if (curr->layoutObject().isRubyRun()) {
645 // Treat the leading on the first and last lines of ruby runs as not being part of the overall lineTop/lineBottom. 646 // Treat the leading on the first and last lines of ruby runs as not being part of the overall lineTop/lineBottom.
646 // Really this is a workaround hack for the fact that ruby shoul d have been done as line layout and not done using 647 // Really this is a workaround hack for the fact that ruby shoul d have been done as line layout and not done using
647 // inline-block. 648 // inline-block.
648 if (layoutObject().style()->isFlippedLinesWritingMode() == (curr ->layoutObject().style()->rubyPosition() == RubyPositionAfter)) 649 if (layoutObject().style()->isFlippedLinesWritingMode() == (curr ->layoutObject().style()->rubyPosition() == RubyPositionAfter))
649 hasAnnotationsBefore = true; 650 hasAnnotationsBefore = true;
650 else 651 else
651 hasAnnotationsAfter = true; 652 hasAnnotationsAfter = true;
652 653
653 LayoutRubyRun& rubyRun = toLayoutRubyRun(curr->layoutObject()); 654 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->lineLayoutIt em());
654 if (LayoutRubyBase* rubyBase = rubyRun.rubyBase()) { 655 if (LayoutRubyBase* rubyBase = rubyRun.rubyBase()) {
655 LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox( ) ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit()); 656 LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox( ) ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit());
656 LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (ru byBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : LayoutUnit()); 657 LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (ru byBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : LayoutUnit());
657 newLogicalTop += !layoutObject().style()->isFlippedLinesWrit ingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; 658 newLogicalTop += !layoutObject().style()->isFlippedLinesWrit ingMode() ? topRubyBaseLeading : bottomRubyBaseLeading;
658 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); 659 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading);
659 } 660 }
660 } 661 }
661 if (curr->isInlineTextBox()) { 662 if (curr->isInlineTextBox()) {
662 TextEmphasisPosition emphasisMarkPosition; 663 TextEmphasisPosition emphasisMarkPosition;
663 if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->layoutO bject().styleRef(isFirstLineStyle()), emphasisMarkPosition)) { 664 if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->layoutO bject().styleRef(isFirstLineStyle()), emphasisMarkPosition)) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 { 1137 {
1137 LayoutUnit result = 0; 1138 LayoutUnit result = 0;
1138 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1139 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
1139 if (curr->layoutObject().isOutOfFlowPositioned()) 1140 if (curr->layoutObject().isOutOfFlowPositioned())
1140 continue; // Positioned placeholders don't affect calculations. 1141 continue; // Positioned placeholders don't affect calculations.
1141 1142
1142 if (curr->isInlineFlowBox()) 1143 if (curr->isInlineFlowBox())
1143 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati onAdjustment(allowedPosition)); 1144 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati onAdjustment(allowedPosition));
1144 1145
1145 if (curr->layoutObject().isReplaced() && curr->layoutObject().isRubyRun( ) && curr->layoutObject().style()->rubyPosition() == RubyPositionBefore) { 1146 if (curr->layoutObject().isReplaced() && curr->layoutObject().isRubyRun( ) && curr->layoutObject().style()->rubyPosition() == RubyPositionBefore) {
1146 LayoutRubyRun& rubyRun = toLayoutRubyRun(curr->layoutObject()); 1147 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->lineLayoutItem() );
1147 LayoutRubyText* rubyText = rubyRun.rubyText(); 1148 LayoutRubyText* rubyText = rubyRun.rubyText();
1148 if (!rubyText) 1149 if (!rubyText)
1149 continue; 1150 continue;
1150 1151
1151 if (!rubyRun.style()->isFlippedLinesWritingMode()) { 1152 if (!rubyRun.style()->isFlippedLinesWritingMode()) {
1152 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); 1153 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
1153 if (topOfFirstRubyTextLine >= 0) 1154 if (topOfFirstRubyTextLine >= 0)
1154 continue; 1155 continue;
1155 topOfFirstRubyTextLine += curr->logicalTop(); 1156 topOfFirstRubyTextLine += curr->logicalTop();
1156 result = std::max(result, allowedPosition - topOfFirstRubyTextLi ne); 1157 result = std::max(result, allowedPosition - topOfFirstRubyTextLi ne);
(...skipping 27 matching lines...) Expand all
1184 { 1185 {
1185 LayoutUnit result = 0; 1186 LayoutUnit result = 0;
1186 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1187 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
1187 if (curr->layoutObject().isOutOfFlowPositioned()) 1188 if (curr->layoutObject().isOutOfFlowPositioned())
1188 continue; // Positioned placeholders don't affect calculations. 1189 continue; // Positioned placeholders don't affect calculations.
1189 1190
1190 if (curr->isInlineFlowBox()) 1191 if (curr->isInlineFlowBox())
1191 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat ionAdjustment(allowedPosition)); 1192 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat ionAdjustment(allowedPosition));
1192 1193
1193 if (curr->layoutObject().isReplaced() && curr->layoutObject().isRubyRun( ) && curr->layoutObject().style()->rubyPosition() == RubyPositionAfter) { 1194 if (curr->layoutObject().isReplaced() && curr->layoutObject().isRubyRun( ) && curr->layoutObject().style()->rubyPosition() == RubyPositionAfter) {
1194 LayoutRubyRun& rubyRun = toLayoutRubyRun(curr->layoutObject()); 1195 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->lineLayoutItem() );
1195 LayoutRubyText* rubyText = rubyRun.rubyText(); 1196 LayoutRubyText* rubyText = rubyRun.rubyText();
1196 if (!rubyText) 1197 if (!rubyText)
1197 continue; 1198 continue;
1198 1199
1199 if (rubyRun.style()->isFlippedLinesWritingMode()) { 1200 if (rubyRun.style()->isFlippedLinesWritingMode()) {
1200 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); 1201 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
1201 if (topOfFirstRubyTextLine >= 0) 1202 if (topOfFirstRubyTextLine >= 0)
1202 continue; 1203 continue;
1203 topOfFirstRubyTextLine += curr->logicalTop(); 1204 topOfFirstRubyTextLine += curr->logicalTop();
1204 result = std::max(result, allowedPosition - topOfFirstRubyTextLi ne); 1205 result = std::max(result, allowedPosition - topOfFirstRubyTextLi ne);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 ASSERT(child->prevOnLine() == prev); 1309 ASSERT(child->prevOnLine() == prev);
1309 prev = child; 1310 prev = child;
1310 } 1311 }
1311 ASSERT(prev == m_lastChild); 1312 ASSERT(prev == m_lastChild);
1312 #endif 1313 #endif
1313 } 1314 }
1314 1315
1315 #endif 1316 #endif
1316 1317
1317 } // namespace blink 1318 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/api/LineLayoutRubyRun.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698