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

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

Issue 2532573003: Position a float before laying it out. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/api/LineLayoutBlockFlow.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 positionedObjects.append(box); 481 positionedObjects.append(box);
482 m_width.addUncommittedWidth( 482 m_width.addUncommittedWidth(
483 inlineLogicalWidthFromAncestorsIfNeeded(box).toFloat()); 483 inlineLogicalWidthFromAncestorsIfNeeded(box).toFloat());
484 // Reset prior line break context characters. 484 // Reset prior line break context characters.
485 m_layoutTextInfo.m_lineBreakIterator.resetPriorContext(); 485 m_layoutTextInfo.m_lineBreakIterator.resetPriorContext();
486 } 486 }
487 487
488 inline void BreakingContext::handleFloat() { 488 inline void BreakingContext::handleFloat() {
489 LineLayoutBox floatBox(m_current.getLineLayoutItem()); 489 LineLayoutBox floatBox(m_current.getLineLayoutItem());
490 FloatingObject* floatingObject = m_block.insertFloatingObject(floatBox); 490 FloatingObject* floatingObject = m_block.insertFloatingObject(floatBox);
491 // Check if it fits in the current line; if it does, position it now, 491
492 // otherwise, position it after moving to next line (in newLine() func). 492 if (m_floatsFitOnLine) {
493 // FIXME: Bug 110372: Properly position multiple stacked floats with 493 // We need to calculate the logical width of the float before we can tell
494 // non-rectangular shape outside. 494 // whether it's going to fit on the line.
495 if (m_floatsFitOnLine && 495 m_block.positionAndLayoutFloat(*floatingObject, m_block.logicalHeight());
496 m_width.fitsOnLine( 496
497 m_block.logicalWidthForFloat(*floatingObject).toFloat(), 497 // Check if it fits in the current line; if it does, place it now,
498 ExcludeWhitespace)) { 498 // otherwise, place it after moving to next line (in newLine() func).
499 m_block.placeNewFloats(m_block.logicalHeight(), &m_width); 499 // FIXME: Bug 110372: Properly position multiple stacked floats with
500 if (m_lineBreak.getLineLayoutItem() == m_current.getLineLayoutItem()) { 500 // non-rectangular shape outside.
501 ASSERT(!m_lineBreak.offset()); 501 if (m_width.fitsOnLine(
502 m_lineBreak.increment(); 502 m_block.logicalWidthForFloat(*floatingObject).toFloat(),
503 ExcludeWhitespace)) {
504 m_block.placeNewFloats(m_block.logicalHeight(), &m_width);
505 if (m_lineBreak.getLineLayoutItem() == m_current.getLineLayoutItem()) {
506 DCHECK(!m_lineBreak.offset());
507 m_lineBreak.increment();
508 }
509 } else {
510 m_floatsFitOnLine = false;
503 } 511 }
504 } else {
505 m_floatsFitOnLine = false;
506 } 512 }
507 // Update prior line break context characters, using U+FFFD (OBJECT 513 // Update prior line break context characters, using U+FFFD (OBJECT
508 // REPLACEMENT CHARACTER) for floating element. 514 // REPLACEMENT CHARACTER) for floating element.
509 m_layoutTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter); 515 m_layoutTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
510 } 516 }
511 517
512 // This is currently just used for list markers and inline flows that have line 518 // This is currently just used for list markers and inline flows that have line
513 // boxes. Neither should have an effect on whitespace at the start of the line. 519 // boxes. Neither should have an effect on whitespace at the start of the line.
514 inline bool shouldSkipWhitespaceAfterStartObject( 520 inline bool shouldSkipWhitespaceAfterStartObject(
515 LineLayoutBlockFlow block, 521 LineLayoutBlockFlow block,
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 1497
1492 if (style.getTextIndentType() == TextIndentHanging) 1498 if (style.getTextIndentType() == TextIndentHanging)
1493 indentText = indentText == IndentText ? DoNotIndentText : IndentText; 1499 indentText = indentText == IndentText ? DoNotIndentText : IndentText;
1494 1500
1495 return indentText; 1501 return indentText;
1496 } 1502 }
1497 1503
1498 } // namespace blink 1504 } // namespace blink
1499 1505
1500 #endif // BreakingContextInlineHeaders_h 1506 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/api/LineLayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698