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

Side by Side Diff: Source/core/rendering/line/BreakingContextInlineHeaders.h

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix a crashers (everything is building!) Created 5 years, 10 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
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.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 InlineBidiResolver& m_resolver; 112 InlineBidiResolver& m_resolver;
113 113
114 InlineIterator m_current; 114 InlineIterator m_current;
115 InlineIterator m_lineBreak; 115 InlineIterator m_lineBreak;
116 InlineIterator m_startOfIgnoredSpaces; 116 InlineIterator m_startOfIgnoredSpaces;
117 117
118 RenderBlockFlow* m_block; 118 RenderBlockFlow* m_block;
119 RenderObject* m_lastObject; 119 RenderObject* m_lastObject;
120 RenderObject* m_nextObject; 120 RenderObject* m_nextObject;
121 121
122 RenderStyle* m_currentStyle; 122 const RenderStyle* m_currentStyle;
123 RenderStyle* m_blockStyle; 123 const RenderStyle* m_blockStyle;
124 124
125 LineInfo& m_lineInfo; 125 LineInfo& m_lineInfo;
126 126
127 RenderTextInfo& m_renderTextInfo; 127 RenderTextInfo& m_renderTextInfo;
128 128
129 FloatingObject* m_lastFloatFromPreviousLine; 129 FloatingObject* m_lastFloatFromPreviousLine;
130 130
131 LineWidth m_width; 131 LineWidth m_width;
132 132
133 EWhiteSpace m_currWS; 133 EWhiteSpace m_currWS;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 { 495 {
496 for (size_t i = 0; i < wordMeasurements.size(); ++i) { 496 for (size_t i = 0; i < wordMeasurements.size(); ++i) {
497 if (wordMeasurements[i].width > 0) 497 if (wordMeasurements[i].width > 0)
498 return wordMeasurements[i].width; 498 return wordMeasurements[i].width;
499 } 499 }
500 return 0; 500 return 0;
501 } 501 }
502 502
503 inline float measureHyphenWidth(RenderText* renderer, const Font& font, TextDire ction textDirection) 503 inline float measureHyphenWidth(RenderText* renderer, const Font& font, TextDire ction textDirection)
504 { 504 {
505 RenderStyle* style = renderer->style(); 505 const RenderStyle* style = renderer->style();
506 return font.width(constructTextRun(renderer, font, 506 return font.width(constructTextRun(renderer, font,
507 style->hyphenString().string(), style, style->direction())); 507 style->hyphenString().string(), style, style->direction()));
508 } 508 }
509 509
510 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir ection) 510 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir ection)
511 { 511 {
512 return direction == WTF::Unicode::RightToLeft 512 return direction == WTF::Unicode::RightToLeft
513 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR; 513 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR;
514 } 514 }
515 515
(...skipping 30 matching lines...) Expand all
546 RenderCombineText* combineRenderer = toRenderCombineText(m_current.objec t()); 546 RenderCombineText* combineRenderer = toRenderCombineText(m_current.objec t());
547 combineRenderer->combineText(); 547 combineRenderer->combineText();
548 // The length of the renderer's text may have changed. Increment stale i terator positions 548 // The length of the renderer's text may have changed. Increment stale i terator positions
549 if (iteratorIsBeyondEndOfRenderCombineText(m_lineBreak, combineRenderer) ) { 549 if (iteratorIsBeyondEndOfRenderCombineText(m_lineBreak, combineRenderer) ) {
550 ASSERT(iteratorIsBeyondEndOfRenderCombineText(m_resolver.position(), combineRenderer)); 550 ASSERT(iteratorIsBeyondEndOfRenderCombineText(m_resolver.position(), combineRenderer));
551 m_lineBreak.increment(); 551 m_lineBreak.increment();
552 m_resolver.position().increment(&m_resolver); 552 m_resolver.position().increment(&m_resolver);
553 } 553 }
554 } 554 }
555 555
556 RenderStyle* style = renderText->style(m_lineInfo.isFirstLine()); 556 const RenderStyle* style = renderText->style(m_lineInfo.isFirstLine());
557 const Font& font = style->font(); 557 const Font& font = style->font();
558 bool isFixedPitch = font.isFixedPitch(); 558 bool isFixedPitch = font.isFixedPitch();
559 559
560 unsigned lastSpace = m_current.offset(); 560 unsigned lastSpace = m_current.offset();
561 float wordSpacing = m_currentStyle->wordSpacing(); 561 float wordSpacing = m_currentStyle->wordSpacing();
562 float lastSpaceWordSpacing = 0; 562 float lastSpaceWordSpacing = 0;
563 float wordSpacingForWordMeasurement = 0; 563 float wordSpacingForWordMeasurement = 0;
564 564
565 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje ct(), !m_appliedStartWidth, true); 565 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje ct(), !m_appliedStartWidth, true);
566 float charWidth = 0; 566 float charWidth = 0;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 892
893 if (!m_current.object()->isFloatingOrOutOfFlowPositioned()) { 893 if (!m_current.object()->isFloatingOrOutOfFlowPositioned()) {
894 m_lastObject = m_current.object(); 894 m_lastObject = m_current.object();
895 if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage( ) || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toRenderListMark er(m_lastObject)->isInside())) { 895 if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage( ) || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toRenderListMark er(m_lastObject)->isInside())) {
896 m_width.commit(); 896 m_width.commit();
897 m_lineBreak.moveToStartOf(m_nextObject); 897 m_lineBreak.moveToStartOf(m_nextObject);
898 } 898 }
899 } 899 }
900 } 900 }
901 901
902 inline IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea k, RenderStyle* style) 902 inline IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea k, const RenderStyle* style)
903 { 903 {
904 IndentTextOrNot shouldIndentText = DoNotIndentText; 904 IndentTextOrNot shouldIndentText = DoNotIndentText;
905 if (isFirstLine || (isAfterHardLineBreak && style->textIndentLine()) == Text IndentEachLine) 905 if (isFirstLine || (isAfterHardLineBreak && style->textIndentLine()) == Text IndentEachLine)
906 shouldIndentText = IndentText; 906 shouldIndentText = IndentText;
907 907
908 if (style->textIndentType() == TextIndentHanging) 908 if (style->textIndentType() == TextIndentHanging)
909 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText; 909 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText;
910 910
911 return shouldIndentText; 911 return shouldIndentText;
912 } 912 }
913 913
914 } 914 }
915 915
916 #endif // BreakingContextInlineHeaders_h 916 #endif // BreakingContextInlineHeaders_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698