Source/WebCore/css/mathml.css

11@namespace "http://www.w3.org/1998/Math/MathML";
22
 3:any-link {
 4 color: -webkit-link;
 5 cursor: auto;
 6}
 7
 8:any-link:active {
 9 color: -webkit-activelink;
 10}
 11
312math {
413 -webkit-line-box-contain: glyphs replaced;
514 text-indent: 0;

Source/WebCore/mathml/MathMLElement.cpp

3232#include "MathMLElement.h"
3333
3434#include "ElementIterator.h"
 35#include "Event.h"
 36#include "EventHandler.h"
 37#include "HTMLAnchorElement.h"
3538#include "HTMLElement.h"
3639#include "HTMLMapElement.h"
3740#include "HTMLNames.h"
3841#include "HTMLParserIdioms.h"
3942#include "MathMLNames.h"
4043#include "MathMLSelectElement.h"
 44#include "MouseEvent.h"
4145#include "RenderTableCell.h"
4246#include "SVGElement.h"
4347#include "SVGNames.h"
 48#include "XLinkNames.h"
4449
4550namespace WebCore {
4651

@@unsigned MathMLElement::rowSpan() const
213218
214219void MathMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
215220{
216  if (name == rowspanAttr) {
 221 if (name == hrefAttr) {
 222 bool wasLink = isLink();
 223 setIsLink(!value.isNull() && !shouldProhibitLinks(this));
 224 if (wasLink != isLink())
 225 setNeedsStyleRecalc();
 226 } else if (name == rowspanAttr) {
217227 if (is<RenderTableCell>(renderer()) && hasTagName(mtdTag))
218228 downcast<RenderTableCell>(*renderer()).colSpanOrRowSpanChanged();
219229 } else if (name == columnspanAttr) {

@@void MathMLElement::attributeChanged(const QualifiedName& name, const AtomicStri
302312 StyledElement::attributeChanged(name, oldValue, newValue, reason);
303313}
304314
 315bool MathMLElement::willRespondToMouseClickEvents()
 316{
 317 return isLink() || StyledElement::willRespondToMouseClickEvents();
 318}
 319
 320void MathMLElement::defaultEventHandler(Event* event)
 321{
 322 if (isLink()) {
 323 if (focused() && isEnterKeyKeydownEvent(event)) {
 324 event->setDefaultHandled();
 325 dispatchSimulatedClick(event);
 326 return;
 327 }
 328 if (MouseEvent::canTriggerActivationBehavior(*event)) {
 329 const AtomicString& href = fastGetAttribute(hrefAttr);
 330 String url = stripLeadingAndTrailingHTMLSpaces(href);
 331 event->setDefaultHandled();
 332 Frame* frame = document().frame();
 333 if (!frame)
 334 return;
 335 frame->loader().urlSelected(document().completeURL(url), "_self", event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate());
 336 return;
 337 }
 338 }
 339
 340 StyledElement::defaultEventHandler(event);
 341}
 342
 343bool MathMLElement::canStartSelection() const
 344{
 345 if (!isLink())
 346 return StyledElement::canStartSelection();
 347
 348 return hasEditableStyle();
 349}
 350
 351bool MathMLElement::isFocusable() const
 352{
 353 if (renderer() && renderer()->absoluteClippedOverflowRect().isEmpty())
 354 return false;
 355
 356 return StyledElement::isFocusable();
 357}
 358
 359bool MathMLElement::isKeyboardFocusable(KeyboardEvent* event) const
 360{
 361 if (isFocusable() && StyledElement::supportsFocus())
 362 return StyledElement::isKeyboardFocusable(event);
 363
 364 if (isLink())
 365 return document().frame()->eventHandler().tabsToLinks(event);
 366
 367 return StyledElement::isKeyboardFocusable(event);
 368}
 369
 370bool MathMLElement::isMouseFocusable() const
 371{
 372 // Links are focusable by default, but only allow links with tabindex or contenteditable to be mouse focusable.
 373 // https://bugs.webkit.org/show_bug.cgi?id=26856
 374 if (isLink())
 375 return StyledElement::supportsFocus();
 376
 377 return StyledElement::isMouseFocusable();
 378}
 379
 380bool MathMLElement::isURLAttribute(const Attribute& attribute) const
 381{
 382 return attribute.name().localName() == hrefAttr || StyledElement::isURLAttribute(attribute);
 383}
 384
 385bool MathMLElement::supportsFocus() const
 386{
 387 if (hasEditableStyle())
 388 return StyledElement::supportsFocus();
 389 // If not a link we should still be able to focus the element if it has tabIndex.
 390 return isLink() || StyledElement::supportsFocus();
 391}
 392
 393int MathMLElement::tabIndex() const
 394{
 395 // Skip the supportsFocus check in StyledElement.
 396 return Element::tabIndex();
 397}
 398
305399}
306400
307401#endif // ENABLE(MATHML)

Source/WebCore/mathml/MathMLElement.h

@@protected:
6969 bool isPhrasingContent(const Node&) const;
7070 bool isFlowContent(const Node&) const;
7171
 72 bool willRespondToMouseClickEvents() override;
 73 void defaultEventHandler(Event*) override;
 74
7275private:
7376 virtual void updateSelectedChild() { }
 77
 78 bool canStartSelection() const final;
 79 bool isFocusable() const final;
 80 bool isKeyboardFocusable(KeyboardEvent*) const final;
 81 bool isMouseFocusable() const final;
 82 bool isURLAttribute(const Attribute&) const final;
 83 bool supportsFocus() const final;
 84 int tabIndex() const final;
7485};
7586
7687inline bool Node::hasTagName(const MathMLQualifiedName& name) const

Source/WebCore/mathml/MathMLSelectElement.cpp

@@void MathMLSelectElement::defaultEventHandler(Event* event)
223223
224224bool MathMLSelectElement::willRespondToMouseClickEvents()
225225{
226  return fastGetAttribute(MathMLNames::actiontypeAttr) == "toggle";
 226 return fastGetAttribute(MathMLNames::actiontypeAttr) == "toggle" || MathMLInlineContainerElement::willRespondToMouseClickEvents();
227227}
228228
229229void MathMLSelectElement::toggle()

Source/WebCore/mathml/mathattrs.in

@@fontstyle
2525fontweight
2626form
2727height
 28href
2829largeop
2930linethickness
3031lspace