OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) +
lastSelectedLine->selectionBottom(); | 2471 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) +
lastSelectedLine->selectionBottom(); |
2472 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine
->selectionBottom()); | 2472 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine
->selectionBottom()); |
2473 lastLogicalRight = logicalRightSelectionOffset(rootBlock, lastSelectedLi
ne->selectionBottom()); | 2473 lastLogicalRight = logicalRightSelectionOffset(rootBlock, lastSelectedLi
ne->selectionBottom()); |
2474 } | 2474 } |
2475 return result; | 2475 return result; |
2476 } | 2476 } |
2477 | 2477 |
2478 template <typename CharacterType> | 2478 template <typename CharacterType> |
2479 static inline TextRun constructTextRunInternal(RenderObject* context, const Font
& font, const CharacterType* characters, int length, RenderStyle* style, TextRun
::ExpansionBehavior expansion) | 2479 static inline TextRun constructTextRunInternal(RenderObject* context, const Font
& font, const CharacterType* characters, int length, RenderStyle* style, TextRun
::ExpansionBehavior expansion) |
2480 { | 2480 { |
| 2481 return constructTextRunInternal(context, font, characters, length, style, LT
R, expansion); |
| 2482 } |
| 2483 |
| 2484 template <typename CharacterType> |
| 2485 static inline TextRun constructTextRunInternal(RenderObject* context, const Font
& font, const CharacterType* characters, int length, RenderStyle* style, TextDir
ection direction, TextRun::ExpansionBehavior expansion) |
| 2486 { |
2481 ASSERT(style); | 2487 ASSERT(style); |
2482 | 2488 |
2483 TextDirection textDirection = LTR; | 2489 TextDirection textDirection = direction; |
2484 bool directionalOverride = style->rtlOrdering() == VisualOrder; | 2490 bool directionalOverride = style->rtlOrdering() == VisualOrder; |
2485 | 2491 |
2486 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO
verride); | 2492 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO
verride); |
2487 if (textRunNeedsRenderingContext(font)) | 2493 if (textRunNeedsRenderingContext(font)) |
2488 run.setRenderingContext(SVGTextRunRenderingContext::create(context)); | 2494 run.setRenderingContext(SVGTextRunRenderingContext::create(context)); |
2489 | 2495 |
2490 return run; | 2496 return run; |
2491 } | 2497 } |
2492 | 2498 |
2493 template <typename CharacterType> | 2499 template <typename CharacterType> |
(...skipping 27 matching lines...) Expand all Loading... |
2521 return constructTextRunInternal(context, font, characters, length, style, ex
pansion); | 2527 return constructTextRunInternal(context, font, characters, length, style, ex
pansion); |
2522 } | 2528 } |
2523 | 2529 |
2524 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon
t, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expans
ion) | 2530 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon
t, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expans
ion) |
2525 { | 2531 { |
2526 if (text->is8Bit()) | 2532 if (text->is8Bit()) |
2527 return constructTextRunInternal(context, font, text->characters8(), text
->textLength(), style, expansion); | 2533 return constructTextRunInternal(context, font, text->characters8(), text
->textLength(), style, expansion); |
2528 return constructTextRunInternal(context, font, text->characters16(), text->t
extLength(), style, expansion); | 2534 return constructTextRunInternal(context, font, text->characters16(), text->t
extLength(), style, expansion); |
2529 } | 2535 } |
2530 | 2536 |
2531 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon
t, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style,
TextRun::ExpansionBehavior expansion) | 2537 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon
t, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style,
TextDirection direction, TextRun::ExpansionBehavior expansion) |
2532 { | 2538 { |
2533 ASSERT(offset + length <= text->textLength()); | 2539 ASSERT(offset + length <= text->textLength()); |
2534 if (text->is8Bit()) | 2540 if (text->is8Bit()) |
2535 return constructTextRunInternal(context, font, text->characters8() + off
set, length, style, expansion); | 2541 return constructTextRunInternal(context, font, text->characters8() + off
set, length, style, direction, expansion); |
2536 return constructTextRunInternal(context, font, text->characters16() + offset
, length, style, expansion); | 2542 return constructTextRunInternal(context, font, text->characters16() + offset
, length, style, direction, expansion); |
2537 } | 2543 } |
2538 | 2544 |
2539 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon
t, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansio
n, TextRunFlags flags) | 2545 TextRun RenderBlockFlow::constructTextRun(RenderObject* context, const Font& fon
t, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansio
n, TextRunFlags flags) |
2540 { | 2546 { |
2541 unsigned length = string.length(); | 2547 unsigned length = string.length(); |
2542 if (!length) | 2548 if (!length) |
2543 return constructTextRunInternal(context, font, static_cast<const LChar*>
(0), length, style, expansion, flags); | 2549 return constructTextRunInternal(context, font, static_cast<const LChar*>
(0), length, style, expansion, flags); |
2544 if (string.is8Bit()) | 2550 if (string.is8Bit()) |
2545 return constructTextRunInternal(context, font, string.characters8(), len
gth, style, expansion, flags); | 2551 return constructTextRunInternal(context, font, string.characters8(), len
gth, style, expansion, flags); |
2546 return constructTextRunInternal(context, font, string.characters16(), length
, style, expansion, flags); | 2552 return constructTextRunInternal(context, font, string.characters16(), length
, style, expansion, flags); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2609 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2604 { | 2610 { |
2605 if (m_rareData) | 2611 if (m_rareData) |
2606 return *m_rareData; | 2612 return *m_rareData; |
2607 | 2613 |
2608 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2614 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
2609 return *m_rareData; | 2615 return *m_rareData; |
2610 } | 2616 } |
2611 | 2617 |
2612 } // namespace WebCore | 2618 } // namespace WebCore |
OLD | NEW |