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

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 23112019: If an element has unicode-bidi: plaintext and no strong directional characters. By default it shoul… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Proposed patch v3 Created 7 years, 4 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
« no previous file with comments | « Source/core/css/html.css ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 27 matching lines...) Expand all
38 #include "core/dom/DocumentFragment.h" 38 #include "core/dom/DocumentFragment.h"
39 #include "core/dom/EventListener.h" 39 #include "core/dom/EventListener.h"
40 #include "core/dom/EventNames.h" 40 #include "core/dom/EventNames.h"
41 #include "core/dom/ExceptionCode.h" 41 #include "core/dom/ExceptionCode.h"
42 #include "core/dom/KeyboardEvent.h" 42 #include "core/dom/KeyboardEvent.h"
43 #include "core/dom/NodeTraversal.h" 43 #include "core/dom/NodeTraversal.h"
44 #include "core/dom/Text.h" 44 #include "core/dom/Text.h"
45 #include "core/editing/markup.h" 45 #include "core/editing/markup.h"
46 #include "core/html/HTMLBRElement.h" 46 #include "core/html/HTMLBRElement.h"
47 #include "core/html/HTMLFormElement.h" 47 #include "core/html/HTMLFormElement.h"
48 #include "core/html/HTMLInputElement.h"
48 #include "core/html/HTMLTemplateElement.h" 49 #include "core/html/HTMLTemplateElement.h"
49 #include "core/html/HTMLTextFormControlElement.h" 50 #include "core/html/HTMLTextFormControlElement.h"
50 #include "core/html/parser/HTMLParserIdioms.h" 51 #include "core/html/parser/HTMLParserIdioms.h"
51 #include "core/loader/FrameLoader.h" 52 #include "core/loader/FrameLoader.h"
52 #include "core/page/Frame.h" 53 #include "core/page/Frame.h"
53 #include "core/page/Settings.h" 54 #include "core/page/Settings.h"
54 #include "core/rendering/RenderWordBreak.h" 55 #include "core/rendering/RenderWordBreak.h"
55 #include "wtf/StdLibExtras.h" 56 #include "wtf/StdLibExtras.h"
56 #include "wtf/text/CString.h" 57 #include "wtf/text/CString.h"
57 58
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 isAuto = false; 840 isAuto = false;
840 return LTR; 841 return LTR;
841 } 842 }
842 843
843 isAuto = true; 844 isAuto = true;
844 return directionality(); 845 return directionality();
845 } 846 }
846 847
847 TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c onst 848 TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c onst
848 { 849 {
849 if (isHTMLTextFormControlElement(this)) { 850 if (hasTagName(inputTag)) {
850 HTMLTextFormControlElement* textElement = toHTMLTextFormControlElement(c onst_cast<HTMLElement*>(this)); 851 HTMLInputElement* inputElement = toHTMLInputElement(const_cast<HTMLEleme nt*>(this));
eseidel 2013/08/23 18:57:48 Seems we should just have a const-aware version of
851 bool hasStrongDirectionality; 852 bool hasStrongDirectionality;
852 Unicode::Direction textDirection = textElement->value().defaultWritingDi rection(&hasStrongDirectionality); 853 Unicode::Direction textDirection = inputElement->value().defaultWritingD irection(&hasStrongDirectionality);
853 if (strongDirectionalityTextNode) 854 if (strongDirectionalityTextNode)
854 *strongDirectionalityTextNode = hasStrongDirectionality ? textElemen t : 0; 855 *strongDirectionalityTextNode = hasStrongDirectionality ? inputEleme nt : 0;
855 return (textDirection == Unicode::LeftToRight) ? LTR : RTL; 856 return (textDirection == Unicode::LeftToRight) ? LTR : RTL;
856 } 857 }
857 858
858 Node* node = firstChild(); 859 Node* node = firstChild();
859 while (node) { 860 while (node) {
860 // Skip bdi, script, style and text form controls. 861 // Skip bdi, script, style and text form controls.
861 if (equalIgnoringCase(node->nodeName(), "bdi") || node->hasTagName(scrip tTag) || node->hasTagName(styleTag) 862 if (equalIgnoringCase(node->nodeName(), "bdi") || node->hasTagName(scrip tTag) || node->hasTagName(styleTag)
862 || (node->isElementNode() && toElement(node)->isTextFormControl())) { 863 || (node->isElementNode() && toElement(node)->isTextFormControl())) {
863 node = NodeTraversal::nextSkippingChildren(node, this); 864 node = NodeTraversal::nextSkippingChildren(node, this);
864 continue; 865 continue;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 #ifndef NDEBUG 1099 #ifndef NDEBUG
1099 1100
1100 // For use in the debugger 1101 // For use in the debugger
1101 void dumpInnerHTML(WebCore::HTMLElement*); 1102 void dumpInnerHTML(WebCore::HTMLElement*);
1102 1103
1103 void dumpInnerHTML(WebCore::HTMLElement* element) 1104 void dumpInnerHTML(WebCore::HTMLElement* element)
1104 { 1105 {
1105 printf("%s\n", element->innerHTML().ascii().data()); 1106 printf("%s\n", element->innerHTML().ascii().data());
1106 } 1107 }
1107 #endif 1108 #endif
OLDNEW
« no previous file with comments | « Source/core/css/html.css ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698