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

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: Rebase after reopen Created 3 years, 12 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) 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 // This is a short-cut for empty lines. 1133 // This is a short-cut for empty lines.
1134 if (layoutState.lineInfo().isEmpty()) { 1134 if (layoutState.lineInfo().isEmpty()) {
1135 ASSERT(!paginationStrutFromDeletedLine); 1135 ASSERT(!paginationStrutFromDeletedLine);
1136 if (lastRootBox()) 1136 if (lastRootBox())
1137 lastRootBox()->setLineBreakInfo(endOfLine.getLineLayoutItem(), 1137 lastRootBox()->setLineBreakInfo(endOfLine.getLineLayoutItem(),
1138 endOfLine.offset(), resolver.status()); 1138 endOfLine.offset(), resolver.status());
1139 resolver.runs().deleteRuns(); 1139 resolver.runs().deleteRuns();
1140 } else { 1140 } else {
1141 VisualDirectionOverride override = 1141 VisualDirectionOverride override =
1142 (styleToUse.rtlOrdering() == EOrder::Visual 1142 (styleToUse.rtlOrdering() == EOrder::Visual
1143 ? (styleToUse.direction() == LTR ? VisualLeftToRightOverride 1143 ? (styleToUse.direction() == TextDirection::Ltr
1144 : VisualRightToLeftOverride) 1144 ? VisualLeftToRightOverride
1145 : VisualRightToLeftOverride)
1145 : NoVisualOverride); 1146 : NoVisualOverride);
1146 if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext && 1147 if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext &&
1147 !resolver.context()->parent()) { 1148 !resolver.context()->parent()) {
1148 TextDirection direction = determinePlaintextDirectionality( 1149 TextDirection direction = determinePlaintextDirectionality(
1149 resolver.position().root(), resolver.position().getLineLayoutItem(), 1150 resolver.position().root(), resolver.position().getLineLayoutItem(),
1150 resolver.position().offset()); 1151 resolver.position().offset());
1151 resolver.setStatus( 1152 resolver.setStatus(
1152 BidiStatus(direction, isOverride(styleToUse.unicodeBidi()))); 1153 BidiStatus(direction, isOverride(styleToUse.unicodeBidi())));
1153 } 1154 }
1154 // FIXME: This ownership is reversed. We should own the BidiRunList and 1155 // FIXME: This ownership is reversed. We should own the BidiRunList and
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 fullstopCharacter}; 2350 fullstopCharacter};
2350 DEFINE_STATIC_LOCAL(AtomicString, fullstopCharacterStr, 2351 DEFINE_STATIC_LOCAL(AtomicString, fullstopCharacterStr,
2351 (fullStopString, fullStopStringLength)); 2352 (fullStopString, fullStopStringLength));
2352 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, 2353 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr,
2353 (&horizontalEllipsisCharacter, 1)); 2354 (&horizontalEllipsisCharacter, 1));
2354 AtomicString& selectedEllipsisStr = ellipsisStr; 2355 AtomicString& selectedEllipsisStr = ellipsisStr;
2355 2356
2356 const Font& firstLineFont = firstLineStyle()->font(); 2357 const Font& firstLineFont = firstLineStyle()->font();
2357 // FIXME: We should probably not hard-code the direction here. 2358 // FIXME: We should probably not hard-code the direction here.
2358 // https://crbug.com/333004 2359 // https://crbug.com/333004
2359 TextDirection ellipsisDirection = LTR; 2360 TextDirection ellipsisDirection = TextDirection::Ltr;
2360 float firstLineEllipsisWidth = 0; 2361 float firstLineEllipsisWidth = 0;
2361 float ellipsisWidth = 0; 2362 float ellipsisWidth = 0;
2362 2363
2363 // As per CSS3 http://www.w3.org/TR/2003/CR-css3-text-20030514/ sequence of 2364 // As per CSS3 http://www.w3.org/TR/2003/CR-css3-text-20030514/ sequence of
2364 // three Full Stops (002E) can be used. 2365 // three Full Stops (002E) can be used.
2365 const SimpleFontData* fontData = firstLineFont.primaryFont(); 2366 const SimpleFontData* fontData = firstLineFont.primaryFont();
2366 DCHECK(fontData); 2367 DCHECK(fontData);
2367 if (fontData && fontData->glyphForCharacter(horizontalEllipsisCharacter)) { 2368 if (fontData && fontData->glyphForCharacter(horizontalEllipsisCharacter)) {
2368 firstLineEllipsisWidth = firstLineFont.width( 2369 firstLineEllipsisWidth = firstLineFont.width(
2369 constructTextRun(firstLineFont, &horizontalEllipsisCharacter, 1, 2370 constructTextRun(firstLineFont, &horizontalEllipsisCharacter, 1,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 2511
2511 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { 2512 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const {
2512 // LayoutBlockFlow is in charge of paint invalidation of the first line. 2513 // LayoutBlockFlow is in charge of paint invalidation of the first line.
2513 if (firstLineBox()) 2514 if (firstLineBox())
2514 return false; 2515 return false;
2515 2516
2516 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); 2517 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize();
2517 } 2518 }
2518 2519
2519 } // namespace blink 2520 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/HitTestResult.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698