Title: [218989] trunk/Source/WebCore
Revision
218989
Author
[email protected]
Date
2017-06-29 23:21:04 -0700 (Thu, 29 Jun 2017)

Log Message

BreakingContext::handleReplaced() should use replacedBox instead of m_current.renderer().
https://bugs.webkit.org/show_bug.cgi?id=174011

Reviewed by Simon Fraser.

No change in functionality.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleReplaced):
* rendering/line/LineWidth.cpp:
(WebCore::LineWidth::applyOverhang):
* rendering/line/LineWidth.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (218988 => 218989)


--- trunk/Source/WebCore/ChangeLog	2017-06-30 04:44:53 UTC (rev 218988)
+++ trunk/Source/WebCore/ChangeLog	2017-06-30 06:21:04 UTC (rev 218989)
@@ -1,3 +1,18 @@
+2017-06-29  Zalan Bujtas  <[email protected]>
+
+        BreakingContext::handleReplaced() should use replacedBox instead of m_current.renderer().
+        https://bugs.webkit.org/show_bug.cgi?id=174011
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+
+        * rendering/line/BreakingContext.h:
+        (WebCore::BreakingContext::handleReplaced):
+        * rendering/line/LineWidth.cpp:
+        (WebCore::LineWidth::applyOverhang):
+        * rendering/line/LineWidth.h:
+
 2017-06-29  Wenson Hsieh  <[email protected]>
 
         [iOS DnD] Web content process crashes when the selection is moved far offscreen in dragstart

Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (218988 => 218989)


--- trunk/Source/WebCore/rendering/line/BreakingContext.h	2017-06-30 04:44:53 UTC (rev 218988)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h	2017-06-30 06:21:04 UTC (rev 218989)
@@ -542,8 +542,8 @@
         m_width.updateAvailableWidth(replacedBox.logicalHeight());
 
     // Break on replaced elements if either has normal white-space.
-    if (((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak)
-        && (!m_current.renderer()->isRubyRun() || downcast<RenderRubyRun>(m_current.renderer())->canBreakBefore(m_renderTextInfo.lineBreakIterator))) || replacedBox.isAnonymousInlineBlock()) {
+    if (((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!replacedBox.isImage() || m_allowImagesToBreak)
+        && (!is<RenderRubyRun>(replacedBox) || downcast<RenderRubyRun>(replacedBox).canBreakBefore(m_renderTextInfo.lineBreakIterator))) || replacedBox.isAnonymousInlineBlock()) {
         if (auto* renderer = m_current.renderer())
             commitLineBreakAtCurrentWidth(*renderer);
         else
@@ -562,7 +562,7 @@
             m_lineLayoutState.prevFloatBottomFromAnonymousInlineBlock(), m_lineLayoutState.maxFloatBottomFromAnonymousInlineBlock());
 
     if (m_ignoringSpaces)
-        m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), 0));
+        m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, &replacedBox, 0));
 
     m_lineInfo.setEmpty(false, &m_block, &m_width);
     m_ignoringSpaces = false;
@@ -572,9 +572,9 @@
 
     // Optimize for a common case. If we can't find whitespace after the list
     // item, then this is all moot.
-    LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox) + m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedBox) + inlineLogicalWidth(m_current.renderer());
-    if (is<RenderListMarker>(*m_current.renderer())) {
-        if (m_blockStyle.collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineWhitespaceCollapsingState)) {
+    LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox) + m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedBox) + inlineLogicalWidth(&replacedBox);
+    if (is<RenderListMarker>(replacedBox)) {
+        if (m_blockStyle.collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, &replacedBox, m_lineWhitespaceCollapsingState)) {
             // Like with inline flows, we start ignoring spaces to make sure that any
             // additional spaces we see will be discarded.
             m_currentCharacterIsSpace = true;
@@ -581,13 +581,13 @@
             m_currentCharacterIsWS = false;
             m_ignoringSpaces = true;
         }
-        if (downcast<RenderListMarker>(*m_current.renderer()).isInside())
+        if (downcast<RenderListMarker>(replacedBox).isInside())
             m_width.addUncommittedReplacedWidth(replacedLogicalWidth);
     } else
         m_width.addUncommittedReplacedWidth(replacedLogicalWidth);
-    if (is<RenderRubyRun>(*m_current.renderer())) {
-        m_width.applyOverhang(downcast<RenderRubyRun>(m_current.renderer()), m_lastObject, m_nextObject);
-        downcast<RenderRubyRun>(m_current.renderer())->updatePriorContextFromCachedBreakIterator(m_renderTextInfo.lineBreakIterator);
+    if (is<RenderRubyRun>(replacedBox)) {
+        m_width.applyOverhang(downcast<RenderRubyRun>(replacedBox), m_lastObject, m_nextObject);
+        downcast<RenderRubyRun>(replacedBox).updatePriorContextFromCachedBreakIterator(m_renderTextInfo.lineBreakIterator);
     } else {
         // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
         m_renderTextInfo.lineBreakIterator.updatePriorContext(replacementCharacter);

Modified: trunk/Source/WebCore/rendering/line/LineWidth.cpp (218988 => 218989)


--- trunk/Source/WebCore/rendering/line/LineWidth.cpp	2017-06-30 04:44:53 UTC (rev 218988)
+++ trunk/Source/WebCore/rendering/line/LineWidth.cpp	2017-06-30 06:21:04 UTC (rev 218989)
@@ -129,11 +129,11 @@
     m_hasCommitted = true;
 }
 
-void LineWidth::applyOverhang(RenderRubyRun* rubyRun, RenderObject* startRenderer, RenderObject* endRenderer)
+void LineWidth::applyOverhang(const RenderRubyRun& rubyRun, RenderObject* startRenderer, RenderObject* endRenderer)
 {
     float startOverhang;
     float endOverhang;
-    rubyRun->getOverhang(m_isFirstLine, startRenderer, endRenderer, startOverhang, endOverhang);
+    rubyRun.getOverhang(m_isFirstLine, startRenderer, endRenderer, startOverhang, endOverhang);
 
     startOverhang = std::min(startOverhang, m_committedWidth);
     m_availableWidth += startOverhang;

Modified: trunk/Source/WebCore/rendering/line/LineWidth.h (218988 => 218989)


--- trunk/Source/WebCore/rendering/line/LineWidth.h	2017-06-30 04:44:53 UTC (rev 218988)
+++ trunk/Source/WebCore/rendering/line/LineWidth.h	2017-06-30 06:21:04 UTC (rev 218989)
@@ -73,7 +73,7 @@
         m_hasUncommittedReplaced = true;
     }
     void commit();
-    void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
+    void applyOverhang(const RenderRubyRun&, RenderObject* startRenderer, RenderObject* endRenderer);
     void fitBelowFloats(bool isFirstLine = false);
     void setTrailingWhitespaceWidth(float collapsedWhitespace, float borderPaddingMargin = 0);
     IndentTextOrNot shouldIndentText() const { return m_shouldIndentText; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to