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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (result == -1) { | 163 if (result == -1) { |
164 result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge; | 164 result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge; |
165 truncatedWidth = blockRightEdge - blockLeftEdge; | 165 truncatedWidth = blockRightEdge - blockLeftEdge; |
166 } | 166 } |
167 return result; | 167 return result; |
168 } | 168 } |
169 | 169 |
170 void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset, LayoutUnit lineTop, LayoutUnit lineBottom) const | 170 void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset, LayoutUnit lineTop, LayoutUnit lineBottom) const |
171 { | 171 { |
172 if (hasEllipsisBox() && paintInfo.shouldPaintWithinRoot(renderer()) && rende
rer()->style()->visibility() == VISIBLE | 172 if (hasEllipsisBox() && paintInfo.shouldPaintWithinRoot(renderer()) && rende
rer()->style()->visibility() == VISIBLE |
173 && paintInfo.phase == PaintPhaseForeground) | 173 && paintInfo.getPhase() == PaintPhaseForeground) |
174 ellipsisBox()->paint(paintInfo, paintOffset, lineTop, lineBottom); | 174 ellipsisBox()->paint(paintInfo, paintOffset, lineTop, lineBottom); |
175 } | 175 } |
176 | 176 |
177 void RootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit lineTop, LayoutUnit lineBottom) | 177 void RootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit lineTop, LayoutUnit lineBottom) |
178 { | 178 { |
179 InlineFlowBox::paint(paintInfo, paintOffset, lineTop, lineBottom); | 179 InlineFlowBox::paint(paintInfo, paintOffset, lineTop, lineBottom); |
180 paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom); | 180 paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom); |
181 } | 181 } |
182 | 182 |
183 bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated
Offset, LayoutUnit lineTop, LayoutUnit lineBottom) | 183 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... |
421 // We may end up shifted to a new page. We need to do a re-snap when that ha
ppens. | 421 // We may end up shifted to a new page. We need to do a re-snap when that ha
ppens. |
422 LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(lineBottomWi
thLeading() + result); | 422 LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(lineBottomWi
thLeading() + result); |
423 if (newPageLogicalTop == pageLogicalTop) | 423 if (newPageLogicalTop == pageLogicalTop) |
424 return result; | 424 return result; |
425 | 425 |
426 // Put ourselves at the top of the next page to force a snap onto the new gr
id established by that page. | 426 // Put ourselves at the top of the next page to force a snap onto the new gr
id established by that page. |
427 return lineSnapAdjustment(newPageLogicalTop - (blockOffset + lineTopWithLead
ing())); | 427 return lineSnapAdjustment(newPageLogicalTop - (blockOffset + lineTopWithLead
ing())); |
428 } | 428 } |
429 | 429 |
430 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoi
nt& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 430 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoi
nt& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
431 LayoutUnit selTop, LayoutUnit selHeight
, const PaintInfo* paintInfo) | 431 LayoutUnit selTop, LayoutUnit selHeight, PaintInfo* paintInfo) |
432 { | 432 { |
433 RenderObject::SelectionState lineState = selectionState(); | 433 RenderObject::SelectionState lineState = selectionState(); |
434 | 434 |
435 bool leftGap, rightGap; | 435 bool leftGap, rightGap; |
436 block()->getSelectionGapInfo(lineState, leftGap, rightGap); | 436 block()->getSelectionGapInfo(lineState, leftGap, rightGap); |
437 | 437 |
438 GapRects result; | 438 GapRects result; |
439 | 439 |
440 InlineBox* firstBox = firstSelectedBox(); | 440 InlineBox* firstBox = firstSelectedBox(); |
441 InlineBox* lastBox = lastSelectedBox(); | 441 InlineBox* lastBox = lastSelectedBox(); |
(...skipping 15 matching lines...) Expand all Loading... |
457 // Now fill in any gaps on the line that occurred between two selected e
lements. | 457 // Now fill in any gaps on the line that occurred between two selected e
lements. |
458 LayoutUnit lastLogicalLeft = firstBox->logicalRight(); | 458 LayoutUnit lastLogicalLeft = firstBox->logicalRight(); |
459 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject:
:SelectionNone; | 459 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject:
:SelectionNone; |
460 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLea
fChild()) { | 460 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLea
fChild()) { |
461 if (box->selectionState() != RenderObject::SelectionNone) { | 461 if (box->selectionState() != RenderObject::SelectionNone) { |
462 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft
() - lastLogicalLeft, selHeight); | 462 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft
() - lastLogicalLeft, selHeight); |
463 logicalRect.move(renderer()->isHorizontalWritingMode() ? offsetF
romRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.widt
h())); | 463 logicalRect.move(renderer()->isHorizontalWritingMode() ? offsetF
romRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.widt
h())); |
464 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBl
ockPhysicalPosition, logicalRect); | 464 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBl
ockPhysicalPosition, logicalRect); |
465 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.heig
ht() > 0) { | 465 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.heig
ht() > 0) { |
466 if (paintInfo && box->parent()->renderer()->style()->visibil
ity() == VISIBLE) | 466 if (paintInfo && box->parent()->renderer()->style()->visibil
ity() == VISIBLE) |
467 paintInfo->context->fillRect(gapRect, box->parent()->ren
derer()->selectionBackgroundColor()); | 467 paintInfo->getContext()->fillRect(gapRect, box->parent()
->renderer()->selectionBackgroundColor()); |
468 // VisibleSelection may be non-contiguous, see comment above
. | 468 // VisibleSelection may be non-contiguous, see comment above
. |
469 result.uniteCenter(gapRect); | 469 result.uniteCenter(gapRect); |
470 } | 470 } |
471 lastLogicalLeft = box->logicalRight(); | 471 lastLogicalLeft = box->logicalRight(); |
472 } | 472 } |
473 if (box == lastBox) | 473 if (box == lastBox) |
474 break; | 474 break; |
475 isPreviousBoxSelected = box->selectionState() != RenderObject::Selec
tionNone; | 475 isPreviousBoxSelected = box->selectionState() != RenderObject::Selec
tionNone; |
476 } | 476 } |
477 } | 477 } |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 } | 990 } |
991 | 991 |
992 #ifndef NDEBUG | 992 #ifndef NDEBUG |
993 const char* RootInlineBox::boxName() const | 993 const char* RootInlineBox::boxName() const |
994 { | 994 { |
995 return "RootInlineBox"; | 995 return "RootInlineBox"; |
996 } | 996 } |
997 #endif | 997 #endif |
998 | 998 |
999 } // namespace WebCore | 999 } // namespace WebCore |
OLD | NEW |