| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 LayoutRect caretRect = localCaretRectForEmptyElement(size().width(), textInd
entOffset()); | 2273 LayoutRect caretRect = localCaretRectForEmptyElement(size().width(), textInd
entOffset()); |
| 2274 | 2274 |
| 2275 if (extraWidthToEndOfLine) | 2275 if (extraWidthToEndOfLine) |
| 2276 *extraWidthToEndOfLine = size().width() - caretRect.maxX(); | 2276 *extraWidthToEndOfLine = size().width() - caretRect.maxX(); |
| 2277 | 2277 |
| 2278 return caretRect; | 2278 return caretRect; |
| 2279 } | 2279 } |
| 2280 | 2280 |
| 2281 void LayoutBlock::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint&
additionalOffset, IncludeBlockVisualOverflowOrNot includeBlockOverflows) const | 2281 void LayoutBlock::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint&
additionalOffset, IncludeBlockVisualOverflowOrNot includeBlockOverflows) const |
| 2282 { | 2282 { |
| 2283 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the | 2283 if (!isAnonymous()) // For anonymous blocks, the children add outline rects. |
| 2284 // inline boxes above and below us (thus getting merged with them to form a
single irregular | |
| 2285 // shape). | |
| 2286 const LayoutInline* inlineElementContinuation = this->inlineElementContinuat
ion(); | |
| 2287 if (inlineElementContinuation) { | |
| 2288 // FIXME: This check really isn't accurate. | |
| 2289 bool nextInlineHasLineBox = inlineElementContinuation->firstLineBox(); | |
| 2290 // FIXME: This is wrong. The principal layoutObject may not be the conti
nuation preceding this block. | |
| 2291 // FIXME: This is wrong for vertical writing-modes. | |
| 2292 // https://bugs.webkit.org/show_bug.cgi?id=46781 | |
| 2293 bool prevInlineHasLineBox = toLayoutInline(inlineElementContinuation->no
de()->layoutObject())->firstLineBox(); | |
| 2294 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); | |
| 2295 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); | |
| 2296 if (topMargin || bottomMargin) { | |
| 2297 LayoutRect rect(additionalOffset, size()); | |
| 2298 rect.expandEdges(topMargin, LayoutUnit(), bottomMargin, LayoutUnit()
); | |
| 2299 rects.append(rect); | |
| 2300 } | |
| 2301 } else if (!isAnonymous()) { // For anonymous blocks, the children add outli
ne rects. | |
| 2302 rects.append(LayoutRect(additionalOffset, size())); | 2284 rects.append(LayoutRect(additionalOffset, size())); |
| 2303 } | |
| 2304 | 2285 |
| 2305 if (includeBlockOverflows == IncludeBlockVisualOverflow && !hasOverflowClip(
) && !hasControlClip()) { | 2286 if (includeBlockOverflows == IncludeBlockVisualOverflow && !hasOverflowClip(
) && !hasControlClip()) { |
| 2306 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | |
| 2307 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | |
| 2308 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | |
| 2309 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); | |
| 2310 if (!rect.isEmpty()) | |
| 2311 rects.append(rect); | |
| 2312 } | |
| 2313 | |
| 2314 addOutlineRectsForNormalChildren(rects, additionalOffset, includeBlockOv
erflows); | 2287 addOutlineRectsForNormalChildren(rects, additionalOffset, includeBlockOv
erflows); |
| 2315 if (TrackedLayoutBoxListHashSet* positionedObjects = this->positionedObj
ects()) { | 2288 if (TrackedLayoutBoxListHashSet* positionedObjects = this->positionedObj
ects()) { |
| 2316 for (auto* box : *positionedObjects) | 2289 for (auto* box : *positionedObjects) |
| 2317 addOutlineRectsForDescendant(*box, rects, additionalOffset, incl
udeBlockOverflows); | 2290 addOutlineRectsForDescendant(*box, rects, additionalOffset, incl
udeBlockOverflows); |
| 2318 } | 2291 } |
| 2319 } | 2292 } |
| 2320 | |
| 2321 if (inlineElementContinuation) | |
| 2322 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in
lineElementContinuation->containingBlock()->location() - location()), includeBlo
ckOverflows); | |
| 2323 } | 2293 } |
| 2324 | 2294 |
| 2325 LayoutBox* LayoutBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par
ent) const | 2295 LayoutBox* LayoutBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par
ent) const |
| 2326 { | 2296 { |
| 2327 return createAnonymousWithParentAndDisplay(parent, style()->display()); | 2297 return createAnonymousWithParentAndDisplay(parent, style()->display()); |
| 2328 } | 2298 } |
| 2329 | 2299 |
| 2330 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const | 2300 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const |
| 2331 { | 2301 { |
| 2332 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 2302 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2599 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 2569 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
| 2600 LayoutBox* currBox = *it; | 2570 LayoutBox* currBox = *it; |
| 2601 ASSERT(!currBox->needsLayout()); | 2571 ASSERT(!currBox->needsLayout()); |
| 2602 } | 2572 } |
| 2603 } | 2573 } |
| 2604 } | 2574 } |
| 2605 | 2575 |
| 2606 #endif | 2576 #endif |
| 2607 | 2577 |
| 2608 } // namespace blink | 2578 } // namespace blink |
| OLD | NEW |