OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (result == -1) { | 162 if (result == -1) { |
163 result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge; | 163 result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge; |
164 truncatedWidth = blockRightEdge - blockLeftEdge; | 164 truncatedWidth = blockRightEdge - blockLeftEdge; |
165 } | 165 } |
166 return result; | 166 return result; |
167 } | 167 } |
168 | 168 |
169 void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset, LayoutUnit lineTop, LayoutUnit lineBottom) const | 169 void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset, LayoutUnit lineTop, LayoutUnit lineBottom) const |
170 { | 170 { |
171 if (hasEllipsisBox() && paintInfo.shouldPaintWithinRoot(renderer()) && rende
rer()->style()->visibility() == VISIBLE | 171 if (hasEllipsisBox() && paintInfo.shouldPaintWithinRoot(renderer()) && rende
rer()->style()->visibility() == VISIBLE |
172 && paintInfo.phase == PaintPhaseForeground) | 172 && paintInfo.getPhase() == PaintPhaseForeground) |
173 ellipsisBox()->paint(paintInfo, paintOffset, lineTop, lineBottom); | 173 ellipsisBox()->paint(paintInfo, paintOffset, lineTop, lineBottom); |
174 } | 174 } |
175 | 175 |
176 void RootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit lineTop, LayoutUnit lineBottom) | 176 void RootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit lineTop, LayoutUnit lineBottom) |
177 { | 177 { |
178 InlineFlowBox::paint(paintInfo, paintOffset, lineTop, lineBottom); | 178 InlineFlowBox::paint(paintInfo, paintOffset, lineTop, lineBottom); |
179 paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom); | 179 paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom); |
180 } | 180 } |
181 | 181 |
182 bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated
Offset, LayoutUnit lineTop, LayoutUnit lineBottom) | 182 bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated
Offset, LayoutUnit lineTop, LayoutUnit lineBottom) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // We may end up shifted to a new page. We need to do a re-snap when that ha
ppens. | 420 // We may end up shifted to a new page. We need to do a re-snap when that ha
ppens. |
421 LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(lineBottomWi
thLeading() + result); | 421 LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(lineBottomWi
thLeading() + result); |
422 if (newPageLogicalTop == pageLogicalTop) | 422 if (newPageLogicalTop == pageLogicalTop) |
423 return result; | 423 return result; |
424 | 424 |
425 // Put ourselves at the top of the next page to force a snap onto the new gr
id established by that page. | 425 // Put ourselves at the top of the next page to force a snap onto the new gr
id established by that page. |
426 return lineSnapAdjustment(newPageLogicalTop - (blockOffset + lineTopWithLead
ing())); | 426 return lineSnapAdjustment(newPageLogicalTop - (blockOffset + lineTopWithLead
ing())); |
427 } | 427 } |
428 | 428 |
429 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoi
nt& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 429 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoi
nt& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
430 LayoutUnit selTop, LayoutUnit selHeight
, const PaintInfo* paintInfo) | 430 LayoutUnit selTop, LayoutUnit selHeight, PaintInfo* paintInfo) |
431 { | 431 { |
432 RenderObject::SelectionState lineState = selectionState(); | 432 RenderObject::SelectionState lineState = selectionState(); |
433 | 433 |
434 bool leftGap, rightGap; | 434 bool leftGap, rightGap; |
435 block()->getSelectionGapInfo(lineState, leftGap, rightGap); | 435 block()->getSelectionGapInfo(lineState, leftGap, rightGap); |
436 | 436 |
437 GapRects result; | 437 GapRects result; |
438 | 438 |
439 InlineBox* firstBox = firstSelectedBox(); | 439 InlineBox* firstBox = firstSelectedBox(); |
440 InlineBox* lastBox = lastSelectedBox(); | 440 InlineBox* lastBox = lastSelectedBox(); |
(...skipping 15 matching lines...) Expand all Loading... |
456 // Now fill in any gaps on the line that occurred between two selected e
lements. | 456 // Now fill in any gaps on the line that occurred between two selected e
lements. |
457 LayoutUnit lastLogicalLeft = firstBox->logicalRight(); | 457 LayoutUnit lastLogicalLeft = firstBox->logicalRight(); |
458 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject:
:SelectionNone; | 458 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject:
:SelectionNone; |
459 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLea
fChild()) { | 459 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLea
fChild()) { |
460 if (box->selectionState() != RenderObject::SelectionNone) { | 460 if (box->selectionState() != RenderObject::SelectionNone) { |
461 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft
() - lastLogicalLeft, selHeight); | 461 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft
() - lastLogicalLeft, selHeight); |
462 logicalRect.move(renderer()->isHorizontalWritingMode() ? offsetF
romRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.widt
h())); | 462 logicalRect.move(renderer()->isHorizontalWritingMode() ? offsetF
romRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.widt
h())); |
463 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBl
ockPhysicalPosition, logicalRect); | 463 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBl
ockPhysicalPosition, logicalRect); |
464 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.heig
ht() > 0) { | 464 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.heig
ht() > 0) { |
465 if (paintInfo && box->parent()->renderer()->style()->visibil
ity() == VISIBLE) | 465 if (paintInfo && box->parent()->renderer()->style()->visibil
ity() == VISIBLE) |
466 paintInfo->context->fillRect(gapRect, box->parent()->ren
derer()->selectionBackgroundColor()); | 466 paintInfo->getContext()->fillRect(gapRect, box->parent()
->renderer()->selectionBackgroundColor()); |
467 // VisibleSelection may be non-contiguous, see comment above
. | 467 // VisibleSelection may be non-contiguous, see comment above
. |
468 result.uniteCenter(gapRect); | 468 result.uniteCenter(gapRect); |
469 } | 469 } |
470 lastLogicalLeft = box->logicalRight(); | 470 lastLogicalLeft = box->logicalRight(); |
471 } | 471 } |
472 if (box == lastBox) | 472 if (box == lastBox) |
473 break; | 473 break; |
474 isPreviousBoxSelected = box->selectionState() != RenderObject::Selec
tionNone; | 474 isPreviousBoxSelected = box->selectionState() != RenderObject::Selec
tionNone; |
475 } | 475 } |
476 } | 476 } |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 } | 989 } |
990 | 990 |
991 #ifndef NDEBUG | 991 #ifndef NDEBUG |
992 const char* RootInlineBox::boxName() const | 992 const char* RootInlineBox::boxName() const |
993 { | 993 { |
994 return "RootInlineBox"; | 994 return "RootInlineBox"; |
995 } | 995 } |
996 #endif | 996 #endif |
997 | 997 |
998 } // namespace WebCore | 998 } // namespace WebCore |
OLD | NEW |