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

Side by Side Diff: Source/core/rendering/line/BreakingContextInlineHeaders.h

Issue 300853007: Empty inline elements always get a line box. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
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. 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
426 bool requiresLineBox = alwaysRequiresLineBox(m_current.object()); 422 bool requiresLineBox = alwaysRequiresLineBox(m_current.object());
427 if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) { 423 if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) {
428 // An empty inline that only has line-height, vertical-align or font-met rics will only get a 424 // An empty inline that only has line-height, vertical-align or font-met rics will
429 // line box to affect the height of the line if the rest of the line is not empty. 425 // not force linebox creation (and thus affect the height of the line) i f the rest of the line is empty.
430 if (requiresLineBox) 426 if (requiresLineBox)
431 m_lineInfo.setEmpty(false, m_block, &m_width); 427 m_lineInfo.setEmpty(false, m_block, &m_width);
432 if (m_ignoringSpaces) { 428 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...
433 m_trailingObjects.clear(); 431 m_trailingObjects.clear();
434 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.objec t()); 432 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.objec t());
433 } else if (m_currentCharacterIsSpace) {
434 // .. likewise if we come after a single space.
435 m_lineMidpointState.ensureLineBoxForRenderer(m_current.object());
435 } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().o bject() == m_current.object() 436 } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().o bject() == m_current.object()
436 && shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(), m_lineMidpointState)) { 437 && shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(), m_lineMidpointState)) {
437 // Like with list markers, we start ignoring spaces to make sure tha t any 438 // If this object is at the start of the line, we need to behave lik e list markers and
438 // additional spaces we see will be discarded. 439 // start ignoring spaces.
439 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = true; 440 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = true;
440 m_ignoringSpaces = true; 441 m_ignoringSpaces = true;
441 } 442 }
442 } 443 }
443 444
444 m_width.addUncommittedWidth((inlineLogicalWidth(m_current.object()) + border PaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox)).toFloat()); 445 m_width.addUncommittedWidth((inlineLogicalWidth(m_current.object()) + border PaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox)).toFloat());
445 } 446 }
446 447
447 inline void BreakingContext::handleReplaced() 448 inline void BreakingContext::handleReplaced()
448 { 449 {
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 906
906 if (style->textIndentType() == TextIndentHanging) 907 if (style->textIndentType() == TextIndentHanging)
907 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText; 908 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText;
908 909
909 return shouldIndentText; 910 return shouldIndentText;
910 } 911 }
911 912
912 } 913 }
913 914
914 #endif // BreakingContextInlineHeaders_h 915 #endif // BreakingContextInlineHeaders_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698