⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 98401 in webkit


Ignore:
Timestamp:
Oct 25, 2011, 3:51:34 PM (15 years ago)
Author:
leviw@chromium.org
Message:

Mac build fixes and adding pixelSnapped convenience methods for accessors that needed them.

Location:
branches/subpixellayout/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp

    r98165 r98401  
    577577                                               LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType)
    578578{
    579     // We need to use an integer top for positioning inline boxes because we can't round in painting in the inline box tree
    580     int roundedTop = top.round();
     579    // We need to snap the top to pixel bounds for positioning inline boxes because we can't round in painting in the inline box tree
     580    LayoutUnit pixelSnappedTop = top.round();
    581581    bool isRootBox = isRootInlineBox();
    582582    if (isRootBox) {
    583583        const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics();
    584         setLogicalTop(roundedTop + maxAscent - fontMetrics.ascent(baselineType));
     584        setLogicalTop(pixelSnappedTop + maxAscent - fontMetrics.ascent(baselineType));
    585585    }
    586586
     
    604604        bool childAffectsTopBottomPos = true;
    605605        if (curr->verticalAlign() == TOP)
    606             curr->setLogicalTop(roundedTop);
     606            curr->setLogicalTop(pixelSnappedTop);
    607607        else if (curr->verticalAlign() == BOTTOM)
    608             curr->setLogicalTop(roundedTop + maxHeight - curr->lineHeight());
     608            curr->setLogicalTop(pixelSnappedTop + maxHeight - curr->lineHeight());
    609609        else {
    610610            if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren() && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding()
     
    612612                childAffectsTopBottomPos = false;
    613613            LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineType);
    614             curr->setLogicalTop(curr->logicalTop() + roundedTop + posAdjust);
     614            curr->setLogicalTop(curr->logicalTop() + pixelSnappedTop + posAdjust);
    615615        }
    616616
     
    684684        // line-height).
    685685        if (inlineFlowBox)
    686             inlineFlowBox->placeBoxesInBlockDirection(roundedTop, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop,
     686            inlineFlowBox->placeBoxesInBlockDirection(pixelSnappedTop, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop,
    687687                                                      lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType);
    688688    }
  • branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp

    r98391 r98401  
    35713571    if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < interval.high()) {
    35723572        // All the objects returned from the tree should be already placed.
    3573         ASSERT(r->isPlaced() && m_renderer->logicalTopForFloat(r).round() <= m_value && m_renderer->logicalBottomForFloat(r).round() > m_value);
     3573        ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <= m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value);
    35743574
    35753575        if (FloatTypeValue == FloatingObject::FloatLeft
    3576             && m_renderer->logicalRightForFloat(r).round() > m_offset) {
    3577             m_offset = m_renderer->logicalRightForFloat(r).round();
     3576            && m_renderer->pixelSnappedLogicalRightForFloat(r) > m_offset) {
     3577            m_offset = m_renderer->pixelSnappedLogicalRightForFloat(r);
    35783578            if (m_heightRemaining)
    35793579                *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;
     
    35813581
    35823582        if (FloatTypeValue == FloatingObject::FloatRight
    3583             && m_renderer->logicalLeftForFloat(r).round() < m_offset) {
    3584             m_offset = m_renderer->logicalLeftForFloat(r).round();
     3583            && m_renderer->pixelSnappedLogicalRightForFloat(r) < m_offset) {
     3584            m_offset = m_renderer->pixelSnappedLogicalLeftForFloat(r);
    35853585            if (m_heightRemaining)
    35863586                *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;
     
    36413641
    36423642        LayoutUnit rightFloatOffset = fixedOffset;
    3643         FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop.round(), rightFloatOffset, heightRemaining);
     3643        FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, rightFloatOffset, heightRemaining);
    36443644        m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
    36453645        right = min(right, rightFloatOffset);
     
    68036803{
    68046804    if (m_horizontalWritingMode)
    6805         return RenderBlock::FloatingObjectInterval(floatingObject->y().round(), floatingObject->maxY().round(), floatingObject);
    6806     return RenderBlock::FloatingObjectInterval(floatingObject->x().round(), floatingObject->maxX().round(), floatingObject);
     6805        return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxY(), floatingObject);
     6806    return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedX(), floatingObject->pixelSnappedMaxX(), floatingObject);
    68076807}
    68086808
  • branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h

    r98297 r98401  
    164164            : logicalWidth() - logicalRightOffsetForLine(position, firstLine);
    165165    }
     166
     167    int pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine) const
     168    {
     169        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0).round();
     170    }
     171    int pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const
     172    {
     173        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0).round();
     174    }
    166175   
    167176    LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine);
     
    542551        LayoutUnit height() const { return m_frameRect.height(); }
    543552
     553        int pixelSnappedX() const { return x().round(); }
     554        int pixelSnappedMaxX() const { return maxX().round(); }
     555        int pixelSnappedY() const { return y().round(); }
     556        int pixelSnappedMaxY() const { return maxY().round(); }
     557        int pixelSnappedWidth() const { return width().round(); }
     558        int pixelSnappedHeight() const { return height().round(); }
     559
    544560        void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); }
    545561        void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); }
     
    575591    LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); }
    576592    LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }
     593
     594    int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return logicalTopForFloat(child).round(); }
     595    int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return logicalBottomForFloat(child).round(); }
     596    int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return logicalLeftForFloat(child).round(); }
     597    int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return logicalRightForFloat(child).round(); }
     598    int pixelSnappedLogicalWidthForFloat(const FloatingObject* child) const { return logicalWidthForFloat(child).round(); }
    577599    void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop)
    578600    {
     
    932954        }
    933955       
     956        FloatIntervalSearchAdapter(const RenderBlock* renderer, LayoutUnit value, LayoutUnit& offset, LayoutUnit* heightRemaining)
     957            : m_renderer(renderer)
     958            , m_value(value.round())
     959            , m_offset(offset)
     960            , m_heightRemaining(heightRemaining)
     961        {
     962        }
     963       
    934964        inline int lowValue() const { return m_value; }
    935965        inline int highValue() const { return m_value; }
  • branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r98297 r98401  
    751751{
    752752    ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
    753     float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine()).round();
    754     float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()).round() - logicalLeft;
     753    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine());
     754    float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()) - logicalLeft;
    755755
    756756    bool needsWordSpacing = false;
  • branches/subpixellayout/Source/WebKit/mac/WebView/WebView.mm

    r97886 r98401  
    24492449        return nil;
    24502450
    2451     const Vector<IntRect>& repaintRects = view->trackedRepaintRects();
     2451    const Vector<WebCore::FixedRect>& repaintRects = view->trackedRepaintRects();
    24522452    NSMutableArray* rectsArray = [[NSMutableArray alloc] initWithCapacity:repaintRects.size()];
    24532453   
  • branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp

    r98391 r98401  
    304304        GraphicsContextStateSaver stateSaver(*graphicsContext);
    305305        IntRect scrollbarDirtyRect = dirtyRect;
    306         scrollbarDirtyRect.moveBy(pluginView()->frameRect().location());
     306        scrollbarDirtyRect.moveBy(roundedIntPoint(pluginView()->frameRect().location()));
    307307        graphicsContext->translate(-pluginView()->frameRect().x(), -pluginView()->frameRect().y());
    308308
     
    314314    }
    315315
    316     IntRect dirtyCornerRect = intersection(scrollCornerRect(), dirtyRect);
     316    IntRect dirtyCornerRect = intersection(enclosingIntRect(scrollCornerRect()), dirtyRect);
    317317    ScrollbarTheme::theme()->paintScrollCorner(0, graphicsContext, dirtyCornerRect);
    318318}
     
    665665IntPoint BuiltInPDFView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
    666666{
    667     IntPoint point = pluginView()->frame()->view()->convertToRenderer(pluginView()->renderer(), parentPoint);
     667    WebCore::FixedPoint point = pluginView()->frame()->view()->convertToRenderer(pluginView()->renderer(), parentPoint);
    668668    point.move(pluginView()->location() - scrollbar->location());
    669669
    670     return point;
     670    return roundedIntPoint(point);
    671671}
    672672
  • branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r98391 r98401  
    575575    } else {
    576576        // FIXME: We should try to intersect the dirty rect with the plug-in's clip rect here.
    577         paintRect = IntRect(IntPoint(), frameRect().size());
     577        paintRect = IntRect(IntPoint(), expandedIntSize(frameRect().size()));
    578578    }
    579579
  • branches/subpixellayout/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r98391 r98401  
    420420        return ImmutableArray::create();
    421421
    422     const Vector<IntRect>& rects = view->trackedRepaintRects();
     422    const Vector<WebCore::FixedRect>& rects = view->trackedRepaintRects();
    423423    size_t size = rects.size();
    424424    if (!size)
Note: See TracChangeset for help on using the changeset viewer.