Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: third_party/WebKit/Source/core/dom/Text.cpp

Issue 2164493002: Renamed Node::attach to Node::attachLayoutTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 { 336 {
337 if (isSVGText(this)) 337 if (isSVGText(this))
338 return new LayoutSVGInlineText(this, dataImpl()); 338 return new LayoutSVGInlineText(this, dataImpl());
339 339
340 if (style.hasTextCombine()) 340 if (style.hasTextCombine())
341 return new LayoutTextCombine(this, dataImpl()); 341 return new LayoutTextCombine(this, dataImpl());
342 342
343 return new LayoutText(this, dataImpl()); 343 return new LayoutText(this, dataImpl());
344 } 344 }
345 345
346 void Text::attach(const AttachContext& context) 346 void Text::attachLayoutTree(const AttachContext& context)
347 { 347 {
348 if (ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this)) { 348 if (ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this)) {
349 if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) { 349 if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) {
350 if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), *parentLa youtObject)) 350 if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), *parentLa youtObject))
351 LayoutTreeBuilderForText(*this, parentLayoutObject).createLayout Object(); 351 LayoutTreeBuilderForText(*this, parentLayoutObject).createLayout Object();
352 } 352 }
353 } 353 }
354 CharacterData::attach(context); 354 CharacterData::attachLayoutTree(context);
355 } 355 }
356 356
357 void Text::reattachIfNeeded(const AttachContext& context) 357 void Text::reattachIfNeeded(const AttachContext& context)
358 { 358 {
359 bool layoutObjectIsNeeded = false; 359 bool layoutObjectIsNeeded = false;
360 ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this); 360 ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this);
361 if (layoutParent) { 361 if (layoutParent) {
362 if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) { 362 if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) {
363 if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), *parentLa youtObject)) 363 if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), *parentLa youtObject))
364 layoutObjectIsNeeded = true; 364 layoutObjectIsNeeded = true;
365 } 365 }
366 } 366 }
367 367
368 if (layoutObjectIsNeeded == !!layoutObject()) 368 if (layoutObjectIsNeeded == !!layoutObject())
369 return; 369 return;
370 370
371 // The following is almost the same as Node::reattach() except that we creat e a layoutObject only if needed. 371 // The following is almost the same as Node::reattach() except that we creat e a layoutObject only if needed.
372 // Not calling reattach() to avoid repeated calls to Text::textLayoutObjectI sNeeded(). 372 // Not calling reattach() to avoid repeated calls to Text::textLayoutObjectI sNeeded().
373 AttachContext reattachContext(context); 373 AttachContext reattachContext(context);
374 reattachContext.performingReattach = true; 374 reattachContext.performingReattach = true;
375 375
376 if (getStyleChangeType() < NeedsReattachStyleChange) 376 if (getStyleChangeType() < NeedsReattachStyleChange)
377 detach(reattachContext); 377 detach(reattachContext);
378 if (layoutObjectIsNeeded) 378 if (layoutObjectIsNeeded)
379 LayoutTreeBuilderForText(*this, layoutParent->layoutObject()).createLayo utObject(); 379 LayoutTreeBuilderForText(*this, layoutParent->layoutObject()).createLayo utObject();
380 CharacterData::attach(reattachContext); 380 CharacterData::attachLayoutTree(reattachContext);
381 } 381 }
382 382
383 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) 383 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling)
384 { 384 {
385 if (LayoutTextItem layoutItem = LayoutTextItem(this->layoutObject())) { 385 if (LayoutTextItem layoutItem = LayoutTextItem(this->layoutObject())) {
386 if (change != NoChange || needsStyleRecalc()) 386 if (change != NoChange || needsStyleRecalc())
387 layoutItem.setStyle(document().ensureStyleResolver().styleForText(th is)); 387 layoutItem.setStyle(document().ensureStyleResolver().styleForText(th is));
388 if (needsStyleRecalc()) 388 if (needsStyleRecalc())
389 layoutItem.setText(dataImpl()); 389 layoutItem.setText(dataImpl());
390 clearNeedsStyleRecalc(); 390 clearNeedsStyleRecalc();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 result.append("; "); 458 result.append("; ");
459 result.append("value="); 459 result.append("value=");
460 result.append(s); 460 result.append(s);
461 } 461 }
462 462
463 strncpy(buffer, result.toString().utf8().data(), length - 1); 463 strncpy(buffer, result.toString().utf8().data(), length - 1);
464 } 464 }
465 #endif 465 #endif
466 466
467 } // namespace blink 467 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698