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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 if (TextLayoutObjectIsNeeded(*style_parent->GetComputedStyle(), | 361 if (TextLayoutObjectIsNeeded(*style_parent->GetComputedStyle(), |
362 *parent_layout_object)) { | 362 *parent_layout_object)) { |
363 LayoutTreeBuilderForText(*this, parent_layout_object, | 363 LayoutTreeBuilderForText(*this, parent_layout_object, |
364 style_parent->MutableComputedStyle()) | 364 style_parent->MutableComputedStyle()) |
365 .CreateLayoutObject(); | 365 .CreateLayoutObject(); |
366 } | 366 } |
367 } | 367 } |
368 CharacterData::AttachLayoutTree(context); | 368 CharacterData::AttachLayoutTree(context); |
369 } | 369 } |
370 | 370 |
371 void Text::ReattachLayoutTreeIfNeeded(const AttachContext& context) { | 371 void Text::ReattachLayoutTreeIfNeeded() { |
372 bool layout_object_is_needed = false; | 372 bool layout_object_is_needed = false; |
373 ContainerNode* style_parent = LayoutTreeBuilderTraversal::Parent(*this); | 373 ContainerNode* style_parent = LayoutTreeBuilderTraversal::Parent(*this); |
374 LayoutObject* parent_layout_object = | 374 LayoutObject* parent_layout_object = |
375 LayoutTreeBuilderTraversal::ParentLayoutObject(*this); | 375 LayoutTreeBuilderTraversal::ParentLayoutObject(*this); |
376 if (style_parent && parent_layout_object) { | 376 if (style_parent && parent_layout_object) { |
377 DCHECK(style_parent->GetComputedStyle()); | 377 DCHECK(style_parent->GetComputedStyle()); |
378 layout_object_is_needed = TextLayoutObjectIsNeeded( | 378 layout_object_is_needed = TextLayoutObjectIsNeeded( |
379 *style_parent->GetComputedStyle(), *parent_layout_object); | 379 *style_parent->GetComputedStyle(), *parent_layout_object); |
380 } | 380 } |
381 | 381 |
382 if (layout_object_is_needed == !!GetLayoutObject()) | 382 if (layout_object_is_needed == !!GetLayoutObject()) |
383 return; | 383 return; |
384 | 384 |
385 // The following is almost the same as Node::reattachLayoutTree() except that | 385 // The following is almost the same as Node::reattachLayoutTree() except that |
386 // we create a layoutObject only if needed. Not calling reattachLayoutTree() | 386 // we create a layoutObject only if needed. Not calling reattachLayoutTree() |
387 // to avoid repeated calls to Text::textLayoutObjectIsNeeded(). | 387 // to avoid repeated calls to Text::textLayoutObjectIsNeeded(). |
388 AttachContext reattach_context(context); | 388 AttachContext reattach_context; |
389 reattach_context.performing_reattach = true; | 389 reattach_context.performing_reattach = true; |
390 | 390 |
391 if (GetStyleChangeType() < kNeedsReattachStyleChange) | 391 if (GetStyleChangeType() < kNeedsReattachStyleChange) |
392 DetachLayoutTree(reattach_context); | 392 DetachLayoutTree(reattach_context); |
393 if (layout_object_is_needed) { | 393 if (layout_object_is_needed) { |
394 LayoutTreeBuilderForText(*this, parent_layout_object, | 394 LayoutTreeBuilderForText(*this, parent_layout_object, |
395 style_parent->MutableComputedStyle()) | 395 style_parent->MutableComputedStyle()) |
396 .CreateLayoutObject(); | 396 .CreateLayoutObject(); |
397 } | 397 } |
398 CharacterData::AttachLayoutTree(reattach_context); | 398 CharacterData::AttachLayoutTree(reattach_context); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 Text* Text::CloneWithData(const String& data) { | 471 Text* Text::CloneWithData(const String& data) { |
472 return Create(GetDocument(), data); | 472 return Create(GetDocument(), data); |
473 } | 473 } |
474 | 474 |
475 DEFINE_TRACE(Text) { | 475 DEFINE_TRACE(Text) { |
476 CharacterData::Trace(visitor); | 476 CharacterData::Trace(visitor); |
477 } | 477 } |
478 | 478 |
479 } // namespace blink | 479 } // namespace blink |
OLD | NEW |