| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 trailingSpaceRun->m_level = 0; | 1219 trailingSpaceRun->m_level = 0; |
| 1220 } else { | 1220 } else { |
| 1221 bidiRuns.moveRunToBeginning(trailingSpaceRun); | 1221 bidiRuns.moveRunToBeginning(trailingSpaceRun); |
| 1222 trailingSpaceRun->m_level = 1; | 1222 trailingSpaceRun->m_level = 1; |
| 1223 } | 1223 } |
| 1224 return trailingSpaceRun; | 1224 return trailingSpaceRun; |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 void RenderBlock::appendFloatingObjectToLastLine(FloatingObject* floatingObject) | 1227 void RenderBlock::appendFloatingObjectToLastLine(FloatingObject* floatingObject) |
| 1228 { | 1228 { |
| 1229 ASSERT(!floatingObject->m_originatingLine); | 1229 ASSERT(!floatingObject->originatingLine()); |
| 1230 floatingObject->m_originatingLine = lastRootBox(); | 1230 floatingObject->setOriginatingLine(lastRootBox()); |
| 1231 lastRootBox()->appendFloat(floatingObject->renderer()); | 1231 lastRootBox()->appendFloat(floatingObject->renderer()); |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 // FIXME: This should be a BidiStatus constructor or create method. | 1234 // FIXME: This should be a BidiStatus constructor or create method. |
| 1235 static inline BidiStatus statusWithDirection(TextDirection textDirection, bool i
sOverride) | 1235 static inline BidiStatus statusWithDirection(TextDirection textDirection, bool i
sOverride) |
| 1236 { | 1236 { |
| 1237 WTF::Unicode::Direction direction = textDirection == LTR ? LeftToRight : Rig
htToLeft; | 1237 WTF::Unicode::Direction direction = textDirection == LTR ? LeftToRight : Rig
htToLeft; |
| 1238 RefPtr<BidiContext> context = BidiContext::create(textDirection == LTR ? 0 :
1, direction, isOverride, FromStyleOrDOM); | 1238 RefPtr<BidiContext> context = BidiContext::create(textDirection == LTR ? 0 :
1, direction, isOverride, FromStyleOrDOM); |
| 1239 | 1239 |
| 1240 // This copies BidiStatus and may churn the ref on BidiContext. I doubt it m
atters. | 1240 // This copies BidiStatus and may churn the ref on BidiContext. I doubt it m
atters. |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1874 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 1875 if (layoutState.lastFloat()) { | 1875 if (layoutState.lastFloat()) { |
| 1876 FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.
find(layoutState.lastFloat()); | 1876 FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.
find(layoutState.lastFloat()); |
| 1877 ASSERT(lastFloatIterator != end); | 1877 ASSERT(lastFloatIterator != end); |
| 1878 ++lastFloatIterator; | 1878 ++lastFloatIterator; |
| 1879 it = lastFloatIterator; | 1879 it = lastFloatIterator; |
| 1880 } | 1880 } |
| 1881 for (; it != end; ++it) { | 1881 for (; it != end; ++it) { |
| 1882 FloatingObject* f = *it; | 1882 FloatingObject* f = *it; |
| 1883 appendFloatingObjectToLastLine(f); | 1883 appendFloatingObjectToLastLine(f); |
| 1884 ASSERT(f->m_renderer == layoutState.floats()[layoutState.floatIn
dex()].object); | 1884 ASSERT(f->renderer() == layoutState.floats()[layoutState.floatIn
dex()].object); |
| 1885 // If a float's geometry has changed, give up on syncing with cl
ean lines. | 1885 // If a float's geometry has changed, give up on syncing with cl
ean lines. |
| 1886 if (layoutState.floats()[layoutState.floatIndex()].rect != f->fr
ameRect()) | 1886 if (layoutState.floats()[layoutState.floatIndex()].rect != f->fr
ameRect()) |
| 1887 checkForEndLineMatch = false; | 1887 checkForEndLineMatch = false; |
| 1888 layoutState.setFloatIndex(layoutState.floatIndex() + 1); | 1888 layoutState.setFloatIndex(layoutState.floatIndex() + 1); |
| 1889 } | 1889 } |
| 1890 layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObje
ctSet.last() : 0); | 1890 layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObje
ctSet.last() : 0); |
| 1891 } | 1891 } |
| 1892 | 1892 |
| 1893 lineMidpointState.reset(); | 1893 lineMidpointState.reset(); |
| 1894 resolver.setPosition(end, numberOfIsolateAncestors(end)); | 1894 resolver.setPosition(end, numberOfIsolateAncestors(end)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 if (delta) { | 1968 if (delta) { |
| 1969 layoutState.updateRepaintRangeFromBox(line, delta); | 1969 layoutState.updateRepaintRangeFromBox(line, delta); |
| 1970 line->adjustBlockDirectionPosition(delta); | 1970 line->adjustBlockDirectionPosition(delta); |
| 1971 } | 1971 } |
| 1972 if (layoutState.flowThread()) | 1972 if (layoutState.flowThread()) |
| 1973 line->setContainingRegion(regionAtBlockOffset(line->lineTopW
ithLeading())); | 1973 line->setContainingRegion(regionAtBlockOffset(line->lineTopW
ithLeading())); |
| 1974 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 1974 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { |
| 1975 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1975 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); |
| 1976 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { | 1976 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { |
| 1977 FloatingObject* floatingObject = insertFloatingObject(*f
); | 1977 FloatingObject* floatingObject = insertFloatingObject(*f
); |
| 1978 ASSERT(!floatingObject->m_originatingLine); | 1978 ASSERT(!floatingObject->originatingLine()); |
| 1979 floatingObject->m_originatingLine = line; | 1979 floatingObject->setOriginatingLine(line); |
| 1980 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); | 1980 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); |
| 1981 positionNewFloats(); | 1981 positionNewFloats(); |
| 1982 } | 1982 } |
| 1983 } | 1983 } |
| 1984 } | 1984 } |
| 1985 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); | 1985 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); |
| 1986 } else { | 1986 } else { |
| 1987 // Delete all the remaining lines. | 1987 // Delete all the remaining lines. |
| 1988 deleteLineRange(layoutState, layoutState.endLine()); | 1988 deleteLineRange(layoutState, layoutState.endLine()); |
| 1989 } | 1989 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2259 unsigned numCleanFloats = 0; | 2259 unsigned numCleanFloats = 0; |
| 2260 if (!layoutState.floats().isEmpty()) { | 2260 if (!layoutState.floats().isEmpty()) { |
| 2261 LayoutUnit savedLogicalHeight = logicalHeight(); | 2261 LayoutUnit savedLogicalHeight = logicalHeight(); |
| 2262 // Restore floats from clean lines. | 2262 // Restore floats from clean lines. |
| 2263 RootInlineBox* line = firstRootBox(); | 2263 RootInlineBox* line = firstRootBox(); |
| 2264 while (line != curr) { | 2264 while (line != curr) { |
| 2265 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 2265 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { |
| 2266 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 2266 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); |
| 2267 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin();
f != end; ++f) { | 2267 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin();
f != end; ++f) { |
| 2268 FloatingObject* floatingObject = insertFloatingObject(*f); | 2268 FloatingObject* floatingObject = insertFloatingObject(*f); |
| 2269 ASSERT(!floatingObject->m_originatingLine); | 2269 ASSERT(!floatingObject->originatingLine()); |
| 2270 floatingObject->m_originatingLine = line; | 2270 floatingObject->setOriginatingLine(line); |
| 2271 setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChi
ld(*f)); | 2271 setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChi
ld(*f)); |
| 2272 positionNewFloats(); | 2272 positionNewFloats(); |
| 2273 ASSERT(layoutState.floats()[numCleanFloats].object == *f); | 2273 ASSERT(layoutState.floats()[numCleanFloats].object == *f); |
| 2274 numCleanFloats++; | 2274 numCleanFloats++; |
| 2275 } | 2275 } |
| 2276 } | 2276 } |
| 2277 line = line->nextRootBox(); | 2277 line = line->nextRootBox(); |
| 2278 } | 2278 } |
| 2279 setLogicalHeight(savedLogicalHeight); | 2279 setLogicalHeight(savedLogicalHeight); |
| 2280 } | 2280 } |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3394 bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec
t* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width) | 3394 bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec
t* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width) |
| 3395 { | 3395 { |
| 3396 if (!positionNewFloats()) | 3396 if (!positionNewFloats()) |
| 3397 return false; | 3397 return false; |
| 3398 | 3398 |
| 3399 width.shrinkAvailableWidthForNewFloatIfNeeded(newFloat); | 3399 width.shrinkAvailableWidthForNewFloatIfNeeded(newFloat); |
| 3400 | 3400 |
| 3401 // We only connect floats to lines for pagination purposes if the floats occ
ur at the start of | 3401 // We only connect floats to lines for pagination purposes if the floats occ
ur at the start of |
| 3402 // the line and the previous line had a hard break (so this line is either t
he first in the block | 3402 // the line and the previous line had a hard break (so this line is either t
he first in the block |
| 3403 // or follows a <br>). | 3403 // or follows a <br>). |
| 3404 if (!newFloat->m_paginationStrut || !lineInfo.previousLineBrokeCleanly() ||
!lineInfo.isEmpty()) | 3404 if (!newFloat->paginationStrut() || !lineInfo.previousLineBrokeCleanly() ||
!lineInfo.isEmpty()) |
| 3405 return true; | 3405 return true; |
| 3406 | 3406 |
| 3407 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 3407 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 3408 ASSERT(floatingObjectSet.last() == newFloat); | 3408 ASSERT(floatingObjectSet.last() == newFloat); |
| 3409 | 3409 |
| 3410 LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat); | 3410 LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat); |
| 3411 int paginationStrut = newFloat->m_paginationStrut; | 3411 int paginationStrut = newFloat->paginationStrut(); |
| 3412 | 3412 |
| 3413 if (floatLogicalTop - paginationStrut != logicalHeight() + lineInfo.floatPag
inationStrut()) | 3413 if (floatLogicalTop - paginationStrut != logicalHeight() + lineInfo.floatPag
inationStrut()) |
| 3414 return true; | 3414 return true; |
| 3415 | 3415 |
| 3416 FloatingObjectSetIterator it = floatingObjectSet.end(); | 3416 FloatingObjectSetIterator it = floatingObjectSet.end(); |
| 3417 --it; // Last float is newFloat, skip that one. | 3417 --it; // Last float is newFloat, skip that one. |
| 3418 FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 3418 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
| 3419 while (it != begin) { | 3419 while (it != begin) { |
| 3420 --it; | 3420 --it; |
| 3421 FloatingObject* f = *it; | 3421 FloatingObject* f = *it; |
| 3422 if (f == lastFloatFromPreviousLine) | 3422 if (f == lastFloatFromPreviousLine) |
| 3423 break; | 3423 break; |
| 3424 if (logicalTopForFloat(f) == logicalHeight() + lineInfo.floatPaginationS
trut()) { | 3424 if (logicalTopForFloat(f) == logicalHeight() + lineInfo.floatPaginationS
trut()) { |
| 3425 f->m_paginationStrut += paginationStrut; | 3425 f->setPaginationStrut(paginationStrut + f->paginationStrut()); |
| 3426 RenderBox* o = f->m_renderer; | 3426 RenderBox* o = f->renderer(); |
| 3427 setLogicalTopForChild(o, logicalTopForChild(o) + marginBeforeForChil
d(o) + paginationStrut); | 3427 setLogicalTopForChild(o, logicalTopForChild(o) + marginBeforeForChil
d(o) + paginationStrut); |
| 3428 if (o->isRenderBlock()) | 3428 if (o->isRenderBlock()) |
| 3429 toRenderBlock(o)->setChildNeedsLayout(MarkOnlyThis); | 3429 toRenderBlock(o)->setChildNeedsLayout(MarkOnlyThis); |
| 3430 o->layoutIfNeeded(); | 3430 o->layoutIfNeeded(); |
| 3431 // Save the old logical top before calling removePlacedObject which
will set | 3431 // Save the old logical top before calling removePlacedObject which
will set |
| 3432 // isPlaced to false. Otherwise it will trigger an assert in logical
TopForFloat. | 3432 // isPlaced to false. Otherwise it will trigger an assert in logical
TopForFloat. |
| 3433 LayoutUnit oldLogicalTop = logicalTopForFloat(f); | 3433 LayoutUnit oldLogicalTop = logicalTopForFloat(f); |
| 3434 m_floatingObjects->removePlacedObject(f); | 3434 m_floatingObjects->removePlacedObject(f); |
| 3435 setLogicalTopForFloat(f, oldLogicalTop + paginationStrut); | 3435 setLogicalTopForFloat(f, oldLogicalTop + paginationStrut); |
| 3436 m_floatingObjects->addPlacedObject(f); | 3436 m_floatingObjects->addPlacedObject(f); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3479 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3479 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
| 3480 | 3480 |
| 3481 setLineGridBox(lineGridBox); | 3481 setLineGridBox(lineGridBox); |
| 3482 | 3482 |
| 3483 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3483 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
| 3484 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3484 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
| 3485 // to this grid. | 3485 // to this grid. |
| 3486 } | 3486 } |
| 3487 | 3487 |
| 3488 } | 3488 } |
| OLD | NEW |