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

Side by Side Diff: sky/engine/core/rendering/line/BreakingContextInlineHeaders.h

Issue 677843004: Remove text-combine. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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) 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. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * Copyright (C) 2013 Adobe Systems Incorporated. 5 * Copyright (C) 2013 Adobe Systems Incorporated.
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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef BreakingContextInlineHeaders_h 24 #ifndef BreakingContextInlineHeaders_h
25 #define BreakingContextInlineHeaders_h 25 #define BreakingContextInlineHeaders_h
26 26
27 #include "core/rendering/InlineIterator.h" 27 #include "core/rendering/InlineIterator.h"
28 #include "core/rendering/InlineTextBox.h" 28 #include "core/rendering/InlineTextBox.h"
29 #include "core/rendering/RenderCombineText.h"
30 #include "core/rendering/RenderInline.h" 29 #include "core/rendering/RenderInline.h"
31 #include "core/rendering/RenderLayer.h" 30 #include "core/rendering/RenderLayer.h"
32 #include "core/rendering/RenderObjectInlines.h" 31 #include "core/rendering/RenderObjectInlines.h"
33 #include "core/rendering/TextRunConstructor.h" 32 #include "core/rendering/TextRunConstructor.h"
34 #include "core/rendering/break_lines.h" 33 #include "core/rendering/break_lines.h"
35 #include "core/rendering/line/LineBreaker.h" 34 #include "core/rendering/line/LineBreaker.h"
36 #include "core/rendering/line/LineInfo.h" 35 #include "core/rendering/line/LineInfo.h"
37 #include "core/rendering/line/LineWidth.h" 36 #include "core/rendering/line/LineWidth.h"
38 #include "core/rendering/line/RenderTextInfo.h" 37 #include "core/rendering/line/RenderTextInfo.h"
39 #include "core/rendering/line/TrailingObjects.h" 38 #include "core/rendering/line/TrailingObjects.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 m_trailingObjects.clear(); 423 m_trailingObjects.clear();
425 424
426 // Optimize for a common case. If we can't find whitespace after the list 425 // Optimize for a common case. If we can't find whitespace after the list
427 // item, then this is all moot. 426 // item, then this is all moot.
428 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replac edBox) + inlineLogicalWidth(m_current.object()); 427 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replac edBox) + inlineLogicalWidth(m_current.object());
429 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); 428 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat());
430 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM ENT CHARACTER) for replaced element. 429 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM ENT CHARACTER) for replaced element.
431 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter ); 430 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter );
432 } 431 }
433 432
434 inline bool iteratorIsBeyondEndOfRenderCombineText(const InlineIterator& iter, R enderCombineText* renderer)
435 {
436 return iter.object() == renderer && iter.offset() >= renderer->textLength();
437 }
438
439 inline void nextCharacter(UChar& currentCharacter, UChar& lastCharacter, UChar& secondToLastCharacter) 433 inline void nextCharacter(UChar& currentCharacter, UChar& lastCharacter, UChar& secondToLastCharacter)
440 { 434 {
441 secondToLastCharacter = lastCharacter; 435 secondToLastCharacter = lastCharacter;
442 lastCharacter = currentCharacter; 436 lastCharacter = currentCharacter;
443 } 437 }
444 438
445 inline float firstPositiveWidth(const WordMeasurements& wordMeasurements) 439 inline float firstPositiveWidth(const WordMeasurements& wordMeasurements)
446 { 440 {
447 for (size_t i = 0; i < wordMeasurements.size(); ++i) { 441 for (size_t i = 0; i < wordMeasurements.size(); ++i) {
448 if (wordMeasurements[i].width > 0) 442 if (wordMeasurements[i].width > 0)
(...skipping 11 matching lines...) Expand all
460 454
461 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir ection) 455 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir ection)
462 { 456 {
463 return direction == WTF::Unicode::RightToLeft 457 return direction == WTF::Unicode::RightToLeft
464 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR; 458 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR;
465 } 459 }
466 460
467 ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, con st Font& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<c onst SimpleFontData*>* fallbackFonts = 0) 461 ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, con st Font& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<c onst SimpleFontData*>* fallbackFonts = 0)
468 { 462 {
469 GlyphOverflow glyphOverflow; 463 GlyphOverflow glyphOverflow;
470 if (isFixedPitch || (!from && len == text->textLength()) || text->style()->h asTextCombine()) 464 if (isFixedPitch || (!from && len == text->textLength()))
471 return text->width(from, len, font, xPos, text->style()->direction(), fa llbackFonts, &glyphOverflow); 465 return text->width(from, len, font, xPos, text->style()->direction(), fa llbackFonts, &glyphOverflow);
472 466
473 TextRun run = constructTextRun(text, font, text, from, len, text->style()); 467 TextRun run = constructTextRun(text, font, text, from, len, text->style());
474 run.setCharacterScanForCodePath(!text->canUseSimpleFontCodePath()); 468 run.setCharacterScanForCodePath(!text->canUseSimpleFontCodePath());
475 run.setTabSize(!collapseWhiteSpace, text->style()->tabSize()); 469 run.setTabSize(!collapseWhiteSpace, text->style()->tabSize());
476 run.setXPos(xPos); 470 run.setXPos(xPos);
477 return font.width(run, fallbackFonts, &glyphOverflow); 471 return font.width(run, fallbackFonts, &glyphOverflow);
478 } 472 }
479 473
480 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool & hyphenated) 474 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool & hyphenated)
481 { 475 {
482 if (!m_current.offset()) 476 if (!m_current.offset())
483 m_appliedStartWidth = false; 477 m_appliedStartWidth = false;
484 478
485 RenderText* renderText = toRenderText(m_current.object()); 479 RenderText* renderText = toRenderText(m_current.object());
486 480
487 // If we have left a no-wrap inline and entered an autowrap inline while ign oring spaces 481 // If we have left a no-wrap inline and entered an autowrap inline while ign oring spaces
488 // then we need to mark the start of the autowrap inline as a potential line break now. 482 // then we need to mark the start of the autowrap inline as a potential line break now.
489 if (m_autoWrap && !RenderStyle::autoWrap(m_lastWS) && m_ignoringSpaces) { 483 if (m_autoWrap && !RenderStyle::autoWrap(m_lastWS) && m_ignoringSpaces) {
490 m_width.commit(); 484 m_width.commit();
491 m_lineBreak.moveToStartOf(m_current.object()); 485 m_lineBreak.moveToStartOf(m_current.object());
492 } 486 }
493 487
494 if (renderText->style()->hasTextCombine() && m_current.object()->isCombineTe xt() && !toRenderCombineText(m_current.object())->isCombined()) {
495 RenderCombineText* combineRenderer = toRenderCombineText(m_current.objec t());
496 combineRenderer->combineText();
497 // The length of the renderer's text may have changed. Increment stale i terator positions
498 if (iteratorIsBeyondEndOfRenderCombineText(m_lineBreak, combineRenderer) ) {
499 ASSERT(iteratorIsBeyondEndOfRenderCombineText(m_resolver.position(), combineRenderer));
500 m_lineBreak.increment();
501 m_resolver.position().increment(&m_resolver);
502 }
503 }
504
505 RenderStyle* style = renderText->style(m_lineInfo.isFirstLine()); 488 RenderStyle* style = renderText->style(m_lineInfo.isFirstLine());
506 const Font& font = style->font(); 489 const Font& font = style->font();
507 bool isFixedPitch = font.isFixedPitch(); 490 bool isFixedPitch = font.isFixedPitch();
508 491
509 unsigned lastSpace = m_current.offset(); 492 unsigned lastSpace = m_current.offset();
510 float wordSpacing = m_currentStyle->wordSpacing(); 493 float wordSpacing = m_currentStyle->wordSpacing();
511 float lastSpaceWordSpacing = 0; 494 float lastSpaceWordSpacing = 0;
512 float wordSpacingForWordMeasurement = 0; 495 float wordSpacingForWordMeasurement = 0;
513 496
514 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje ct(), !m_appliedStartWidth, true); 497 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje ct(), !m_appliedStartWidth, true);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 820
838 if (style->textIndentType() == TextIndentHanging) 821 if (style->textIndentType() == TextIndentHanging)
839 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText; 822 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText;
840 823
841 return shouldIndentText; 824 return shouldIndentText;
842 } 825 }
843 826
844 } 827 }
845 828
846 #endif // BreakingContextInlineHeaders_h 829 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderText.cpp ('k') | sky/engine/core/rendering/line/LineBreaker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698