OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // Hit test all phases of replaced elements atomically, as though the replac
ed element established its | 206 // Hit test all phases of replaced elements atomically, as though the replac
ed element established its |
207 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab
le elements in the CSS2.1 | 207 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab
le elements in the CSS2.1 |
208 // specification.) | 208 // specification.) |
209 LayoutPoint childPoint = accumulatedOffset; | 209 LayoutPoint childPoint = accumulatedOffset; |
210 if (parent()->renderer().style()->isFlippedBlocksWritingMode()) // Faster th
an calling containingBlock(). | 210 if (parent()->renderer().style()->isFlippedBlocksWritingMode()) // Faster th
an calling containingBlock(). |
211 childPoint = renderer().containingBlock()->flipForWritingModeForChild(&t
oRenderBox(renderer()), childPoint); | 211 childPoint = renderer().containingBlock()->flipForWritingModeForChild(&t
oRenderBox(renderer()), childPoint); |
212 | 212 |
213 return renderer().hitTest(request, result, locationInContainer, childPoint); | 213 return renderer().hitTest(request, result, locationInContainer, childPoint); |
214 } | 214 } |
215 | 215 |
216 const RootInlineBox* InlineBox::root() const | 216 const RootInlineBox& InlineBox::root() const |
217 { | 217 { |
218 if (m_parent) | 218 if (m_parent) |
219 return m_parent->root(); | 219 return m_parent->root(); |
220 ASSERT(isRootInlineBox()); | 220 ASSERT(isRootInlineBox()); |
221 return static_cast<const RootInlineBox*>(this); | 221 return static_cast<const RootInlineBox&>(*this); |
222 } | 222 } |
223 | 223 |
224 RootInlineBox* InlineBox::root() | 224 RootInlineBox& InlineBox::root() |
225 { | 225 { |
226 if (m_parent) | 226 if (m_parent) |
227 return m_parent->root(); | 227 return m_parent->root(); |
228 ASSERT(isRootInlineBox()); | 228 ASSERT(isRootInlineBox()); |
229 return static_cast<RootInlineBox*>(this); | 229 return static_cast<RootInlineBox&>(*this); |
230 } | 230 } |
231 | 231 |
232 bool InlineBox::nextOnLineExists() const | 232 bool InlineBox::nextOnLineExists() const |
233 { | 233 { |
234 if (!m_bitfields.determinedIfNextOnLineExists()) { | 234 if (!m_bitfields.determinedIfNextOnLineExists()) { |
235 m_bitfields.setDeterminedIfNextOnLineExists(true); | 235 m_bitfields.setDeterminedIfNextOnLineExists(true); |
236 | 236 |
237 if (!parent()) | 237 if (!parent()) |
238 m_bitfields.setNextOnLineExists(false); | 238 m_bitfields.setNextOnLineExists(false); |
239 else if (nextOnLine()) | 239 else if (nextOnLine()) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 { | 307 { |
308 m_bitfields.setKnownToHaveNoOverflow(false); | 308 m_bitfields.setKnownToHaveNoOverflow(false); |
309 if (parent() && parent()->knownToHaveNoOverflow()) | 309 if (parent() && parent()->knownToHaveNoOverflow()) |
310 parent()->clearKnownToHaveNoOverflow(); | 310 parent()->clearKnownToHaveNoOverflow(); |
311 } | 311 } |
312 | 312 |
313 FloatPoint InlineBox::locationIncludingFlipping() | 313 FloatPoint InlineBox::locationIncludingFlipping() |
314 { | 314 { |
315 if (!renderer().style()->isFlippedBlocksWritingMode()) | 315 if (!renderer().style()->isFlippedBlocksWritingMode()) |
316 return FloatPoint(x(), y()); | 316 return FloatPoint(x(), y()); |
317 RenderBlockFlow& block = root()->block(); | 317 RenderBlockFlow& block = root().block(); |
318 if (block.style()->isHorizontalWritingMode()) | 318 if (block.style()->isHorizontalWritingMode()) |
319 return FloatPoint(x(), block.height() - height() - y()); | 319 return FloatPoint(x(), block.height() - height() - y()); |
320 | 320 |
321 return FloatPoint(block.width() - width() - x(), y()); | 321 return FloatPoint(block.width() - width() - x(), y()); |
322 } | 322 } |
323 | 323 |
324 void InlineBox::flipForWritingMode(FloatRect& rect) | 324 void InlineBox::flipForWritingMode(FloatRect& rect) |
325 { | 325 { |
326 if (!renderer().style()->isFlippedBlocksWritingMode()) | 326 if (!renderer().style()->isFlippedBlocksWritingMode()) |
327 return; | 327 return; |
328 root()->block().flipForWritingMode(rect); | 328 root().block().flipForWritingMode(rect); |
329 } | 329 } |
330 | 330 |
331 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point) | 331 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point) |
332 { | 332 { |
333 if (!renderer().style()->isFlippedBlocksWritingMode()) | 333 if (!renderer().style()->isFlippedBlocksWritingMode()) |
334 return point; | 334 return point; |
335 return root()->block().flipForWritingMode(point); | 335 return root().block().flipForWritingMode(point); |
336 } | 336 } |
337 | 337 |
338 void InlineBox::flipForWritingMode(LayoutRect& rect) | 338 void InlineBox::flipForWritingMode(LayoutRect& rect) |
339 { | 339 { |
340 if (!renderer().style()->isFlippedBlocksWritingMode()) | 340 if (!renderer().style()->isFlippedBlocksWritingMode()) |
341 return; | 341 return; |
342 root()->block().flipForWritingMode(rect); | 342 root().block().flipForWritingMode(rect); |
343 } | 343 } |
344 | 344 |
345 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) | 345 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) |
346 { | 346 { |
347 if (!renderer().style()->isFlippedBlocksWritingMode()) | 347 if (!renderer().style()->isFlippedBlocksWritingMode()) |
348 return point; | 348 return point; |
349 return root()->block().flipForWritingMode(point); | 349 return root().block().flipForWritingMode(point); |
350 } | 350 } |
351 | 351 |
352 } // namespace WebCore | 352 } // namespace WebCore |
353 | 353 |
354 #ifndef NDEBUG | 354 #ifndef NDEBUG |
355 | 355 |
356 void showTree(const WebCore::InlineBox* b) | 356 void showTree(const WebCore::InlineBox* b) |
357 { | 357 { |
358 if (b) | 358 if (b) |
359 b->showTreeForThis(); | 359 b->showTreeForThis(); |
360 } | 360 } |
361 | 361 |
362 void showLineTree(const WebCore::InlineBox* b) | 362 void showLineTree(const WebCore::InlineBox* b) |
363 { | 363 { |
364 if (b) | 364 if (b) |
365 b->showLineTreeForThis(); | 365 b->showLineTreeForThis(); |
366 } | 366 } |
367 | 367 |
368 #endif | 368 #endif |
OLD | NEW |