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) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "core/dom/shadow/ShadowRoot.h" | 43 #include "core/dom/shadow/ShadowRoot.h" |
44 #include "core/editing/markup.h" | 44 #include "core/editing/markup.h" |
45 #include "core/events/EventListener.h" | 45 #include "core/events/EventListener.h" |
46 #include "core/events/KeyboardEvent.h" | 46 #include "core/events/KeyboardEvent.h" |
47 #include "core/frame/Settings.h" | 47 #include "core/frame/Settings.h" |
48 #include "core/html/HTMLBRElement.h" | 48 #include "core/html/HTMLBRElement.h" |
49 #include "core/html/HTMLFormElement.h" | 49 #include "core/html/HTMLFormElement.h" |
50 #include "core/html/HTMLInputElement.h" | 50 #include "core/html/HTMLInputElement.h" |
51 #include "core/html/HTMLMenuElement.h" | 51 #include "core/html/HTMLMenuElement.h" |
52 #include "core/html/HTMLTemplateElement.h" | 52 #include "core/html/HTMLTemplateElement.h" |
| 53 #include "core/html/HTMLTextAreaElement.h" |
53 #include "core/html/HTMLTextFormControlElement.h" | 54 #include "core/html/HTMLTextFormControlElement.h" |
54 #include "core/html/parser/HTMLParserIdioms.h" | 55 #include "core/html/parser/HTMLParserIdioms.h" |
55 #include "core/rendering/RenderObject.h" | 56 #include "core/rendering/RenderObject.h" |
56 #include "platform/text/BidiResolver.h" | 57 #include "platform/text/BidiResolver.h" |
57 #include "platform/text/BidiTextRun.h" | 58 #include "platform/text/BidiTextRun.h" |
58 #include "platform/text/TextRunIterator.h" | 59 #include "platform/text/TextRunIterator.h" |
59 #include "wtf/StdLibExtras.h" | 60 #include "wtf/StdLibExtras.h" |
60 #include "wtf/text/CString.h" | 61 #include "wtf/text/CString.h" |
61 | 62 |
62 namespace blink { | 63 namespace blink { |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 681 } |
681 | 682 |
682 isAuto = true; | 683 isAuto = true; |
683 return directionality(); | 684 return directionality(); |
684 } | 685 } |
685 | 686 |
686 TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
onst | 687 TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
onst |
687 { | 688 { |
688 if (isHTMLInputElement(*this)) { | 689 if (isHTMLInputElement(*this)) { |
689 HTMLInputElement* inputElement = toHTMLInputElement(const_cast<HTMLEleme
nt*>(this)); | 690 HTMLInputElement* inputElement = toHTMLInputElement(const_cast<HTMLEleme
nt*>(this)); |
| 691 if (inputElement->isTextField() || inputElement->isSearchField() |
| 692 || inputElement->isURLField() || inputElement->isEmailField()) { |
| 693 bool hasStrongDirectionality; |
| 694 TextDirection textDirection = determineDirectionality(inputElement->
value(), hasStrongDirectionality); |
| 695 if (strongDirectionalityTextNode) |
| 696 *strongDirectionalityTextNode = hasStrongDirectionality ? inputE
lement : 0; |
| 697 return textDirection; |
| 698 } |
| 699 } else if (isHTMLTextAreaElement(*this)) { |
| 700 HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(const_cast<
HTMLElement*>(this)); |
690 bool hasStrongDirectionality; | 701 bool hasStrongDirectionality; |
691 TextDirection textDirection = determineDirectionality(inputElement->valu
e(), hasStrongDirectionality); | 702 TextDirection textDirection = determineDirectionality(textAreaElement->v
alue(), hasStrongDirectionality); |
692 if (strongDirectionalityTextNode) | 703 if (strongDirectionalityTextNode) |
693 *strongDirectionalityTextNode = hasStrongDirectionality ? inputEleme
nt : 0; | 704 *strongDirectionalityTextNode = hasStrongDirectionality ? textAreaEl
ement : 0; |
694 return textDirection; | 705 return textDirection; |
695 } | 706 } |
696 | 707 |
697 Node* node = firstChild(); | 708 Node* node = firstChild(); |
698 while (node) { | 709 while (node) { |
699 // Skip bdi, script, style and text form controls. | 710 // Skip bdi, script, style and text form controls. |
700 if (equalIgnoringCase(node->nodeName(), "bdi") || isHTMLScriptElement(*n
ode) || isHTMLStyleElement(*node) | 711 if (equalIgnoringCase(node->nodeName(), "bdi") || isHTMLScriptElement(*n
ode) || isHTMLStyleElement(*node) |
701 || (node->isElementNode() && toElement(node)->isTextFormControl()))
{ | 712 || (node->isElementNode() && toElement(node)->isTextFormControl()))
{ |
702 node = NodeTraversal::nextSkippingChildren(*node, this); | 713 node = NodeTraversal::nextSkippingChildren(*node, this); |
703 continue; | 714 continue; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 #ifndef NDEBUG | 1005 #ifndef NDEBUG |
995 | 1006 |
996 // For use in the debugger | 1007 // For use in the debugger |
997 void dumpInnerHTML(blink::HTMLElement*); | 1008 void dumpInnerHTML(blink::HTMLElement*); |
998 | 1009 |
999 void dumpInnerHTML(blink::HTMLElement* element) | 1010 void dumpInnerHTML(blink::HTMLElement* element) |
1000 { | 1011 { |
1001 printf("%s\n", element->innerHTML().ascii().data()); | 1012 printf("%s\n", element->innerHTML().ascii().data()); |
1002 } | 1013 } |
1003 #endif | 1014 #endif |
OLD | NEW |