Changeset 155975 in webkit


Ignore:
Timestamp:
Sep 17, 2013, 11:10:02 AM (11 years ago)
Author:
Antti Koivisto
Message:

Add isTextOrBR() and use it
https://bugs.webkit.org/show_bug.cgi?id=121506

Reviewed by Darin Adler.

It is a popular test.

  • dom/Document.cpp:

(WebCore::Document::updateHoverActiveState):

  • editing/Editor.cpp:

(WebCore::findFirstMarkable):

  • editing/TextIterator.cpp:

(WebCore::ignoresContainerClip):

  • rendering/InlineBox.cpp:

(WebCore::InlineBox::logicalHeight):

  • rendering/InlineIterator.h:

(WebCore::isIteratorTarget):

  • rendering/RenderBlock.cpp:

(WebCore::InlineMinMaxIterator::next):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlockFlow::layoutInlineChildren):

  • rendering/RenderCounter.cpp:

(WebCore::planCounter):

  • rendering/RenderObject.h:

(WebCore::RenderObject::isTextOrBR):

  • rendering/RenderTreeAsText.cpp:

(WebCore::write):

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::ascentAndDescentForBox):
(WebCore::RootInlineBox::verticalPositionForBox):

Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155972 r155975  
     12013-09-17  Antti Koivisto  <antti@apple.com>
     2
     3        Add isTextOrBR() and use it
     4        https://bugs.webkit.org/show_bug.cgi?id=121506
     5
     6        Reviewed by Darin Adler.
     7
     8        It is a popular test.
     9
     10        * dom/Document.cpp:
     11        (WebCore::Document::updateHoverActiveState):
     12        * editing/Editor.cpp:
     13        (WebCore::findFirstMarkable):
     14        * editing/TextIterator.cpp:
     15        (WebCore::ignoresContainerClip):
     16        * rendering/InlineBox.cpp:
     17        (WebCore::InlineBox::logicalHeight):
     18        * rendering/InlineIterator.h:
     19        (WebCore::isIteratorTarget):
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::InlineMinMaxIterator::next):
     22        * rendering/RenderBlockLineLayout.cpp:
     23        (WebCore::RenderBlockFlow::layoutInlineChildren):
     24        * rendering/RenderCounter.cpp:
     25        (WebCore::planCounter):
     26        * rendering/RenderObject.h:
     27        (WebCore::RenderObject::isTextOrBR):
     28        * rendering/RenderTreeAsText.cpp:
     29        (WebCore::write):
     30        * rendering/RootInlineBox.cpp:
     31        (WebCore::RootInlineBox::ascentAndDescentForBox):
     32        (WebCore::RootInlineBox::verticalPositionForBox):
     33
    1342013-09-17  Antti Koivisto  <antti@apple.com>
    235
  • trunk/Source/WebCore/dom/Document.cpp

    r155957 r155975  
    58255825            // will need to reference this chain.
    58265826            for (RenderObject* curr = newActiveElement->renderer(); curr; curr = curr->parent()) {
    5827                 if (!curr->node() || !curr->node()->isElementNode() || curr->isText() || curr->isBR())
     5827                if (!curr->node() || !curr->node()->isElementNode() || curr->isTextOrBR())
    58285828                    continue;
    58295829                m_userActionElements.setInActiveChain(toElement(curr->node()), true);
  • trunk/Source/WebCore/editing/Editor.cpp

    r155957 r155975  
    30863086        if (!node->renderer())
    30873087            return 0;
    3088         if (node->renderer()->isText() || node->renderer()->isBR())
     3088        if (node->renderer()->isTextOrBR())
    30893089            return node;
    30903090        if (isHTMLTextFormControlElement(node))
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r155957 r155975  
    216216{
    217217    RenderObject* renderer = node->renderer();
    218     if (!renderer || renderer->isText() || renderer->isBR())
     218    if (!renderer || renderer->isTextOrBR())
    219219        return false;
    220220    return renderer->style()->hasOutOfFlowPosition();
  • trunk/Source/WebCore/rendering/InlineBox.cpp

    r155972 r155975  
    142142        return virtualLogicalHeight();
    143143   
    144     if (renderer().isText() || renderer().isBR())
     144    if (renderer().isTextOrBR())
    145145        return m_bitfields.isText() ? renderer().style(isFirstLineStyle())->fontMetrics().height() : 0;
    146146    if (renderer().isBox() && parent())
  • trunk/Source/WebCore/rendering/InlineIterator.h

    r155957 r155975  
    167167{
    168168    ASSERT(object); // The iterator will of course return 0, but its not an expected argument to this function.
    169     return object->isText() || object->isBR() || object->isFloating() || object->isOutOfFlowPositioned() || object->isReplaced();
     169    return object->isTextOrBR() || object->isFloating() || object->isOutOfFlowPositioned() || object->isReplaced();
    170170}
    171171
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r155964 r155975  
    51015101            break;
    51025102
    5103         if (!result->isOutOfFlowPositioned() && (result->isText() || result->isBR() || result->isFloating() || result->isReplaced() || result->isRenderInline()))
     5103        if (!result->isOutOfFlowPositioned() && (result->isTextOrBR() || result->isFloating() || result->isReplaced() || result->isRenderInline()))
    51045104             break;
    51055105       
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r155964 r155975  
    18441844                        o->layoutIfNeeded();
    18451845                }
    1846             } else if (o->isText() || o->isBR() || (o->isRenderInline() && !walker.atEndOfInline())) {
     1846            } else if (o->isTextOrBR() || (o->isRenderInline() && !walker.atEndOfInline())) {
    18471847                if (o->isRenderInline())
    18481848                    toRenderInline(o)->updateAlwaysCreateLineBoxes(layoutState.isFullLayout());
  • trunk/Source/WebCore/rendering/RenderCounter.cpp

    r154546 r155975  
    109109    // Real text nodes don't have their own style so they can't have counters.
    110110    // We can't even look at their styles or we'll see extra resets and increments!
    111     if (object->isText() && !object->isBR())
     111    if (object->isText())
    112112        return false;
    113113    Node* generatingNode = object->generatingNode();
  • trunk/Source/WebCore/rendering/RenderObject.h

    r155964 r155975  
    570570    bool isText() const  { return !m_bitfields.isBox() && m_bitfields.isTextOrRenderView(); }
    571571    bool isBR() const { return m_bitfields.isBR(); }
     572    bool isTextOrBR() const { return isText() || isBR(); }
    572573    bool isBox() const { return m_bitfields.isBox(); }
    573574    bool isRenderView() const  { return m_bitfields.isBox() && m_bitfields.isTextOrRenderView(); }
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r155957 r155975  
    590590    ts << "\n";
    591591
    592     if (o.isText() && !o.isBR()) {
     592    if (o.isText()) {
    593593        const RenderText& text = toRenderText(o);
    594594        for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r155957 r155975  
    916916        LayoutUnit ascentWithMargin = box->renderer().style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
    917917        LayoutUnit descentWithMargin = box->renderer().style(isFirstLineStyle())->fontMetrics().descent(baselineType());
    918         if (box->parent() && !box->renderer().isText() && !box->renderer().isBR()) {
     918        if (box->parent() && !box->renderer().isTextOrBR()) {
    919919            ascentWithMargin += box->boxModelObject()->borderAndPaddingBefore() + box->boxModelObject()->marginBefore();
    920920            descentWithMargin += box->boxModelObject()->borderAndPaddingAfter() + box->boxModelObject()->marginAfter();
     
    930930LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositionCache& verticalPositionCache)
    931931{
    932     if (box->renderer().isText() || box->renderer().isBR())
     932    if (box->renderer().isTextOrBR())
    933933        return box->parent()->logicalTop();
    934934   
Note: See TracChangeset for help on using the changeset viewer.