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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // A relative positioned inline encloses us. In this case, we also have
to determine our | 209 // A relative positioned inline encloses us. In this case, we also have
to determine our |
210 // position as though we were an inline. Set |staticInlinePosition| and
|staticBlockPosition| on the relative positioned | 210 // position as though we were an inline. Set |staticInlinePosition| and
|staticBlockPosition| on the relative positioned |
211 // inline so that we can obtain the value later. | 211 // inline so that we can obtain the value later. |
212 toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->
startAlignedOffsetForLine(blockHeight, false)); | 212 toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->
startAlignedOffsetForLine(blockHeight, false)); |
213 toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHei
ght); | 213 toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHei
ght); |
214 | 214 |
215 // If |child| is a leading or trailing positioned object this is its onl
y opportunity to ensure it moves with an inline | 215 // If |child| is a leading or trailing positioned object this is its onl
y opportunity to ensure it moves with an inline |
216 // container changing width. | 216 // container changing width. |
217 child->moveWithEdgeOfInlineContainerIfNecessary(child->isHorizontalWriti
ngMode()); | 217 child->moveWithEdgeOfInlineContainerIfNecessary(child->isHorizontalWriti
ngMode()); |
218 } | 218 } |
219 block->updateStaticInlinePositionForChild(child, blockHeight); | 219 block->updateStaticInlinePositionForChild(*child, blockHeight); |
220 child->layer()->setStaticBlockPosition(blockHeight); | 220 child->layer()->setStaticBlockPosition(blockHeight); |
221 } | 221 } |
222 | 222 |
223 // FIXME: The entire concept of the skipTrailingWhitespace function is flawed, s
ince we really need to be building | 223 // FIXME: The entire concept of the skipTrailingWhitespace function is flawed, s
ince we really need to be building |
224 // line boxes even for containers that may ultimately collapse away. Otherwise w
e'll never get positioned | 224 // line boxes even for containers that may ultimately collapse away. Otherwise w
e'll never get positioned |
225 // elements quite right. In other words, we need to build this function's work i
nto the normal line | 225 // elements quite right. In other words, we need to build this function's work i
nto the normal line |
226 // object iteration process. | 226 // object iteration process. |
227 // NB. this function will insert any floating elements that would otherwise | 227 // NB. this function will insert any floating elements that would otherwise |
228 // be skipped but it will not position them. | 228 // be skipped but it will not position them. |
229 inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, co
nst LineInfo& lineInfo) | 229 inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, co
nst LineInfo& lineInfo) |
230 { | 230 { |
231 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhi
tespace)) { | 231 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhi
tespace)) { |
232 RenderObject* object = iterator.object(); | 232 RenderObject* object = iterator.object(); |
233 if (object->isOutOfFlowPositioned()) | 233 if (object->isOutOfFlowPositioned()) |
234 setStaticPositions(m_block, toRenderBox(object)); | 234 setStaticPositions(m_block, toRenderBox(object)); |
235 else if (object->isFloating()) | 235 else if (object->isFloating()) |
236 m_block->insertFloatingObject(toRenderBox(object)); | 236 m_block->insertFloatingObject(*toRenderBox(object)); |
237 iterator.increment(); | 237 iterator.increment(); |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 inline void BreakingContext::initializeForCurrentObject() | 241 inline void BreakingContext::initializeForCurrentObject() |
242 { | 242 { |
243 m_currentStyle = m_current.object()->style(); | 243 m_currentStyle = m_current.object()->style(); |
244 m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.object()); | 244 m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.object()); |
245 if (m_nextObject && m_nextObject->parent() && !m_nextObject->parent()->isDes
cendantOf(m_current.object()->parent())) | 245 if (m_nextObject && m_nextObject->parent() && !m_nextObject->parent()->isDes
cendantOf(m_current.object()->parent())) |
246 m_includeEndWidth = true; | 246 m_includeEndWidth = true; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 return extraWidth; | 335 return extraWidth; |
336 } | 336 } |
337 | 337 |
338 inline void BreakingContext::handleOutOfFlowPositioned(Vector<RenderBox*>& posit
ionedObjects) | 338 inline void BreakingContext::handleOutOfFlowPositioned(Vector<RenderBox*>& posit
ionedObjects) |
339 { | 339 { |
340 // If our original display wasn't an inline type, then we can | 340 // If our original display wasn't an inline type, then we can |
341 // go ahead and determine our static inline position now. | 341 // go ahead and determine our static inline position now. |
342 RenderBox* box = toRenderBox(m_current.object()); | 342 RenderBox* box = toRenderBox(m_current.object()); |
343 bool isInlineType = box->style()->isOriginalDisplayInlineType(); | 343 bool isInlineType = box->style()->isOriginalDisplayInlineType(); |
344 if (!isInlineType) { | 344 if (!isInlineType) { |
345 m_block->setStaticInlinePositionForChild(box, m_block->startOffsetForCon
tent()); | 345 m_block->setStaticInlinePositionForChild(*box, m_block->startOffsetForCo
ntent()); |
346 } else { | 346 } else { |
347 // If our original display was an INLINE type, then we can go ahead | 347 // If our original display was an INLINE type, then we can go ahead |
348 // and determine our static y position now. | 348 // and determine our static y position now. |
349 box->layer()->setStaticBlockPosition(m_block->logicalHeight()); | 349 box->layer()->setStaticBlockPosition(m_block->logicalHeight()); |
350 } | 350 } |
351 | 351 |
352 // If we're ignoring spaces, we have to stop and include this object and | 352 // If we're ignoring spaces, we have to stop and include this object and |
353 // then start ignoring spaces again. | 353 // then start ignoring spaces again. |
354 if (isInlineType || box->container()->isRenderInline()) { | 354 if (isInlineType || box->container()->isRenderInline()) { |
355 if (m_ignoringSpaces) | 355 if (m_ignoringSpaces) |
356 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box); | 356 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box); |
357 m_trailingObjects.appendObjectIfNeeded(box); | 357 m_trailingObjects.appendObjectIfNeeded(box); |
358 } else { | 358 } else { |
359 positionedObjects.append(box); | 359 positionedObjects.append(box); |
360 } | 360 } |
361 m_width.addUncommittedWidth(inlineLogicalWidth(box).toFloat()); | 361 m_width.addUncommittedWidth(inlineLogicalWidth(box).toFloat()); |
362 // Reset prior line break context characters. | 362 // Reset prior line break context characters. |
363 m_renderTextInfo.m_lineBreakIterator.resetPriorContext(); | 363 m_renderTextInfo.m_lineBreakIterator.resetPriorContext(); |
364 } | 364 } |
365 | 365 |
366 inline void BreakingContext::handleFloat() | 366 inline void BreakingContext::handleFloat() |
367 { | 367 { |
368 RenderBox* floatBox = toRenderBox(m_current.object()); | 368 RenderBox* floatBox = toRenderBox(m_current.object()); |
369 FloatingObject* floatingObject = m_block->insertFloatingObject(floatBox); | 369 FloatingObject* floatingObject = m_block->insertFloatingObject(*floatBox); |
370 // check if it fits in the current line. | 370 // check if it fits in the current line. |
371 // If it does, position it now, otherwise, position | 371 // If it does, position it now, otherwise, position |
372 // it after moving to next line (in newLine() func) | 372 // it after moving to next line (in newLine() func) |
373 // FIXME: Bug 110372: Properly position multiple stacked floats with non-rec
tangular shape outside. | 373 // FIXME: Bug 110372: Properly position multiple stacked floats with non-rec
tangular shape outside. |
374 if (m_floatsFitOnLine && m_width.fitsOnLine(m_block->logicalWidthForFloat(fl
oatingObject).toFloat(), ExcludeWhitespace)) { | 374 if (m_floatsFitOnLine && m_width.fitsOnLine(m_block->logicalWidthForFloat(fl
oatingObject).toFloat(), ExcludeWhitespace)) { |
375 m_block->positionNewFloatOnLine(floatingObject, m_lastFloatFromPreviousL
ine, m_lineInfo, m_width); | 375 m_block->positionNewFloatOnLine(floatingObject, m_lastFloatFromPreviousL
ine, m_lineInfo, m_width); |
376 if (m_lineBreak.object() == m_current.object()) { | 376 if (m_lineBreak.object() == m_current.object()) { |
377 ASSERT(!m_lineBreak.offset()); | 377 ASSERT(!m_lineBreak.offset()); |
378 m_lineBreak.increment(); | 378 m_lineBreak.increment(); |
379 } | 379 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 if (m_ignoringSpaces) | 454 if (m_ignoringSpaces) |
455 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.objec
t(), 0)); | 455 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.objec
t(), 0)); |
456 | 456 |
457 m_lineInfo.setEmpty(false, m_block, &m_width); | 457 m_lineInfo.setEmpty(false, m_block, &m_width); |
458 m_ignoringSpaces = false; | 458 m_ignoringSpaces = false; |
459 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = false
; | 459 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = false
; |
460 m_trailingObjects.clear(); | 460 m_trailingObjects.clear(); |
461 | 461 |
462 // Optimize for a common case. If we can't find whitespace after the list | 462 // Optimize for a common case. If we can't find whitespace after the list |
463 // item, then this is all moot. | 463 // item, then this is all moot. |
464 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox)
+ m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replac
edBox) + inlineLogicalWidth(m_current.object()); | 464 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(*replacedBox
) + m_block->marginStartForChild(*replacedBox) + m_block->marginEndForChild(*rep
lacedBox) + inlineLogicalWidth(m_current.object()); |
465 if (m_current.object()->isListMarker()) { | 465 if (m_current.object()->isListMarker()) { |
466 if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStart
Object(m_block, m_current.object(), m_lineMidpointState)) { | 466 if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStart
Object(m_block, m_current.object(), m_lineMidpointState)) { |
467 // Like with inline flows, we start ignoring spaces to make sure tha
t any | 467 // Like with inline flows, we start ignoring spaces to make sure tha
t any |
468 // additional spaces we see will be discarded. | 468 // additional spaces we see will be discarded. |
469 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; | 469 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; |
470 m_ignoringSpaces = true; | 470 m_ignoringSpaces = true; |
471 } | 471 } |
472 if (toRenderListMarker(m_current.object())->isInside()) | 472 if (toRenderListMarker(m_current.object())->isInside()) |
473 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); | 473 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); |
474 } else { | 474 } else { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 | 908 |
909 if (style->textIndentType() == TextIndentHanging) | 909 if (style->textIndentType() == TextIndentHanging) |
910 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 910 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
911 | 911 |
912 return shouldIndentText; | 912 return shouldIndentText; |
913 } | 913 } |
914 | 914 |
915 } | 915 } |
916 | 916 |
917 #endif // BreakingContextInlineHeaders_h | 917 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |