Changeset 70482 in webkit
- Timestamp:
- Oct 25, 2010 1:06:04 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70481 r70482 1 2010-10-25 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48257 6 7 Make "rl" and "bt" writing-modes work for blocks and lines. InlineTextBox is refactored to compute the correct 8 top left corner and left baseline edge once so that can be passed down to all the painting functions instead of 9 tx and ty. 10 11 adjustment helpers have been added that can be called before painting children or lines and that fix up 12 the coordinates from flipped to physical. 13 14 Added fast/blockflow/english-rl-text.html and fast/blockflow/english-bt-text.html 15 * fast/blockflow/english-bt-text.html: Added. 16 * fast/blockflow/english-rl-text.html: Added. 17 * platform/mac/fast/blockflow/english-bt-text-expected.checksum: Added. 18 * platform/mac/fast/blockflow/english-bt-text-expected.png: Added. 19 * platform/mac/fast/blockflow/english-bt-text-expected.txt: Added. 20 * platform/mac/fast/blockflow/english-rl-text-expected.checksum: Added. 21 * platform/mac/fast/blockflow/english-rl-text-expected.png: Added. 22 * platform/mac/fast/blockflow/english-rl-text-expected.txt: Added. 23 1 24 2010-10-25 Chang Shu <chang.shu@nokia.com> 2 25 -
trunk/WebCore/ChangeLog
r70478 r70482 1 2010-10-25 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48257 6 7 Make "rl" and "bt" writing-modes work for blocks and lines. InlineTextBox is refactored to compute the correct 8 top left corner and left baseline edge once so that can be passed down to all the painting functions instead of 9 tx and ty. 10 11 adjustment helpers have been added that can be called before painting children or lines and that fix up 12 the coordinates from flipped to physical. 13 14 Added fast/blockflow/english-rl-text.html and fast/blockflow/english-bt-text.html 15 16 * rendering/InlineBox.cpp: 17 (WebCore::InlineBox::adjustForFlippedBlocksWritingMode): 18 * rendering/InlineBox.h: 19 * rendering/InlineFlowBox.cpp: 20 (WebCore::InlineFlowBox::paintBoxDecorations): 21 (WebCore::InlineFlowBox::paintMask): 22 * rendering/InlineTextBox.cpp: 23 (WebCore::paintTextWithShadows): 24 (WebCore::InlineTextBox::paint): 25 (WebCore::InlineTextBox::paintSelection): 26 (WebCore::InlineTextBox::paintCompositionBackground): 27 (WebCore::InlineTextBox::paintDecoration): 28 (WebCore::InlineTextBox::paintSpellingOrGrammarMarker): 29 (WebCore::InlineTextBox::paintTextMatchMarker): 30 (WebCore::InlineTextBox::computeRectForReplacementMarker): 31 (WebCore::InlineTextBox::paintDocumentMarkers): 32 (WebCore::InlineTextBox::paintCompositionUnderline): 33 * rendering/InlineTextBox.h: 34 * rendering/RenderBlock.cpp: 35 (WebCore::RenderBlock::paintChildren): 36 (WebCore::RenderBlock::paintFloats): 37 * rendering/RenderBox.cpp: 38 (WebCore::RenderBox::adjustForFlippedBlocksWritingMode): 39 * rendering/RenderBox.h: 40 * rendering/style/RenderStyle.h: 41 (WebCore::InheritedFlags::isFlippedBlocksWritingMode): 42 1 43 2010-10-25 Ben Murdoch <benm@google.com> 2 44 -
trunk/WebCore/rendering/InlineBox.cpp
r70172 r70482 24 24 #include "InlineFlowBox.h" 25 25 #include "RenderArena.h" 26 #include "RenderB ox.h"26 #include "RenderBlock.h" 27 27 #include "RootInlineBox.h" 28 28 … … 280 280 } 281 281 282 void InlineBox::adjustForFlippedBlocksWritingMode(IntPoint& point) 283 { 284 if (!renderer()->style()->isFlippedBlocksWritingMode()) 285 return; 286 287 RenderBlock* block = root()->block(); 288 if (block->style()->isHorizontalWritingMode()) 289 point.setY(block->height() - height() - point.y()); 290 else 291 point.setX(block->width() - width() - point.x()); 292 } 293 282 294 } // namespace WebCore 283 295 -
trunk/WebCore/rendering/InlineBox.h
r70356 r70482 291 291 } 292 292 293 void adjustForFlippedBlocksWritingMode(IntPoint&); 294 293 295 private: 294 296 InlineBox* m_next; // The next element on the same line as us. -
trunk/WebCore/rendering/InlineFlowBox.cpp
r70356 r70482 810 810 811 811 // Move x/y to our coordinates. 812 tx += x; 813 ty += y; 812 IntPoint localPoint(x, y); 813 adjustForFlippedBlocksWritingMode(localPoint); 814 tx += localPoint.x(); 815 ty += localPoint.y(); 814 816 815 817 GraphicsContext* context = paintInfo.context; … … 888 890 889 891 // Move x/y to our coordinates. 890 tx += x; 891 ty += y; 892 IntPoint localPoint(x, y); 893 adjustForFlippedBlocksWritingMode(localPoint); 894 tx += localPoint.x(); 895 ty += localPoint.y(); 892 896 893 897 const NinePieceImage& maskNinePieceImage = renderer()->style()->maskBoxImage(); -
trunk/WebCore/rendering/InlineTextBox.cpp
r70456 r70482 347 347 348 348 static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, int truncationPoint, const IntPoint& textOrigin, 349 int x, int y, int w, int h, const ShadowData* shadow, bool stroked, bool vertical)349 const IntRect& boxRect, const ShadowData* shadow, bool stroked, bool vertical) 350 350 { 351 351 Color fillColor = context->fillColor(); … … 358 358 IntSize extraOffset; 359 359 if (shadow) 360 extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, FloatRect(x, y, w, h), stroked, opaque, vertical));360 extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, vertical)); 361 361 else if (!opaque) 362 362 context->setFillColor(fillColor, fillColorSpace); … … 432 432 RenderStyle* styleToUse = renderer()->style(m_firstLine); 433 433 int baseline = styleToUse->font().ascent(); 434 ty -= styleToUse->isFlippedLinesWritingMode() ? baseline : 0; 435 IntPoint textOrigin(m_x + tx, m_y + ty + baseline); 436 434 ty -= styleToUse->isHorizontalWritingMode() ? 0 : baseline; 435 436 IntPoint boxOrigin(m_x, m_y); 437 adjustForFlippedBlocksWritingMode(boxOrigin); 438 boxOrigin.move(tx, ty); 439 440 IntPoint textOrigin = IntPoint(boxOrigin.x(), boxOrigin.y() + baseline); 441 IntRect boxRect(boxOrigin, IntSize(logicalWidth(), logicalHeight())); 442 437 443 if (m_isVertical) { 438 444 context->save(); … … 460 466 461 467 if (containsComposition && !useCustomUnderlines) 462 paintCompositionBackground(context, tx, ty, styleToUse, font,468 paintCompositionBackground(context, boxOrigin, styleToUse, font, 463 469 renderer()->frame()->editor()->compositionStart(), 464 470 renderer()->frame()->editor()->compositionEnd()); 465 471 466 paintDocumentMarkers(context, tx, ty, styleToUse, font, true);472 paintDocumentMarkers(context, boxOrigin, styleToUse, font, true); 467 473 468 474 if (haveSelection && !useCustomUnderlines) 469 paintSelection(context, tx, ty, styleToUse, font);475 paintSelection(context, boxOrigin, styleToUse, font); 470 476 } 471 477 … … 561 567 if (!paintSelectedTextSeparately || ePos <= sPos) { 562 568 // FIXME: Truncate right-to-left text correctly. 563 paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), textShadow, textStrokeWidth > 0, m_isVertical);569 paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, m_isVertical); 564 570 } else 565 paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), textShadow, textStrokeWidth > 0, m_isVertical);571 paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, m_isVertical); 566 572 567 573 if (textStrokeWidth > 0) … … 575 581 576 582 updateGraphicsContext(context, selectionFillColor, selectionStrokeColor, selectionStrokeWidth, styleToUse->colorSpace()); 577 paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), selectionShadow, selectionStrokeWidth > 0, m_isVertical);583 paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, m_isVertical); 578 584 579 585 if (selectionStrokeWidth > 0) … … 584 590 if (d != TDNONE && paintInfo.phase != PaintPhaseSelection) { 585 591 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); 586 paintDecoration(context, tx, ty, d, textShadow);592 paintDecoration(context, boxOrigin, d, textShadow); 587 593 } 588 594 589 595 if (paintInfo.phase == PaintPhaseForeground) { 590 paintDocumentMarkers(context, tx, ty, styleToUse, font, false);596 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); 591 597 592 598 if (useCustomUnderlines) { … … 605 611 if (underline.startOffset <= end()) { 606 612 // underline intersects this run. Paint it. 607 paintCompositionUnderline(context, tx, ty, underline);613 paintCompositionUnderline(context, boxOrigin, underline); 608 614 if (underline.endOffset > end() + 1) 609 615 // underline also runs into the next run. Bail now, no more marker advancement. … … 638 644 } 639 645 640 void InlineTextBox::paintSelection(GraphicsContext* context, int tx, int ty, RenderStyle* style, const Font& font)646 void InlineTextBox::paintSelection(GraphicsContext* context, const IntPoint& boxOrigin, RenderStyle* style, const Font& font) 641 647 { 642 648 // See if we have a selection to paint at all. … … 658 664 context->save(); 659 665 updateGraphicsContext(context, c, c, 0, style->colorSpace()); // Don't draw text at all! 660 int y = selectionTop(); 661 int h = selectionHeight(); 666 662 667 // If the text is truncated, let the thing being painted in the truncation 663 668 // draw its own highlight. … … 671 676 } 672 677 673 context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h)); 678 int deltaY = logicalTop() - selectionTop(); 679 int selHeight = selectionHeight(); 680 IntPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 681 context->clip(IntRect(localOrigin, IntSize(m_logicalWidth, selHeight))); 674 682 context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, 675 683 !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), 676 IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos);684 localOrigin, selHeight, c, style->colorSpace(), sPos, ePos); 677 685 context->restore(); 678 686 } 679 687 680 void InlineTextBox::paintCompositionBackground(GraphicsContext* context, int tx, int ty, RenderStyle* style, const Font& font, int startPos, int endPos)688 void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const IntPoint& boxOrigin, RenderStyle* style, const Font& font, int startPos, int endPos) 681 689 { 682 690 int offset = m_start; … … 693 701 updateGraphicsContext(context, c, c, 0, style->colorSpace()); // Don't draw text at all! 694 702 695 int y = selectionTop(); 696 int h = selectionHeight(); 703 int deltaY = logicalTop() - selectionTop(); 704 int selHeight = selectionHeight(); 705 IntPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 697 706 context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, 698 707 !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), 699 IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos);708 localOrigin, selHeight, c, style->colorSpace(), sPos, ePos); 700 709 context->restore(); 701 710 } … … 721 730 #endif 722 731 723 void InlineTextBox::paintDecoration(GraphicsContext* context, int tx, int ty, int deco, const ShadowData* shadow) 724 { 725 tx += m_x; 726 ty += m_y; 727 732 void InlineTextBox::paintDecoration(GraphicsContext* context, const IntPoint& boxOrigin, int deco, const ShadowData* shadow) 733 { 728 734 if (m_truncation == cFullTruncation) 729 735 return; 736 737 IntPoint localOrigin = boxOrigin; 730 738 731 739 int width = m_logicalWidth; … … 733 741 width = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine); 734 742 if (!isLeftToRightDirection()) 735 tx += (m_logicalWidth - width);743 localOrigin.move(m_logicalWidth - width, 0); 736 744 } 737 745 … … 753 761 if (!linesAreOpaque && shadow && shadow->next()) { 754 762 context->save(); 755 IntRect clipRect( tx, ty, width, baseline + 2);763 IntRect clipRect(localOrigin, IntSize(width, baseline + 2)); 756 764 for (const ShadowData* s = shadow; s; s = s->next()) { 757 IntRect shadowRect( tx, ty, width, baseline + 2);765 IntRect shadowRect(localOrigin, IntSize(width, baseline + 2)); 758 766 shadowRect.inflate(s->blur()); 759 767 int shadowX = m_isVertical ? s->y() : s->x(); … … 766 774 context->clip(clipRect); 767 775 extraOffset += baseline + 2; 768 ty += extraOffset;776 localOrigin.move(0, extraOffset); 769 777 setClip = true; 770 778 } … … 777 785 if (!shadow->next()) { 778 786 // The last set of lines paints normally inside the clip. 779 ty -= extraOffset;787 localOrigin.move(0, -extraOffset); 780 788 extraOffset = 0; 781 789 } … … 791 799 context->setStrokeStyle(SolidStroke); 792 800 // Leave one pixel of white between the baseline and the underline. 793 context->drawLineForText(IntPoint( tx, ty+ baseline + 1), width, isPrinting);801 context->drawLineForText(IntPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting); 794 802 } 795 803 if (deco & OVERLINE) { 796 804 context->setStrokeColor(overline, colorSpace); 797 805 context->setStrokeStyle(SolidStroke); 798 context->drawLineForText( IntPoint(tx, ty), width, isPrinting);806 context->drawLineForText(localOrigin, width, isPrinting); 799 807 } 800 808 if (deco & LINE_THROUGH) { 801 809 context->setStrokeColor(linethrough, colorSpace); 802 810 context->setStrokeStyle(SolidStroke); 803 context->drawLineForText(IntPoint( tx, ty+ 2 * baseline / 3), width, isPrinting);811 context->drawLineForText(IntPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting); 804 812 } 805 813 } while (shadow); … … 826 834 } 827 835 828 void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, int ty, const DocumentMarker& marker, RenderStyle* style, const Font& font, bool grammar)836 void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, const IntPoint& boxOrigin, const DocumentMarker& marker, RenderStyle* style, const Font& font, bool grammar) 829 837 { 830 838 // Never print spelling/grammar markers (5327887) … … 855 863 856 864 // Calculate start & width 857 IntPoint startPoint(tx + m_x, ty + selectionTop()); 865 int deltaY = logicalTop() - selectionTop(); 866 int selHeight = selectionHeight(); 867 IntPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY); 858 868 TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()); 859 int h = selectionHeight(); 860 861 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, h, startPosition, endPosition)); 869 870 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, selHeight, startPosition, endPosition)); 862 871 start = markerRect.x() - startPoint.x(); 863 872 width = markerRect.width(); … … 866 875 // display a toolTip. We don't do this for misspelling markers. 867 876 if (grammar) { 868 markerRect.move(- tx, -ty);877 markerRect.move(-boxOrigin.x(), -boxOrigin.y()); 869 878 markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox(); 870 879 renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker, markerRect); … … 889 898 underlineOffset = baseline + 2; 890 899 } 891 pt->drawLineForTextChecking(IntPoint( tx + m_x + start, ty + m_y+ underlineOffset), width, textCheckingLineStyleForMarkerType(marker.type));892 } 893 894 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, const DocumentMarker& marker, RenderStyle* style, const Font& font)900 pt->drawLineForTextChecking(IntPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, textCheckingLineStyleForMarkerType(marker.type)); 901 } 902 903 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const IntPoint& boxOrigin, const DocumentMarker& marker, RenderStyle* style, const Font& font) 895 904 { 896 905 // Use same y positioning and height as for selection, so that when the selection and this highlight are on 897 906 // the same word there are no pieces sticking out. 898 int y =selectionTop();899 int h= selectionHeight();900 907 int deltaY = logicalTop() - selectionTop(); 908 int selHeight = selectionHeight(); 909 901 910 int sPos = max(marker.startOffset - m_start, (unsigned)0); 902 911 int ePos = min(marker.endOffset - m_start, (unsigned)m_len); … … 904 913 905 914 // Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates. 906 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoint(m_x, y), h, sPos, ePos));915 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoint(m_x, selectionTop()), selHeight, sPos, ePos)); 907 916 markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox(); 908 917 renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker, markerRect); … … 915 924 pt->save(); 916 925 updateGraphicsContext(pt, color, color, 0, style->colorSpace()); // Don't draw text at all! 917 pt->clip(IntRect( tx + m_x, ty + y, m_logicalWidth, h));918 pt->drawHighlightForText(font, run, IntPoint( m_x + tx, y + ty), h, color, style->colorSpace(), sPos, ePos);926 pt->clip(IntRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_logicalWidth, selHeight)); 927 pt->drawHighlightForText(font, run, IntPoint(boxOrigin.x(), boxOrigin.y() - deltaY), selHeight, color, style->colorSpace(), sPos, ePos); 919 928 pt->restore(); 920 929 } 921 930 } 922 931 923 void InlineTextBox::computeRectForReplacementMarker( int /*tx*/, int /*ty*/,const DocumentMarker& marker, RenderStyle* style, const Font& font)932 void InlineTextBox::computeRectForReplacementMarker(const DocumentMarker& marker, RenderStyle* style, const Font& font) 924 933 { 925 934 // Replacement markers are not actually drawn, but their rects need to be computed for hit testing. … … 938 947 } 939 948 940 void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, RenderStyle* style, const Font& font, bool background)949 void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const IntPoint& boxOrigin, RenderStyle* style, const Font& font, bool background) 941 950 { 942 951 if (!renderer()->node()) … … 982 991 switch (marker.type) { 983 992 case DocumentMarker::Spelling: 984 paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false);993 paintSpellingOrGrammarMarker(pt, boxOrigin, marker, style, font, false); 985 994 break; 986 995 case DocumentMarker::Grammar: 987 paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, true);996 paintSpellingOrGrammarMarker(pt, boxOrigin, marker, style, font, true); 988 997 break; 989 998 case DocumentMarker::TextMatch: 990 paintTextMatchMarker(pt, tx, ty, marker, style, font);999 paintTextMatchMarker(pt, boxOrigin, marker, style, font); 991 1000 break; 992 1001 case DocumentMarker::CorrectionIndicator: 993 computeRectForReplacementMarker( tx, ty,marker, style, font);994 paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false);1002 computeRectForReplacementMarker(marker, style, font); 1003 paintSpellingOrGrammarMarker(pt, boxOrigin, marker, style, font, false); 995 1004 break; 996 1005 case DocumentMarker::Replacement: … … 1005 1014 1006 1015 1007 void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int ty, const CompositionUnderline& underline) 1008 { 1009 tx += m_x; 1010 ty += m_y; 1011 1016 void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, const IntPoint& boxOrigin, const CompositionUnderline& underline) 1017 { 1012 1018 if (m_truncation == cFullTruncation) 1013 1019 return; … … 1050 1056 ctx->setStrokeColor(underline.color, renderer()->style()->colorSpace()); 1051 1057 ctx->setStrokeThickness(lineThickness); 1052 ctx->drawLineForText(IntPoint( tx + start, ty+ logicalHeight() - lineThickness), width, textRenderer()->document()->printing());1058 ctx->drawLineForText(IntPoint(boxOrigin.x() + start, boxOrigin.y() + logicalHeight() - lineThickness), width, textRenderer()->document()->printing()); 1053 1059 } 1054 1060 -
trunk/WebCore/rendering/InlineTextBox.h
r70263 r70482 141 141 142 142 protected: 143 void paintCompositionBackground(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&, int startPos, int endPos);144 void paintDocumentMarkers(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&, bool background);145 void paintCompositionUnderline(GraphicsContext*, int tx, int ty, const CompositionUnderline&);143 void paintCompositionBackground(GraphicsContext*, const IntPoint& boxOrigin, RenderStyle*, const Font&, int startPos, int endPos); 144 void paintDocumentMarkers(GraphicsContext*, const IntPoint& boxOrigin, RenderStyle*, const Font&, bool background); 145 void paintCompositionUnderline(GraphicsContext*, const IntPoint& boxOrigin, const CompositionUnderline&); 146 146 #if PLATFORM(MAC) 147 147 void paintCustomHighlight(int tx, int ty, const AtomicString& type); … … 149 149 150 150 private: 151 void paintDecoration(GraphicsContext*, int tx, int ty, int decoration, const ShadowData*);152 void paintSelection(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&);153 void paintSpellingOrGrammarMarker(GraphicsContext*, int tx, int ty, const DocumentMarker&, RenderStyle*, const Font&, bool grammar);154 void paintTextMatchMarker(GraphicsContext*, int tx, int ty, const DocumentMarker&, RenderStyle*, const Font&);155 void computeRectForReplacementMarker( int tx, int ty,const DocumentMarker&, RenderStyle*, const Font&);151 void paintDecoration(GraphicsContext*, const IntPoint& boxOrigin, int decoration, const ShadowData*); 152 void paintSelection(GraphicsContext*, const IntPoint& boxOrigin, RenderStyle*, const Font&); 153 void paintSpellingOrGrammarMarker(GraphicsContext*, const IntPoint& boxOrigin, const DocumentMarker&, RenderStyle*, const Font&, bool grammar); 154 void paintTextMatchMarker(GraphicsContext*, const IntPoint& boxOrigin, const DocumentMarker&, RenderStyle*, const Font&); 155 void computeRectForReplacementMarker(const DocumentMarker&, RenderStyle*, const Font&); 156 156 }; 157 157 -
trunk/WebCore/rendering/RenderBlock.cpp
r70170 r70482 2270 2270 } 2271 2271 2272 IntPoint childPoint(tx, ty); 2273 adjustForFlippedBlocksWritingMode(child, childPoint); 2272 2274 if (!child->hasSelfPaintingLayer() && !child->isFloating()) 2273 child->paint(info, tx, ty);2275 child->paint(info, childPoint.x(), childPoint.y()); 2274 2276 2275 2277 // Check for page-break-after: always, and if it's set, break and bail. … … 2404 2406 PaintInfo currentPaintInfo(paintInfo); 2405 2407 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; 2406 int currentTX = tx + r->left() - r->m_renderer->x() + r->m_renderer->marginLeft(); 2407 int currentTY = ty + r->top() - r->m_renderer->y() + r->m_renderer->marginTop(); 2408 r->m_renderer->paint(currentPaintInfo, currentTX, currentTY); 2408 IntPoint childPoint(tx + r->left() + r->m_renderer->marginLeft() - r->m_renderer->x(), 2409 ty + r->top() + r->m_renderer->marginTop() - r->m_renderer->y()); 2410 adjustForFlippedBlocksWritingMode(r->m_renderer, childPoint); 2411 r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y()); 2409 2412 if (!preservePhase) { 2410 2413 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; 2411 r->m_renderer->paint(currentPaintInfo, c urrentTX, currentTY);2414 r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y()); 2412 2415 currentPaintInfo.phase = PaintPhaseFloat; 2413 r->m_renderer->paint(currentPaintInfo, c urrentTX, currentTY);2416 r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y()); 2414 2417 currentPaintInfo.phase = PaintPhaseForeground; 2415 r->m_renderer->paint(currentPaintInfo, c urrentTX, currentTY);2418 r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y()); 2416 2419 currentPaintInfo.phase = PaintPhaseOutline; 2417 r->m_renderer->paint(currentPaintInfo, c urrentTX, currentTY);2420 r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y()); 2418 2421 } 2419 2422 } -
trunk/WebCore/rendering/RenderBox.cpp
r70356 r70482 3189 3189 } 3190 3190 3191 void RenderBox::adjustForFlippedBlocksWritingMode(RenderBox* child, IntPoint& point) 3192 { 3193 if (!style()->isFlippedBlocksWritingMode()) 3194 return; 3195 3196 // The child is going to add in its x() and y(), so we have to make sure it ends up in 3197 // the right place. 3198 if (style()->isHorizontalWritingMode()) 3199 point.move(0, height() - child->height() - child->y() - child->y()); 3200 else 3201 point.move(width() - child->width() - child->x() - child->x(), 0); 3202 } 3203 3191 3204 } // namespace WebCore -
trunk/WebCore/rendering/RenderBox.h
r70356 r70482 378 378 virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 379 379 380 void adjustForFlippedBlocksWritingMode(RenderBox* child, IntPoint&); 381 380 382 protected: 381 383 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); -
trunk/WebCore/rendering/style/RenderStyle.h
r70330 r70482 755 755 bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; } 756 756 bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; } 757 bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; } 757 758 758 759 ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); }
Note: See TracChangeset
for help on using the changeset viewer.