| 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
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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 #include "core/dom/Text.h" | 23 #include "core/dom/Text.h" |
| 24 | 24 |
| 25 #include "bindings/core/v8/ExceptionState.h" | 25 #include "bindings/core/v8/ExceptionState.h" |
| 26 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 26 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 27 #include "core/SVGNames.h" | 27 #include "core/SVGNames.h" |
| 28 #include "core/css/resolver/StyleResolver.h" | 28 #include "core/css/resolver/StyleResolver.h" |
| 29 #include "core/dom/ExceptionCode.h" | 29 #include "core/dom/ExceptionCode.h" |
| 30 #include "core/dom/LayoutTreeBuilder.h" | 30 #include "core/dom/LayoutTreeBuilder.h" |
| 31 #include "core/dom/NodeLayoutStyle.h" | 31 #include "core/dom/NodeComputedStyle.h" |
| 32 #include "core/dom/NodeRenderingTraversal.h" | 32 #include "core/dom/NodeRenderingTraversal.h" |
| 33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
| 34 #include "core/dom/shadow/ShadowRoot.h" | 34 #include "core/dom/shadow/ShadowRoot.h" |
| 35 #include "core/events/ScopedEventQueue.h" | 35 #include "core/events/ScopedEventQueue.h" |
| 36 #include "core/layout/LayoutText.h" | 36 #include "core/layout/LayoutText.h" |
| 37 #include "core/layout/LayoutTextCombine.h" | 37 #include "core/layout/LayoutTextCombine.h" |
| 38 #include "core/layout/svg/LayoutSVGInlineText.h" | 38 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 39 #include "core/svg/SVGForeignObjectElement.h" | 39 #include "core/svg/SVGForeignObjectElement.h" |
| 40 #include "wtf/text/CString.h" | 40 #include "wtf/text/CString.h" |
| 41 #include "wtf/text/StringBuilder.h" | 41 #include "wtf/text/StringBuilder.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 || parent.isLayoutTableCol() || parent.isFrameSet() | 282 || parent.isLayoutTableCol() || parent.isFrameSet() |
| 283 || parent.isFlexibleBox() || parent.isLayoutGrid() | 283 || parent.isFlexibleBox() || parent.isLayoutGrid() |
| 284 || parent.isSVGRoot() | 284 || parent.isSVGRoot() |
| 285 || parent.isSVGContainer() | 285 || parent.isSVGContainer() |
| 286 || parent.isSVGImage() | 286 || parent.isSVGImage() |
| 287 || parent.isSVGShape()) | 287 || parent.isSVGShape()) |
| 288 return false; | 288 return false; |
| 289 return true; | 289 return true; |
| 290 } | 290 } |
| 291 | 291 |
| 292 bool Text::textRendererIsNeeded(const LayoutStyle& style, const LayoutObject& pa
rent) | 292 bool Text::textRendererIsNeeded(const ComputedStyle& style, const LayoutObject&
parent) |
| 293 { | 293 { |
| 294 if (!parent.canHaveChildren()) | 294 if (!parent.canHaveChildren()) |
| 295 return false; | 295 return false; |
| 296 | 296 |
| 297 if (isEditingText()) | 297 if (isEditingText()) |
| 298 return true; | 298 return true; |
| 299 | 299 |
| 300 if (!length()) | 300 if (!length()) |
| 301 return false; | 301 return false; |
| 302 | 302 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 return true; | 343 return true; |
| 344 } | 344 } |
| 345 | 345 |
| 346 static bool isSVGText(Text* text) | 346 static bool isSVGText(Text* text) |
| 347 { | 347 { |
| 348 Node* parentOrShadowHostNode = text->parentOrShadowHostNode(); | 348 Node* parentOrShadowHostNode = text->parentOrShadowHostNode(); |
| 349 ASSERT(parentOrShadowHostNode); | 349 ASSERT(parentOrShadowHostNode); |
| 350 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement(
*parentOrShadowHostNode); | 350 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement(
*parentOrShadowHostNode); |
| 351 } | 351 } |
| 352 | 352 |
| 353 LayoutText* Text::createTextRenderer(const LayoutStyle& style) | 353 LayoutText* Text::createTextRenderer(const ComputedStyle& style) |
| 354 { | 354 { |
| 355 if (isSVGText(this)) | 355 if (isSVGText(this)) |
| 356 return new LayoutSVGInlineText(this, dataImpl()); | 356 return new LayoutSVGInlineText(this, dataImpl()); |
| 357 | 357 |
| 358 if (style.hasTextCombine()) | 358 if (style.hasTextCombine()) |
| 359 return new LayoutTextCombine(this, dataImpl()); | 359 return new LayoutTextCombine(this, dataImpl()); |
| 360 | 360 |
| 361 return new LayoutText(this, dataImpl()); | 361 return new LayoutText(this, dataImpl()); |
| 362 } | 362 } |
| 363 | 363 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (this->layoutObject()) | 411 if (this->layoutObject()) |
| 412 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); | 412 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 // If a whitespace node had no renderer and goes through a recalcStyle it may | 416 // If a whitespace node had no renderer and goes through a recalcStyle it may |
| 417 // need to create one if the parent style now has white-space: pre. | 417 // need to create one if the parent style now has white-space: pre. |
| 418 bool Text::needsWhitespaceRenderer() | 418 bool Text::needsWhitespaceRenderer() |
| 419 { | 419 { |
| 420 ASSERT(!layoutObject()); | 420 ASSERT(!layoutObject()); |
| 421 if (const LayoutStyle* style = parentLayoutStyle()) | 421 if (const ComputedStyle* style = parentComputedStyle()) |
| 422 return style->preserveNewline(); | 422 return style->preserveNewline(); |
| 423 return false; | 423 return false; |
| 424 } | 424 } |
| 425 | 425 |
| 426 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe
placedData, RecalcStyleBehavior recalcStyleBehavior) | 426 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe
placedData, RecalcStyleBehavior recalcStyleBehavior) |
| 427 { | 427 { |
| 428 if (!inActiveDocument()) | 428 if (!inActiveDocument()) |
| 429 return; | 429 return; |
| 430 LayoutText* textRenderer = layoutObject(); | 430 LayoutText* textRenderer = layoutObject(); |
| 431 if (!textRenderer || !textRendererIsNeeded(*textRenderer->style(), *textRend
erer->parent())) { | 431 if (!textRenderer || !textRendererIsNeeded(*textRenderer->style(), *textRend
erer->parent())) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 result.appendLiteral("; "); | 465 result.appendLiteral("; "); |
| 466 result.appendLiteral("value="); | 466 result.appendLiteral("value="); |
| 467 result.append(s); | 467 result.append(s); |
| 468 } | 468 } |
| 469 | 469 |
| 470 strncpy(buffer, result.toString().utf8().data(), length - 1); | 470 strncpy(buffer, result.toString().utf8().data(), length - 1); |
| 471 } | 471 } |
| 472 #endif | 472 #endif |
| 473 | 473 |
| 474 } // namespace blink | 474 } // namespace blink |
| OLD | NEW |