Changeset 166171 in webkit


Ignore:
Timestamp:
Mar 24, 2014 9:30:52 AM (10 years ago)
Author:
Antti Koivisto
Message:

Text autosizing does not determine line count correctly for simple line layout
https://bugs.webkit.org/show_bug.cgi?id=130673

Reviewed by Daniel Bates.

We don't count lines correctly in simple line layout case.

  • page/Frame.cpp:

(WebCore::Frame::textAutosizingWidth):
(WebCore::Frame::setTextAutosizingWidth):

  • page/ios/FrameIOS.mm:

(WebCore::Frame::textAutosizingWidth): Deleted.
(WebCore::Frame::setTextAutosizingWidth): Deleted.

Move to Frame.cpp to make enabling on non-iOS build easier.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::lineCount):

Handle simple line layout case.

(WebCore::RenderBlockFlow::lineCountForTextAutosizing):

Call lineCount() if children are inline.
Rename for clarity.

(WebCore::RenderBlockFlow::adjustComputedFontSizes):
(WebCore::RenderBlockFlow::immediateLineCount): Deleted.

  • rendering/RenderBlockFlow.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166170 r166171  
     12014-03-24  Antti Koivisto  <antti@apple.com>
     2
     3        Text autosizing does not determine line count correctly for simple line layout
     4        https://bugs.webkit.org/show_bug.cgi?id=130673
     5
     6        Reviewed by Daniel Bates.
     7       
     8        We don't count lines correctly in simple line layout case.
     9
     10        * page/Frame.cpp:
     11        (WebCore::Frame::textAutosizingWidth):
     12        (WebCore::Frame::setTextAutosizingWidth):
     13        * page/ios/FrameIOS.mm:
     14        (WebCore::Frame::textAutosizingWidth): Deleted.
     15        (WebCore::Frame::setTextAutosizingWidth): Deleted.
     16       
     17            Move to Frame.cpp to make enabling on non-iOS build easier.
     18
     19        * rendering/RenderBlockFlow.cpp:
     20        (WebCore::RenderBlockFlow::lineCount):
     21       
     22            Handle simple line layout case.
     23
     24        (WebCore::RenderBlockFlow::lineCountForTextAutosizing):
     25           
     26            Call lineCount() if children are inline.
     27            Rename for clarity.
     28
     29        (WebCore::RenderBlockFlow::adjustComputedFontSizes):
     30        (WebCore::RenderBlockFlow::immediateLineCount): Deleted.
     31        * rendering/RenderBlockFlow.h:
     32
    1332014-03-24  Frédéric Wang  <fred.wang@free.fr>
    234
  • trunk/Source/WebCore/page/Frame.cpp

    r166047 r166171  
    487487}
    488488
     489#if ENABLE(IOS_TEXT_AUTOSIZING)
     490float Frame::textAutosizingWidth() const
     491{
     492    return m_textAutosizingWidth;
     493}
     494
     495void Frame::setTextAutosizingWidth(float width)
     496{
     497    m_textAutosizingWidth = width;
     498}
     499#endif
     500
    489501#if PLATFORM(IOS)
    490502void Frame::scrollOverflowLayer(RenderLayer* layer, const IntRect& visibleRect, const IntRect& exposeRect)
  • trunk/Source/WebCore/page/ios/FrameIOS.mm

    r166122 r166171  
    873873}
    874874
    875 #if ENABLE(IOS_TEXT_AUTOSIZING)
    876 float Frame::textAutosizingWidth() const
    877 {
    878     return m_textAutosizingWidth;
    879 }
    880 
    881 void Frame::setTextAutosizingWidth(float width)
    882 {
    883     m_textAutosizingWidth = width;
    884 }
    885 #endif
    886 
    887875} // namespace WebCore
    888876#endif // PLATFORM(IOS)
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r165890 r166171  
    3535#include "RenderIterator.h"
    3636#include "RenderLayer.h"
     37#include "RenderListItem.h"
    3738#include "RenderMultiColumnFlowThread.h"
    3839#include "RenderMultiColumnSet.h"
     
    29772978
    29782979    if (childrenInline()) {
     2980        if (m_simpleLineLayout) {
     2981            ASSERT(!stopRootInlineBox);
     2982            return m_simpleLineLayout->lineCount();
     2983        }
    29792984        for (auto box = firstRootBox(); box; box = box->nextRootBox()) {
    29802985            count++;
     
    34043409}
    34053410
    3406 int RenderBlockFlow::immediateLineCount()
    3407 {
    3408     // Copied and modified from RenderBlock::lineCount.
     3411int RenderBlockFlow::lineCountForTextAutosizing()
     3412{
     3413    if (style().visibility() != VISIBLE)
     3414        return 0;
     3415    if (childrenInline())
     3416        return lineCount();
    34093417    // Only descend into list items.
    34103418    int count = 0;
    3411     if (style().visibility() == VISIBLE) {
    3412         if (childrenInline()) {
    3413             for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox())
    3414                 count++;
    3415         } else {
    3416             for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling()) {
    3417                 if (obj->isListItem())
    3418                     count += toRenderBlockFlow(obj)->lineCount();
    3419             }
    3420         }
    3421     }
     3419    for (auto& listItem : childrenOfType<RenderListItem>(*this))
     3420        count += listItem.lineCount();
    34223421    return count;
    34233422}
     
    34523451    unsigned lineCount;
    34533452    if (m_lineCountForTextAutosizing == NOT_SET) {
    3454         int count = immediateLineCount();
     3453        int count = lineCountForTextAutosizing();
    34553454        if (!count)
    34563455            lineCount = NO_LINE;
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r164867 r166171  
    588588
    589589#if ENABLE(IOS_TEXT_AUTOSIZING)
    590     int immediateLineCount();
     590    int lineCountForTextAutosizing();
    591591    void adjustComputedFontSizes(float size, float visibleWidth);
    592592    void resetComputedFontSize()
Note: See TracChangeset for help on using the changeset viewer.