| Index: Source/core/dom/Text.cpp
|
| diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
|
| index eadc27ce186fbcb01710e0269858e70bb40f0a78..38572c7e6cc38cf2288114efc4ebd412fc170556 100644
|
| --- a/Source/core/dom/Text.cpp
|
| +++ b/Source/core/dom/Text.cpp
|
| @@ -22,6 +22,7 @@
|
| #include "config.h"
|
| #include "core/dom/Text.h"
|
|
|
| +#include "HTMLNames.h"
|
| #include "SVGNames.h"
|
| #include "core/css/resolver/StyleResolver.h"
|
| #include "core/dom/ExceptionCode.h"
|
| @@ -32,6 +33,7 @@
|
| #include "core/dom/shadow/ShadowRoot.h"
|
| #include "core/rendering/RenderCombineText.h"
|
| #include "core/rendering/RenderText.h"
|
| +#include "core/rendering/RenderTextFragment.h"
|
| #include "core/rendering/svg/RenderSVGInlineText.h"
|
| #include "wtf/text/CString.h"
|
| #include "wtf/text/StringBuilder.h"
|
| @@ -40,6 +42,8 @@ using namespace std;
|
|
|
| namespace WebCore {
|
|
|
| +using namespace HTMLNames;
|
| +
|
| PassRefPtr<Text> Text::create(Document* document, const String& data)
|
| {
|
| return adoptRef(new Text(document, data, CreateText));
|
| @@ -256,7 +260,7 @@ void Text::createTextRendererIfNeeded()
|
| NodeRenderingContext(this).createRendererForTextIfNeeded();
|
| }
|
|
|
| -RenderText* Text::createTextRenderer(RenderStyle* style)
|
| +RenderText* Text::createTextRenderer(ContainerNode* renderingParent, RenderStyle* style)
|
| {
|
| if (isSVGText(this) || isSVGShadowText(this))
|
| return new (document()->renderArena()) RenderSVGInlineText(this, dataImpl());
|
| @@ -264,6 +268,16 @@ RenderText* Text::createTextRenderer(RenderStyle* style)
|
| if (style->hasTextCombine())
|
| return new (document()->renderArena()) RenderCombineText(this, dataImpl());
|
|
|
| + // button input types (submit, button, reset) have special selection behavior
|
| + // provided by RenderTextFragment's implementation of canBeSelectionLeaf()
|
| + // that makes it only selectable if the button is inside an editable region.
|
| + //
|
| + // FIXME: We should probably add a new css property like -webkit-user-select: editable
|
| + // that makes text selectable only if contenteditable is used around it and remove
|
| + // this special case.
|
| + if (renderingParent->hasTagName(inputTag) && renderingParent->renderer()->isRenderButton())
|
| + return new (document()->renderArena()) RenderTextFragment(this, dataImpl());
|
| +
|
| return new (document()->renderArena()) RenderText(this, dataImpl());
|
| }
|
|
|
|
|