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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h

Issue 2877333002: Make EWordBreak an enum class. (Closed)
Patch Set: Release Created 3 years, 7 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 * Copyright (C) 2013 Adobe Systems Incorporated. 6 * Copyright (C) 2013 Adobe Systems Incorporated.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 if (text.PreviousSibling()) 781 if (text.PreviousSibling())
782 return true; 782 return true;
783 // Element boundaries belong to the parent of the element. 783 // Element boundaries belong to the parent of the element.
784 // TODO(kojii): Not all cases of element boundaries are supported yet. 784 // TODO(kojii): Not all cases of element boundaries are supported yet.
785 // crbug.com/282134 785 // crbug.com/282134
786 if (LineLayoutItem element = text.Parent()) { 786 if (LineLayoutItem element = text.Parent()) {
787 if (LineLayoutItem parent = element.Parent()) { 787 if (LineLayoutItem parent = element.Parent()) {
788 const ComputedStyle& parent_style = parent.StyleRef(); 788 const ComputedStyle& parent_style = parent.StyleRef();
789 return parent_style.AutoWrap() && 789 return parent_style.AutoWrap() &&
790 ((parent_style.BreakWords() && !width_.CommittedWidth()) || 790 ((parent_style.BreakWords() && !width_.CommittedWidth()) ||
791 parent_style.WordBreak() == kBreakAllWordBreak); 791 parent_style.WordBreak() == EWordBreak::kBreakAll);
792 } 792 }
793 } 793 }
794 return false; 794 return false;
795 } 795 }
796 796
797 ALWAYS_INLINE bool BreakingContext::RewindToFirstMidWordBreak( 797 ALWAYS_INLINE bool BreakingContext::RewindToFirstMidWordBreak(
798 LineLayoutText text, 798 LineLayoutText text,
799 const ComputedStyle& style, 799 const ComputedStyle& style,
800 const Font& font, 800 const Font& font,
801 bool break_all, 801 bool break_all,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 float width_from_last_breaking_opportunity = width_.UncommittedWidth(); 948 float width_from_last_breaking_opportunity = width_.UncommittedWidth();
949 float char_width = 0; 949 float char_width = 0;
950 // Auto-wrapping text should wrap in the middle of a word only if it could not 950 // Auto-wrapping text should wrap in the middle of a word only if it could not
951 // wrap before the word, which is only possible if the word is the first thing 951 // wrap before the word, which is only possible if the word is the first thing
952 // on the line, that is, if |w| is zero. 952 // on the line, that is, if |w| is zero.
953 bool break_words = current_style_->BreakWords() && 953 bool break_words = current_style_->BreakWords() &&
954 ((auto_wrap_ && !width_.CommittedWidth()) || 954 ((auto_wrap_ && !width_.CommittedWidth()) ||
955 curr_ws_ == EWhiteSpace::kPre); 955 curr_ws_ == EWhiteSpace::kPre);
956 bool mid_word_break = false; 956 bool mid_word_break = false;
957 bool break_all = 957 bool break_all =
958 current_style_->WordBreak() == kBreakAllWordBreak && auto_wrap_; 958 current_style_->WordBreak() == EWordBreak::kBreakAll && auto_wrap_;
959 bool keep_all = 959 bool keep_all =
960 current_style_->WordBreak() == kKeepAllWordBreak && auto_wrap_; 960 current_style_->WordBreak() == EWordBreak::kKeepAll && auto_wrap_;
961 bool prohibit_break_inside = current_style_->HasTextCombine() && 961 bool prohibit_break_inside = current_style_->HasTextCombine() &&
962 layout_text.IsCombineText() && 962 layout_text.IsCombineText() &&
963 LineLayoutTextCombine(layout_text).IsCombined(); 963 LineLayoutTextCombine(layout_text).IsCombined();
964 964
965 // This is currently only used for word-break: break-all, specifically for the 965 // This is currently only used for word-break: break-all, specifically for the
966 // case where we have a break opportunity within a word, then a string of non- 966 // case where we have a break opportunity within a word, then a string of non-
967 // breakable content that ends up making our word wider than the current line. 967 // breakable content that ends up making our word wider than the current line.
968 // See: fast/css3-text/css3-word-break/word-break-all-wrap-with-floats.html 968 // See: fast/css3-text/css3-word-break/word-break-all-wrap-with-floats.html
969 float width_measurement_at_last_break_opportunity = 0; 969 float width_measurement_at_last_break_opportunity = 0;
970 970
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 1566
1567 if (style.GetTextIndentType() == kTextIndentHanging) 1567 if (style.GetTextIndentType() == kTextIndentHanging)
1568 indent_text = indent_text == kIndentText ? kDoNotIndentText : kIndentText; 1568 indent_text = indent_text == kIndentText ? kDoNotIndentText : kIndentText;
1569 1569
1570 return indent_text; 1570 return indent_text;
1571 } 1571 }
1572 1572
1573 } // namespace blink 1573 } // namespace blink
1574 1574
1575 #endif // BreakingContextInlineHeaders_h 1575 #endif // BreakingContextInlineHeaders_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698