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

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

Issue 2555923002: Changed TextDirection to an enum class and renamed its members (Closed)
Patch Set: Small rebase fixes Created 4 years 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All right reserved. 4 * All right reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 availableLogicalWidth); 693 availableLogicalWidth);
694 if (expansionOpportunityCount) { 694 if (expansionOpportunityCount) {
695 if (trailingSpaceRun) { 695 if (trailingSpaceRun) {
696 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); 696 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth();
697 trailingSpaceRun->m_box->setLogicalWidth(LayoutUnit()); 697 trailingSpaceRun->m_box->setLogicalWidth(LayoutUnit());
698 } 698 }
699 break; 699 break;
700 } 700 }
701 // Fall through 701 // Fall through
702 case ETextAlign::Start: 702 case ETextAlign::Start:
703 if (direction == LTR) 703 if (direction == TextDirection::Ltr)
704 updateLogicalWidthForLeftAlignedBlock( 704 updateLogicalWidthForLeftAlignedBlock(
705 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, 705 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft,
706 totalLogicalWidth, availableLogicalWidth); 706 totalLogicalWidth, availableLogicalWidth);
707 else 707 else
708 updateLogicalWidthForRightAlignedBlock( 708 updateLogicalWidthForRightAlignedBlock(
709 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, 709 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft,
710 totalLogicalWidth, availableLogicalWidth); 710 totalLogicalWidth, availableLogicalWidth);
711 break; 711 break;
712 case ETextAlign::End: 712 case ETextAlign::End:
713 if (direction == LTR) 713 if (direction == TextDirection::Ltr)
714 updateLogicalWidthForRightAlignedBlock( 714 updateLogicalWidthForRightAlignedBlock(
715 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, 715 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft,
716 totalLogicalWidth, availableLogicalWidth); 716 totalLogicalWidth, availableLogicalWidth);
717 else 717 else
718 updateLogicalWidthForLeftAlignedBlock( 718 updateLogicalWidthForLeftAlignedBlock(
719 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, 719 style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft,
720 totalLogicalWidth, availableLogicalWidth); 720 totalLogicalWidth, availableLogicalWidth);
721 break; 721 break;
722 } 722 }
723 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 723 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 // This is a short-cut for empty lines. 1134 // This is a short-cut for empty lines.
1135 if (layoutState.lineInfo().isEmpty()) { 1135 if (layoutState.lineInfo().isEmpty()) {
1136 ASSERT(!paginationStrutFromDeletedLine); 1136 ASSERT(!paginationStrutFromDeletedLine);
1137 if (lastRootBox()) 1137 if (lastRootBox())
1138 lastRootBox()->setLineBreakInfo(endOfLine.getLineLayoutItem(), 1138 lastRootBox()->setLineBreakInfo(endOfLine.getLineLayoutItem(),
1139 endOfLine.offset(), resolver.status()); 1139 endOfLine.offset(), resolver.status());
1140 resolver.runs().deleteRuns(); 1140 resolver.runs().deleteRuns();
1141 } else { 1141 } else {
1142 VisualDirectionOverride override = 1142 VisualDirectionOverride override =
1143 (styleToUse.rtlOrdering() == EOrder::Visual 1143 (styleToUse.rtlOrdering() == EOrder::Visual
1144 ? (styleToUse.direction() == LTR ? VisualLeftToRightOverride 1144 ? (styleToUse.direction() == TextDirection::Ltr
1145 : VisualRightToLeftOverride) 1145 ? VisualLeftToRightOverride
1146 : VisualRightToLeftOverride)
1146 : NoVisualOverride); 1147 : NoVisualOverride);
1147 if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext && 1148 if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext &&
1148 !resolver.context()->parent()) { 1149 !resolver.context()->parent()) {
1149 TextDirection direction = determinePlaintextDirectionality( 1150 TextDirection direction = determinePlaintextDirectionality(
1150 resolver.position().root(), resolver.position().getLineLayoutItem(), 1151 resolver.position().root(), resolver.position().getLineLayoutItem(),
1151 resolver.position().offset()); 1152 resolver.position().offset());
1152 resolver.setStatus( 1153 resolver.setStatus(
1153 BidiStatus(direction, isOverride(styleToUse.unicodeBidi()))); 1154 BidiStatus(direction, isOverride(styleToUse.unicodeBidi())));
1154 } 1155 }
1155 // FIXME: This ownership is reversed. We should own the BidiRunList and 1156 // FIXME: This ownership is reversed. We should own the BidiRunList and
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 fullstopCharacter}; 2351 fullstopCharacter};
2351 DEFINE_STATIC_LOCAL(AtomicString, fullstopCharacterStr, 2352 DEFINE_STATIC_LOCAL(AtomicString, fullstopCharacterStr,
2352 (fullStopString, fullStopStringLength)); 2353 (fullStopString, fullStopStringLength));
2353 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, 2354 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr,
2354 (&horizontalEllipsisCharacter, 1)); 2355 (&horizontalEllipsisCharacter, 1));
2355 AtomicString& selectedEllipsisStr = ellipsisStr; 2356 AtomicString& selectedEllipsisStr = ellipsisStr;
2356 2357
2357 const Font& firstLineFont = firstLineStyle()->font(); 2358 const Font& firstLineFont = firstLineStyle()->font();
2358 // FIXME: We should probably not hard-code the direction here. 2359 // FIXME: We should probably not hard-code the direction here.
2359 // https://crbug.com/333004 2360 // https://crbug.com/333004
2360 TextDirection ellipsisDirection = LTR; 2361 TextDirection ellipsisDirection = TextDirection::Ltr;
2361 float firstLineEllipsisWidth = 0; 2362 float firstLineEllipsisWidth = 0;
2362 float ellipsisWidth = 0; 2363 float ellipsisWidth = 0;
2363 2364
2364 // As per CSS3 http://www.w3.org/TR/2003/CR-css3-text-20030514/ sequence of 2365 // As per CSS3 http://www.w3.org/TR/2003/CR-css3-text-20030514/ sequence of
2365 // three Full Stops (002E) can be used. 2366 // three Full Stops (002E) can be used.
2366 const SimpleFontData* fontData = firstLineFont.primaryFont(); 2367 const SimpleFontData* fontData = firstLineFont.primaryFont();
2367 DCHECK(fontData); 2368 DCHECK(fontData);
2368 if (fontData && fontData->glyphForCharacter(horizontalEllipsisCharacter)) { 2369 if (fontData && fontData->glyphForCharacter(horizontalEllipsisCharacter)) {
2369 firstLineEllipsisWidth = firstLineFont.width( 2370 firstLineEllipsisWidth = firstLineFont.width(
2370 constructTextRun(firstLineFont, &horizontalEllipsisCharacter, 1, 2371 constructTextRun(firstLineFont, &horizontalEllipsisCharacter, 1,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 2512
2512 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { 2513 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const {
2513 // LayoutBlockFlow is in charge of paint invalidation of the first line. 2514 // LayoutBlockFlow is in charge of paint invalidation of the first line.
2514 if (firstLineBox()) 2515 if (firstLineBox())
2515 return false; 2516 return false;
2516 2517
2517 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); 2518 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize();
2518 } 2519 }
2519 2520
2520 } // namespace blink 2521 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698