+2011-09-07 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/8881922> Support the hyphenate-limit-lines property
+ https://bugs.webkit.org/show_bug.cgi?id=67730
+
+ Reviewed by Dave Hyatt.
+
+ * fast/css/parsing-hyphenate-limit-lines-expected.txt: Added.
+ * fast/css/parsing-hyphenate-limit-lines.html: Added.
+ * fast/text/hyphenate-limit-lines.html: Added.
+ * platform/mac/fast/text/hyphenate-limit-lines-expected.png: Added.
+ * platform/mac/fast/text/hyphenate-limit-lines-expected.txt: Added.
+
2011-09-07 Csaba Osztrogonác <ossy@webkit.org>
[Qt] Unreviewed gardening after r94697.
--- /dev/null
+PASS: '-webkit-hyphenate-limit-lines: initial;' parsed as 'initial'
+PASS: '-webkit-hyphenate-limit-lines: inherit;' parsed as 'inherit'
+PASS: '-webkit-hyphenate-limit-lines: no-limit;' parsed as 'no-limit'
+PASS: '-webkit-hyphenate-limit-lines: 0;' parsed as '0'
+PASS: '-webkit-hyphenate-limit-lines: 4;' parsed as '4'
+PASS: '-webkit-hyphenate-limit-lines: 2 2;' parsed as ''
+PASS: '-webkit-hyphenate-limit-lines: 2px;' parsed as ''
+PASS: '-webkit-hyphenate-limit-lines: -1;' parsed as ''
+PASS: '-webkit-hyphenate-limit-lines: "1";' parsed as ''
+
--- /dev/null
+<pre id="console"></pre>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function log(message)
+ {
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+ }
+
+ function test(declaration, expectedHyphenateLimit)
+ {
+ var element = document.createElement("div");
+ element.style.cssText = declaration;
+ var hyphenateLimit = element.style.webkitHyphenateLimitLines;
+ if (hyphenateLimit === expectedHyphenateLimit)
+ log("PASS: '" + declaration + "' parsed as '" + hyphenateLimit + "'");
+ else
+ log("FAIL: '" + declaration + "' parsed as '" + hyphenateLimit + "'");
+ }
+
+ test('-webkit-hyphenate-limit-lines: initial;', 'initial');
+ test('-webkit-hyphenate-limit-lines: inherit;', 'inherit');
+ test('-webkit-hyphenate-limit-lines: no-limit;', 'no-limit');
+ test('-webkit-hyphenate-limit-lines: 0;', '0');
+ test('-webkit-hyphenate-limit-lines: 4;', '4');
+ test('-webkit-hyphenate-limit-lines: 2 2;', '');
+ test('-webkit-hyphenate-limit-lines: 2px;', '');
+ test('-webkit-hyphenate-limit-lines: -1;', '');
+ test('-webkit-hyphenate-limit-lines: "1";', '');
+</script>
--- /dev/null
+<style>
+ div {
+ width: 200px;
+ font-size: 26px;
+ -webkit-hyphens: auto;
+ text-align: justify;
+ margin: 0 4px;
+ float: left;
+ border: solid thin lightblue;
+ -webkit-locale: "en_US";
+ }
+</style>
+<div style="-webkit-hyphenate-limit-lines: no-limit;">
+ also the division of the mind into the rational, concupiscent, and
+ irascible elements, or of pleasures and desires into necessary and
+ unnecessary—these and other great forms of thought are all of them
+ to be found in the Republic, and were probably first invented by
+ Plato.
+</div>
+
+<div style="-webkit-hyphenate-limit-lines: 3;">
+ also the division of the mind into the rational, concupiscent, and
+ irascible elements, or of pleasures and desires into necessary and
+ unnecessary—these and other great forms of thought are all of them
+ to be found in the Republic, and were probably first invented by
+ Plato.
+</div>
+
+<div style="-webkit-hyphenate-limit-lines: 2;">
+ also the division of the mind into the rational, concupiscent, and
+ irascible elements, or of pleasures and desires into necessary and
+ unnecessary—these and other great forms of thought are all of them
+ to be found in the Republic, and were probably first invented by
+ Plato.
+</div>
+
+<div style="-webkit-hyphenate-limit-lines: 1;">
+ also the division of the mind into the rational, concupiscent, and
+ irascible elements, or of pleasures and desires into necessary and
+ unnecessary—these and other great forms of thought are all of them
+ to be found in the Republic, and were probably first invented by
+ Plato.
+</div>
+
+<div style="-webkit-hyphenate-limit-lines: 0;">
+ also the division of the mind into the rational, concupiscent, and
+ irascible elements, or of pleasures and desires into necessary and
+ unnecessary—these and other great forms of thought are all of them
+ to be found in the Republic, and were probably first invented by
+ Plato.
+</div>
--- /dev/null
+layer at (0,0) size 785x1066
+ RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1066
+ RenderBlock {HTML} at (0,0) size 785x1066
+ RenderBody {BODY} at (8,8) size 769x584
+ RenderBlock (floating) {DIV} at (4,0) size 202x498 [border: (1px solid #ADD8E6)]
+ RenderText {#text} at (1,1) size 200x496
+ text run at (1,1) width 200: "also the division of"
+ text run at (1,32) width 200: "the mind into the"
+ text run at (1,63) width 200: "rational, concupis" + hyphen string "-"
+ text run at (1,94) width 111: "cent, and "
+ text run at (112,94) width 89: "irascible"
+ text run at (1,125) width 200: "elements, or of"
+ text run at (1,156) width 200: "pleasures and de" + hyphen string "-"
+ text run at (1,187) width 200: "sires into neces" + hyphen string "-"
+ text run at (1,218) width 106: "sary and "
+ text run at (107,218) width 94: "unneces" + hyphen string "-"
+ text run at (1,249) width 200: "sary\x{2014}these and"
+ text run at (1,280) width 200: "other great forms"
+ text run at (1,311) width 200: "of thought are all"
+ text run at (1,342) width 128: "of them "
+ text run at (129,342) width 72: "to be"
+ text run at (1,373) width 200: "found in the Re" + hyphen string "-"
+ text run at (1,404) width 200: "public, and were"
+ text run at (1,435) width 200: "probably first in" + hyphen string "-"
+ text run at (1,466) width 110: "vented by "
+ text run at (111,466) width 60: "Plato."
+ RenderBlock (floating) {DIV} at (214,0) size 202x498 [border: (1px solid #ADD8E6)]
+ RenderText {#text} at (1,1) size 200x496
+ text run at (1,1) width 200: "also the division of"
+ text run at (1,32) width 200: "the mind into the"
+ text run at (1,63) width 200: "rational, concupis" + hyphen string "-"
+ text run at (1,94) width 111: "cent, and "
+ text run at (112,94) width 89: "irascible"
+ text run at (1,125) width 200: "elements, or of"
+ text run at (1,156) width 200: "pleasures and de" + hyphen string "-"
+ text run at (1,187) width 200: "sires into neces" + hyphen string "-"
+ text run at (1,218) width 106: "sary and "
+ text run at (107,218) width 94: "unneces" + hyphen string "-"
+ text run at (1,249) width 200: "sary\x{2014}these and"
+ text run at (1,280) width 200: "other great forms"
+ text run at (1,311) width 200: "of thought are all"
+ text run at (1,342) width 128: "of them "
+ text run at (129,342) width 72: "to be"
+ text run at (1,373) width 200: "found in the Re" + hyphen string "-"
+ text run at (1,404) width 200: "public, and were"
+ text run at (1,435) width 200: "probably first in" + hyphen string "-"
+ text run at (1,466) width 110: "vented by "
+ text run at (111,466) width 60: "Plato."
+ RenderBlock (floating) {DIV} at (424,0) size 202x529 [border: (1px solid #ADD8E6)]
+ RenderText {#text} at (1,1) size 200x527
+ text run at (1,1) width 200: "also the division of"
+ text run at (1,32) width 200: "the mind into the"
+ text run at (1,63) width 200: "rational, concupis" + hyphen string "-"
+ text run at (1,94) width 111: "cent, and "
+ text run at (112,94) width 89: "irascible"
+ text run at (1,125) width 200: "elements, or of"
+ text run at (1,156) width 200: "pleasures and de" + hyphen string "-"
+ text run at (1,187) width 200: "sires into neces" + hyphen string "-"
+ text run at (1,218) width 200: "sary and"
+ text run at (1,249) width 155: "unnecessary\x{2014}"
+ text run at (1,280) width 200: "these and other"
+ text run at (1,311) width 200: "great forms of"
+ text run at (1,342) width 200: "thought are all of"
+ text run at (1,373) width 66: "them "
+ text run at (67,373) width 134: "to be found"
+ text run at (1,404) width 200: "in the Republic,"
+ text run at (1,435) width 200: "and were probably"
+ text run at (1,466) width 200: "first invented by"
+ text run at (1,497) width 60: "Plato."
+ RenderBlock (floating) {DIV} at (4,529) size 202x529 [border: (1px solid #ADD8E6)]
+ RenderText {#text} at (1,1) size 200x527
+ text run at (1,1) width 200: "also the division of"
+ text run at (1,32) width 200: "the mind into the"
+ text run at (1,63) width 200: "rational, concupis" + hyphen string "-"
+ text run at (1,94) width 111: "cent, and "
+ text run at (112,94) width 89: "irascible"
+ text run at (1,125) width 200: "elements, or of"
+ text run at (1,156) width 200: "pleasures and de" + hyphen string "-"
+ text run at (1,187) width 200: "sires into"
+ text run at (1,218) width 200: "necessary and"
+ text run at (1,249) width 155: "unnecessary\x{2014}"
+ text run at (1,280) width 200: "these and other"
+ text run at (1,311) width 200: "great forms of"
+ text run at (1,342) width 200: "thought are all of"
+ text run at (1,373) width 66: "them "
+ text run at (67,373) width 134: "to be found"
+ text run at (1,404) width 200: "in the Republic,"
+ text run at (1,435) width 200: "and were probably"
+ text run at (1,466) width 200: "first invented by"
+ text run at (1,497) width 60: "Plato."
+ RenderBlock (floating) {DIV} at (214,529) size 202x529 [border: (1px solid #ADD8E6)]
+ RenderText {#text} at (1,1) size 200x527
+ text run at (1,1) width 200: "also the division of"
+ text run at (1,32) width 200: "the mind into the"
+ text run at (1,63) width 87: "rational,"
+ text run at (1,94) width 200: "concupiscent, and"
+ text run at (1,125) width 200: "irascible elements,"
+ text run at (1,156) width 200: "or of pleasures"
+ text run at (1,187) width 200: "and desires into"
+ text run at (1,218) width 200: "necessary and"
+ text run at (1,249) width 155: "unnecessary\x{2014}"
+ text run at (1,280) width 200: "these and other"
+ text run at (1,311) width 200: "great forms of"
+ text run at (1,342) width 200: "thought are all of"
+ text run at (1,373) width 66: "them "
+ text run at (67,373) width 134: "to be found"
+ text run at (1,404) width 200: "in the Republic,"
+ text run at (1,435) width 200: "and were probably"
+ text run at (1,466) width 200: "first invented by"
+ text run at (1,497) width 60: "Plato."
+2011-09-07 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/8881922> Support the hyphenate-limit-lines property
+ https://bugs.webkit.org/show_bug.cgi?id=67730
+
+ Reviewed by Dave Hyatt.
+
+ Tests: fast/css/parsing-hyphenate-limit-lines.html
+ fast/text/hyphenate-limit-lines.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added hyphenate-limit-lines.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue): Ditto. Valid values are non-negative integers and the keyword
+ "no-limit".
+ * css/CSSPropertyNames.in: Added -webkit-hyphenate-limit-lines.
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty): Added hyphenate-limit-lines.
+ * css/CSSValueKeywords.in: Added the "no-limit" value keyword.
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::layoutRunsAndFloats): Count the number of consecutive hyphenated lines
+ before the start line and pass it to layoutRunsAndFloatsInRange().
+ (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Keep track of the number of consecutive
+ hyphenated lines before the current line and pass it to LineBreaker::nextLineBreak().
+ (WebCore::tryHyphenating): Added parameters for the number of consecutive hyphenated lines before
+ the current line and the limit on consecutive hyphenated lines, and an early return if the limit
+ has been reached.
+ (WebCore::RenderBlock::LineBreaker::nextLineBreak): Added a parameter for the number of consecutive
+ hyphenated lines before the current line, which is passed through to tryHyphenating, along with
+ the value of hyphenate-limit-lines.
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::isHyphenated): Added. Returns true if the line was hyphenated.
+ * rendering/RootInlineBox.h:
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::hyphenationLimitLines): Added this getter.
+ (WebCore::InheritedFlags::setHyphenationLimitLines): Added this setter.
+ (WebCore::InheritedFlags::initialHyphenationLimitLines): Added. The initial value is -1,
+ corresponding to "no-limit".
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData): Initialize new member variable.
+ (WebCore::StyleRareInheritedData::operator==): Compare new member variable.
+ * rendering/style/StyleRareInheritedData.h:
+
2011-09-02 Ojan Vafai <ojan@chromium.org>
split overrideSize into overrideHeight and overrideWidth
CSSPropertyWebkitHyphenateCharacter,
CSSPropertyWebkitHyphenateLimitAfter,
CSSPropertyWebkitHyphenateLimitBefore,
+ CSSPropertyWebkitHyphenateLimitLines,
CSSPropertyWebkitHyphens,
CSSPropertyWebkitLineBoxContain,
CSSPropertyWebkitLineBreak,
if (style->hyphenationLimitBefore() < 0)
return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
return CSSPrimitiveValue::create(style->hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER);
+ case CSSPropertyWebkitHyphenateLimitLines:
+ if (style->hyphenationLimitLines() < 0)
+ return CSSPrimitiveValue::createIdentifier(CSSValueNoLimit);
+ return CSSPrimitiveValue::create(style->hyphenationLimitLines(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitBorderFit:
if (style->borderFit() == BorderFitBorder)
return primitiveValueCache->createIdentifierValue(CSSValueBorder);
validPrimitive = true;
break;
+ case CSSPropertyWebkitHyphenateLimitLines:
+ if (id == CSSValueNoLimit || validUnit(value, FInteger | FNonNeg, true))
+ validPrimitive = true;
+ break;
+
case CSSPropertyWebkitLocale:
if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING)
validPrimitive = true;
-webkit-hyphenate-character
-webkit-hyphenate-limit-after
-webkit-hyphenate-limit-before
+-webkit-hyphenate-limit-lines
-webkit-hyphens
-epub-hyphens = -webkit-hyphens
-webkit-line-box-contain
m_style->setHyphenationLimitBefore(primitiveValue->getValue<short>(CSSPrimitiveValue::CSS_NUMBER));
return;
}
+ case CSSPropertyWebkitHyphenateLimitLines: {
+ HANDLE_INHERIT_AND_INITIAL(hyphenationLimitLines, HyphenationLimitLines);
+ if (primitiveValue->getIdent() == CSSValueNoLimit)
+ m_style->setHyphenationLimitLines(-1);
+ else
+ m_style->setHyphenationLimitLines(primitiveValue->getValue<short>(CSSPrimitiveValue::CSS_NUMBER));
+ return;
+ }
case CSSPropertyWebkitLocale: {
HANDLE_INHERIT_AND_INITIAL(locale, Locale);
if (primitiveValue->getIdent() == CSSValueAuto)
minimized
windowed
+// -webkit-hyphenate-limit-lines
+no-limit
+
// -webkit-hyphens
// none
manual
reset();
}
- InlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, LineBreakIteratorInfo&, FloatingObject* lastFloatFromPreviousLine);
+ InlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, LineBreakIteratorInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines);
bool lineWasHyphenated() { return m_hyphenated; }
const Vector<RenderBox*>& positionedObjects() { return m_positionedObjects; }
// Helper function for layoutInlineChildren()
RootInlineBox* createLineBoxesFromBidiRuns(BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun);
void layoutRunsAndFloats(LineLayoutState&, bool hasInlineChild);
- void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus);
+ void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines);
void linkToEndLineIfNeeded(LineLayoutState&);
static void repaintDirtyFloats(Vector<FloatWithRect>& floats);
InlineBidiResolver resolver;
RootInlineBox* startLine = determineStartPosition(layoutState, resolver);
+ unsigned consecutiveHyphenatedLines = 0;
+ if (startLine) {
+ for (RootInlineBox* line = startLine->prevRootBox(); line && line->isHyphenated(); line = line->prevRootBox())
+ consecutiveHyphenatedLines++;
+ }
+
// FIXME: This would make more sense outside of this function, but since
// determineStartPosition can change the fullLayout flag we have to do this here. Failure to call
// determineStartPosition first will break fast/repaint/line-flow-with-floats-9.html.
}
}
- layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineBidiStatus);
+ layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineBidiStatus, consecutiveHyphenatedLines);
linkToEndLineIfNeeded(layoutState);
repaintDirtyFloats(layoutState.floats());
}
-void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus)
+void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines)
{
bool paginated = view()->layoutState() && view()->layoutState()->isPaginated();
LineMidpointState& lineMidpointState = resolver.midpointState();
InlineIterator oldEnd = end;
bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0;
- end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), lineBreakIteratorInfo, lastFloatFromPreviousLine);
+ end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), lineBreakIteratorInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines);
if (resolver.position().atEnd()) {
// FIXME: We shouldn't be creating any runs in findNextLineBreak to begin with!
// Once BidiRunList is separated from BidiResolver this will not be needed.
BidiRun* trailingSpaceRun = !layoutState.lineInfo().previousLineBrokeCleanly() ? handleTrailingSpaces(bidiRuns, resolver.context()) : 0;
- if (bidiRuns.runCount() && lineBreaker.lineWasHyphenated())
+ if (bidiRuns.runCount() && lineBreaker.lineWasHyphenated()) {
bidiRuns.logicallyLastRun()->m_hasHyphen = true;
+ consecutiveHyphenatedLines++;
+ } else
+ consecutiveHyphenatedLines = 0;
// Now that the runs have been ordered, we create the line boxes.
// At the same time we figure out where border/padding/margin should be applied for
return font.width(run);
}
-static void tryHyphenating(RenderText* text, const Font& font, const AtomicString& localeIdentifier, int minimumPrefixLength, int minimumSuffixLength, int lastSpace, int pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
+static void tryHyphenating(RenderText* text, const Font& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLength, int minimumSuffixLength, int lastSpace, int pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
{
// Map 'hyphenate-limit-{before,after}: auto;' to 2.
if (minimumPrefixLength < 0)
if (pos - lastSpace <= minimumSuffixLength)
return;
+ if (consecutiveHyphenatedLinesLimit >= 0 && consecutiveHyphenatedLines >= static_cast<unsigned>(consecutiveHyphenatedLinesLimit))
+ return;
+
const AtomicString& hyphenString = text->style()->hyphenString();
int hyphenWidth = font.width(RenderBlock::constructTextRun(text, font, hyphenString.string(), text->style()));
}
InlineIterator RenderBlock::LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo& lineInfo,
- LineBreakIteratorInfo& lineBreakIteratorInfo, FloatingObject* lastFloatFromPreviousLine)
+ LineBreakIteratorInfo& lineBreakIteratorInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines)
{
reset();
}
if (lineWasTooWide || !width.fitsOnLine()) {
if (canHyphenate && !width.fitsOnLine()) {
- tryHyphenating(t, f, style->locale(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
+ tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, m_block->style()->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
if (m_hyphenated)
goto end;
}
if (!width.fitsOnLine()) {
if (canHyphenate)
- tryHyphenating(t, f, style->locale(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
+ tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, m_block->style()->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
if (!m_hyphenated && lBreak.previousInSameNode() == softHyphen && style->hyphens() != HyphensNone)
m_hyphenated = true;
}
}
+bool RootInlineBox::isHyphenated() const
+{
+ for (InlineBox* box = firstLeafChild(); box; box = box->nextLeafChild()) {
+ if (box->isInlineTextBox()) {
+ if (toInlineTextBox(box)->hasHyphen())
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool RootInlineBox::lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, int ellipsisWidth)
{
// First sanity-check the unoverflowed width of the whole line to see if there is sufficient room.
virtual void clearTruncation();
+ bool isHyphenated() const;
+
virtual int baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; }
short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; }
+ short hyphenationLimitLines() const { return rareInheritedData->hyphenationLimitLines; }
const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
const AtomicString& locale() const { return rareInheritedData->locale; }
EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); }
void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); }
+ void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); }
void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
static Hyphens initialHyphens() { return HyphensManual; }
static short initialHyphenationLimitBefore() { return -1; }
static short initialHyphenationLimitAfter() { return -1; }
+ static short initialHyphenationLimitLines() { return -1; }
static const AtomicString& initialHyphenationString() { return nullAtom; }
static const AtomicString& initialLocale() { return nullAtom; }
static EBorderFit initialBorderFit() { return BorderFitBorder; }
, m_imageRendering(RenderStyle::initialImageRendering())
, hyphenationLimitBefore(-1)
, hyphenationLimitAfter(-1)
+ , hyphenationLimitLines(-1)
{
}
, hyphenationString(o.hyphenationString)
, hyphenationLimitBefore(o.hyphenationLimitBefore)
, hyphenationLimitAfter(o.hyphenationLimitAfter)
+ , hyphenationLimitLines(o.hyphenationLimitLines)
, locale(o.locale)
, textEmphasisCustomMark(o.textEmphasisCustomMark)
{
&& hyphens == o.hyphens
&& hyphenationLimitBefore == o.hyphenationLimitBefore
&& hyphenationLimitAfter == o.hyphenationLimitAfter
+ && hyphenationLimitLines == o.hyphenationLimitLines
&& textEmphasisFill == o.textEmphasisFill
&& textEmphasisMark == o.textEmphasisMark
&& textEmphasisPosition == o.textEmphasisPosition
AtomicString hyphenationString;
short hyphenationLimitBefore;
short hyphenationLimitAfter;
+ short hyphenationLimitLines;
AtomicString locale;