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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
965 inlineRunEnd = curr; | 965 inlineRunEnd = curr; |
966 if (curr->isInline()) | 966 if (curr->isInline()) |
967 sawInline = true; | 967 sawInline = true; |
968 curr = curr->nextSibling(); | 968 curr = curr->nextSibling(); |
969 } | 969 } |
970 } while (!sawInline); | 970 } while (!sawInline); |
971 } | 971 } |
972 | 972 |
973 void RenderBlock::deleteLineBoxTree() | 973 void RenderBlock::deleteLineBoxTree() |
974 { | 974 { |
975 m_lineBoxes.deleteLineBoxTree(); | 975 ASSERT(!m_lineBoxes.firstLineBox()); |
leviw_travelin_and_unemployed
2014/07/21 18:36:45
Your subject line led me to believe this was going
| |
976 | |
977 if (AXObjectCache* cache = document().existingAXObjectCache()) | |
978 cache->recomputeIsIgnored(this); | |
979 } | 976 } |
980 | 977 |
981 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) | 978 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) |
982 { | 979 { |
983 // makeChildrenNonInline takes a block whose children are *all* inline and i t | 980 // makeChildrenNonInline takes a block whose children are *all* inline and i t |
984 // makes sure that inline children are coalesced under anonymous | 981 // makes sure that inline children are coalesced under anonymous |
985 // blocks. If |insertionPoint| is defined, then it represents the insertion point for | 982 // blocks. If |insertionPoint| is defined, then it represents the insertion point for |
986 // the new block child that is causing us to have to wrap all the inlines. This | 983 // the new block child that is causing us to have to wrap all the inlines. This |
987 // means that we cannot coalesce inlines before |insertionPoint| with inline s following | 984 // means that we cannot coalesce inlines before |insertionPoint| with inline s following |
988 // |insertionPoint|, because the new child is going to be inserted in betwee n the inlines, | 985 // |insertionPoint|, because the new child is going to be inserted in betwee n the inlines, |
(...skipping 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4293 } | 4290 } |
4294 return count; | 4291 return count; |
4295 } | 4292 } |
4296 | 4293 |
4297 int RenderBlock::heightForLineCount(int l) | 4294 int RenderBlock::heightForLineCount(int l) |
4298 { | 4295 { |
4299 int count = 0; | 4296 int count = 0; |
4300 return getHeightForLineCount(this, l, true, count); | 4297 return getHeightForLineCount(this, l, true, count); |
4301 } | 4298 } |
4302 | 4299 |
4303 void RenderBlock::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const | |
4304 { | |
4305 // We don't deal with relative positioning. Our assumption is that you shri nk to fit the lines without accounting | |
4306 // for either overflow or translations via relative positioning. | |
4307 if (style()->visibility() == VISIBLE) { | |
4308 if (childrenInline()) { | |
4309 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo x()) { | |
4310 if (box->firstChild()) | |
4311 left = std::min(left, x + static_cast<LayoutUnit>(box->first Child()->x())); | |
4312 if (box->lastChild()) | |
4313 right = std::max(right, x + static_cast<LayoutUnit>(ceilf(bo x->lastChild()->logicalRight()))); | |
4314 } | |
4315 } else { | |
4316 for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBo x()) { | |
4317 if (!obj->isFloatingOrOutOfFlowPositioned()) { | |
4318 if (obj->isRenderBlockFlow() && !obj->hasOverflowClip()) | |
4319 toRenderBlock(obj)->adjustForBorderFit(x + obj->x(), lef t, right); | |
4320 else if (obj->style()->visibility() == VISIBLE) { | |
4321 // We are a replaced element or some kind of non-block-f low object. | |
4322 left = std::min(left, x + obj->x()); | |
4323 right = std::max(right, x + obj->x() + obj->width()); | |
4324 } | |
4325 } | |
4326 } | |
4327 } | |
4328 } | |
4329 } | |
4330 | |
4331 void RenderBlock::fitBorderToLinesIfNeeded() | |
4332 { | |
4333 if (style()->borderFit() == BorderFitBorder || hasOverrideWidth()) | |
4334 return; | |
4335 | |
4336 // Walk any normal flow lines to snugly fit. | |
4337 LayoutUnit left = LayoutUnit::max(); | |
4338 LayoutUnit right = LayoutUnit::min(); | |
4339 LayoutUnit oldWidth = contentWidth(); | |
4340 adjustForBorderFit(0, left, right); | |
4341 | |
4342 // Clamp to our existing edges. We can never grow. We only shrink. | |
4343 LayoutUnit leftEdge = borderLeft() + paddingLeft(); | |
4344 LayoutUnit rightEdge = leftEdge + oldWidth; | |
4345 left = std::min(rightEdge, std::max(leftEdge, left)); | |
4346 right = std::max(left, std::min(rightEdge, right)); | |
4347 | |
4348 LayoutUnit newContentWidth = right - left; | |
4349 if (newContentWidth == oldWidth) | |
4350 return; | |
4351 | |
4352 setOverrideLogicalContentWidth(newContentWidth); | |
4353 layoutBlock(false); | |
4354 clearOverrideLogicalContentWidth(); | |
4355 } | |
4356 | |
4357 void RenderBlock::clearTruncation() | 4300 void RenderBlock::clearTruncation() |
4358 { | 4301 { |
4359 if (style()->visibility() == VISIBLE) { | 4302 if (style()->visibility() == VISIBLE) { |
4360 if (childrenInline() && hasMarkupTruncation()) { | 4303 if (childrenInline() && hasMarkupTruncation()) { |
4361 setHasMarkupTruncation(false); | 4304 setHasMarkupTruncation(false); |
4362 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo x()) | 4305 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo x()) |
4363 box->clearTruncation(); | 4306 box->clearTruncation(); |
4364 } else { | 4307 } else { |
4365 for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling() ) { | 4308 for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling() ) { |
4366 if (shouldCheckLines(obj)) | 4309 if (shouldCheckLines(obj)) |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4900 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 4843 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
4901 { | 4844 { |
4902 showRenderObject(); | 4845 showRenderObject(); |
4903 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 4846 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
4904 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 4847 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
4905 } | 4848 } |
4906 | 4849 |
4907 #endif | 4850 #endif |
4908 | 4851 |
4909 } // namespace blink | 4852 } // namespace blink |
OLD | NEW |