OLD | NEW |
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // If our original display was an INLINE type, then we can go ahead | 355 // If our original display was an INLINE type, then we can go ahead |
356 // and determine our static y position now. | 356 // and determine our static y position now. |
357 box->layer()->setStaticBlockPosition(m_block->logicalHeight()); | 357 box->layer()->setStaticBlockPosition(m_block->logicalHeight()); |
358 } | 358 } |
359 | 359 |
360 // If we're ignoring spaces, we have to stop and include this object and | 360 // If we're ignoring spaces, we have to stop and include this object and |
361 // then start ignoring spaces again. | 361 // then start ignoring spaces again. |
362 if (isInlineType || box->container()->isRenderInline()) { | 362 if (isInlineType || box->container()->isRenderInline()) { |
363 if (m_ignoringSpaces) | 363 if (m_ignoringSpaces) |
364 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box); | 364 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box); |
365 m_trailingObjects.appendObjectIfNeeded(box); | 365 m_trailingObjects.appendBoxIfNeeded(box); |
366 } else { | 366 } else { |
367 positionedObjects.append(box); | 367 positionedObjects.append(box); |
368 } | 368 } |
369 m_width.addUncommittedWidth(inlineLogicalWidth(box).toFloat()); | 369 m_width.addUncommittedWidth(inlineLogicalWidth(box).toFloat()); |
370 // Reset prior line break context characters. | 370 // Reset prior line break context characters. |
371 m_renderTextInfo.m_lineBreakIterator.resetPriorContext(); | 371 m_renderTextInfo.m_lineBreakIterator.resetPriorContext(); |
372 } | 372 } |
373 | 373 |
374 inline void BreakingContext::handleFloat() | 374 inline void BreakingContext::handleFloat() |
375 { | 375 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return false; | 412 return false; |
413 } | 413 } |
414 | 414 |
415 inline void BreakingContext::handleEmptyInline() | 415 inline void BreakingContext::handleEmptyInline() |
416 { | 416 { |
417 // This should only end up being called on empty inlines | 417 // This should only end up being called on empty inlines |
418 ASSERT(isEmptyInline(m_current.object())); | 418 ASSERT(isEmptyInline(m_current.object())); |
419 | 419 |
420 RenderInline* flowBox = toRenderInline(m_current.object()); | 420 RenderInline* flowBox = toRenderInline(m_current.object()); |
421 | 421 |
| 422 // Now that some inline flows have line boxes, if we are already ignoring sp
aces, we need |
| 423 // to make sure that we stop to include this object and then start ignoring
spaces again. |
| 424 // If this object is at the start of the line, we need to behave like list m
arkers and |
| 425 // start ignoring spaces. |
422 bool requiresLineBox = alwaysRequiresLineBox(m_current.object()); | 426 bool requiresLineBox = alwaysRequiresLineBox(m_current.object()); |
423 if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) { | 427 if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) { |
424 // An empty inline that only has line-height, vertical-align or font-met
rics will | 428 // An empty inline that only has line-height, vertical-align or font-met
rics will only get a |
425 // not force linebox creation (and thus affect the height of the line) i
f the rest of the line is empty. | 429 // line box to affect the height of the line if the rest of the line is
not empty. |
426 if (requiresLineBox) | 430 if (requiresLineBox) |
427 m_lineInfo.setEmpty(false, m_block, &m_width); | 431 m_lineInfo.setEmpty(false, m_block, &m_width); |
428 if (m_ignoringSpaces) { | 432 if (m_ignoringSpaces) { |
429 // If we are in a run of ignored spaces then ensure we get a linebox
if lineboxes are eventually | |
430 // created for the line... | |
431 m_trailingObjects.clear(); | 433 m_trailingObjects.clear(); |
432 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.objec
t()); | 434 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.objec
t()); |
433 } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().o
bject() == m_current.object() | 435 } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().o
bject() == m_current.object() |
434 && shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(),
m_lineMidpointState)) { | 436 && shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(),
m_lineMidpointState)) { |
435 // If this object is at the start of the line, we need to behave lik
e list markers and | 437 // Like with list markers, we start ignoring spaces to make sure tha
t any |
436 // start ignoring spaces. | 438 // additional spaces we see will be discarded. |
437 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; | 439 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; |
438 m_ignoringSpaces = true; | 440 m_ignoringSpaces = true; |
439 } else { | |
440 // If we are after a trailing space but aren't ignoring spaces yet t
hen ensure we get a linebox | |
441 // if we encounter collapsible whitepace. | |
442 m_trailingObjects.appendObjectIfNeeded(m_current.object()); | |
443 } | 441 } |
444 } | 442 } |
445 | 443 |
446 m_width.addUncommittedWidth((inlineLogicalWidth(m_current.object()) + border
PaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox)).toFloat()); | 444 m_width.addUncommittedWidth((inlineLogicalWidth(m_current.object()) + border
PaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox)).toFloat()); |
447 } | 445 } |
448 | 446 |
449 inline void BreakingContext::handleReplaced() | 447 inline void BreakingContext::handleReplaced() |
450 { | 448 { |
451 RenderBox* replacedBox = toRenderBox(m_current.object()); | 449 RenderBox* replacedBox = toRenderBox(m_current.object()); |
452 | 450 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 // If we encounter a newline, or if we encounter a | 762 // If we encounter a newline, or if we encounter a |
765 // second space, we need to go ahead and break up this | 763 // second space, we need to go ahead and break up this |
766 // run and enter a mode where we start collapsing spaces. | 764 // run and enter a mode where we start collapsing spaces. |
767 if (m_currentCharacterIsSpace && previousCharacterIsSpace) { | 765 if (m_currentCharacterIsSpace && previousCharacterIsSpace) { |
768 m_ignoringSpaces = true; | 766 m_ignoringSpaces = true; |
769 | 767 |
770 // We just entered a mode where we are ignoring | 768 // We just entered a mode where we are ignoring |
771 // spaces. Create a midpoint to terminate the run | 769 // spaces. Create a midpoint to terminate the run |
772 // before the second space. | 770 // before the second space. |
773 m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpac
es); | 771 m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpac
es); |
774 m_trailingObjects.updateMidpointsForTrailingObjects(m_lineMi
dpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace); | 772 m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidp
ointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace); |
775 } | 773 } |
776 } | 774 } |
777 } else if (m_ignoringSpaces) { | 775 } else if (m_ignoringSpaces) { |
778 // Stop ignoring spaces and begin at this | 776 // Stop ignoring spaces and begin at this |
779 // new point. | 777 // new point. |
780 m_ignoringSpaces = false; | 778 m_ignoringSpaces = false; |
781 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; | 779 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; |
782 wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurement
s.last().width) ? wordSpacing : 0; | 780 wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurement
s.last().width) ? wordSpacing : 0; |
783 lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in
any of the ignored spaces. | 781 lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in
any of the ignored spaces. |
784 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.o
bject(), m_current.offset())); | 782 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.o
bject(), m_current.offset())); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 905 |
908 if (style->textIndentType() == TextIndentHanging) | 906 if (style->textIndentType() == TextIndentHanging) |
909 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 907 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
910 | 908 |
911 return shouldIndentText; | 909 return shouldIndentText; |
912 } | 910 } |
913 | 911 |
914 } | 912 } |
915 | 913 |
916 #endif // BreakingContextInlineHeaders_h | 914 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |