Changeset 203104 in webkit
- Timestamp:
- Jul 11, 2016 9:28:16 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r203103 r203104 1 2016-07-11 Frederic Wang <fwang@igalia.com> 2 3 Add support for @href attribute in MathML 4 https://bugs.webkit.org/show_bug.cgi?id=85733 5 6 Reviewed by Brent Fulgham. 7 8 We import some tests from the MathML in HTML5 test suite to 9 test clicks on href attributes and write similar tests. 10 We also test tab/enter keys and user agent style with links. 11 12 * mathml/mathml-in-html5/href-click-1.html: Added. Verify mouse click on a MathML link. 13 * mathml/mathml-in-html5/href-click-1-expected.html: Added. 14 * mathml/mathml-in-html5/href-click-2.html: Added. 15 Verify mouse click on a descendant of a MathML link. 16 * mathml/mathml-in-html5/href-click-2-expected.html: Added. 17 * mathml/presentation/href-enter.html: Added. 18 Verify tab navigation and activing link with enter. 19 * mathml/presentation/href-enter-expected.html: Added. 20 * mathml/presentation/href-style.html: Added. 21 Verify default style of links and of focused links. 22 * mathml/presentation/href-style-expected.html: Added. 23 * mathml/presentation/maction-toggle-href.html: Added. 24 Verify conflicts between maction toggle and href link. 25 * mathml/presentation/maction-toggle-href-expected.html: Added. 26 * mathml/presentation/semantics-href.html: Added. Verify mouse click on a <semantics> link. 27 * mathml/presentation/semantics-href-expected.html: Added. 28 * platform/mac/TestExpectations: Disable MathML link tests that rely on keyboard events. 29 * platform/ios-simulator/TestExpectations: Ditto. 30 1 31 2016-07-11 Frederic Wang <fwang@igalia.com> 2 32 -
trunk/LayoutTests/platform/ios-simulator/TestExpectations
r203072 r203104 680 680 # The web font loading & relayout seems to be performed too late. 681 681 imported/mathml-in-html5/mathml/relations/css-styling/mathvariant-transforms-1.html [ Pass ImageOnlyFailure ] 682 683 # These tests use key navigation to test MathML links but do not seem to work on iOS simulator. 684 webkit.org/b/159662 mathml/presentation/href-enter.html [ Skip ] 685 webkit.org/b/159662 mathml/presentation/href-style.html [ Skip ] 682 686 683 687 # <rdar://problem/19215305> ASSERT(m_cgFont.get()) fails in FontPlatformData::ctFont() -
trunk/LayoutTests/platform/mac/TestExpectations
r203071 r203104 805 805 mathml/presentation/fractions-linethickness.html [ Skip ] 806 806 mathml/opentype/large-operators-italic-correction.html [ Skip ] 807 808 # These tests use key navigation to test MathML links but do not seem to work on Mac. 809 webkit.org/b/159662 mathml/presentation/href-enter.html [ Skip ] 810 webkit.org/b/159662 mathml/presentation/href-style.html [ Skip ] 807 811 808 812 webkit.org/b/128255 compositing/columns/composited-lr-paginated-repaint.html [ Pass Failure ] -
trunk/Source/WebCore/ChangeLog
r203099 r203104 1 2016-07-11 Frederic Wang <fwang@igalia.com> 2 3 Add support for @href attribute in MathML 4 https://bugs.webkit.org/show_bug.cgi?id=85733 5 6 Reviewed by Brent Fulgham. 7 8 We add support for the href attribute from MathML 3 but ignore the deprecated XLink version. 9 We also use the code from HTMLAnchorElement SVGAElement to make MathMLElement with a href 10 attribute behave as a link. 11 Finally, we adjust mathml.css based on rules from the html and svg user agent stylesheets. 12 13 Tests: mathml/mathml-in-html5/href-click-1.html 14 mathml/mathml-in-html5/href-click-2.html 15 mathml/presentation/href-enter.html 16 mathml/presentation/href-style.html 17 mathml/presentation/maction-toggle-href.html 18 mathml/presentation/semantics-href.html 19 20 * css/mathml.css: 21 (:any-link): Set color and mouse cursor of links. 22 (:any-link:active): Set color of active links. 23 (:focus): Set outline of focused links. 24 * mathml/MathMLElement.cpp: 25 (WebCore::MathMLElement::parseAttribute): Parse the href attribute. 26 (WebCore::MathMLElement::willRespondToMouseClickEvents): Based on HTMLAnchorElement/SVGAElement. 27 (WebCore::MathMLElement::defaultEventHandler): Based on HTMLAnchorElement/SVGAElement. 28 (WebCore::MathMLElement::canStartSelection): Based on HTMLAnchorElement/SVGAElement. 29 (WebCore::MathMLElement::isFocusable): Based on HTMLAnchorElement/SVGAElement. 30 (WebCore::MathMLElement::isKeyboardFocusable): Based on HTMLAnchorElement/SVGAElement. 31 (WebCore::MathMLElement::isMouseFocusable): Based on HTMLAnchorElement/SVGAElement. 32 (WebCore::MathMLElement::isURLAttribute): Based on HTMLAnchorElement/SVGAElement. 33 (WebCore::MathMLElement::supportsFocus): Based on HTMLAnchorElement/SVGAElement. 34 (WebCore::MathMLElement::tabIndex): Based on HTMLAnchorElement/SVGAElement. 35 * mathml/MathMLElement.h: Define new members. 36 * mathml/MathMLSelectElement.cpp: 37 (WebCore::MathMLSelectElement::willRespondToMouseClickEvents): We also verify whether 38 the parent class will respond. 39 * mathml/mathattrs.in: Add href attribute. 40 1 41 2016-07-11 Sam Weinig <sam@webkit.org> 2 42 -
trunk/Source/WebCore/css/mathml.css
r203072 r203104 1 1 @namespace "http://www.w3.org/1998/Math/MathML"; 2 3 :any-link { 4 color: -webkit-link; 5 cursor: auto; 6 } 7 8 :any-link:active { 9 color: -webkit-activelink; 10 } 11 12 :focus { 13 outline: auto 5px -webkit-focus-ring-color 14 } 2 15 3 16 math { -
trunk/Source/WebCore/mathml/MathMLElement.cpp
r202727 r203104 33 33 34 34 #include "ElementIterator.h" 35 #include "Event.h" 36 #include "EventHandler.h" 37 #include "HTMLAnchorElement.h" 35 38 #include "HTMLElement.h" 36 39 #include "HTMLHtmlElement.h" … … 41 44 #include "MathMLNames.h" 42 45 #include "MathMLSelectElement.h" 46 #include "MouseEvent.h" 43 47 #include "RenderTableCell.h" 44 48 #include "SVGElement.h" 45 49 #include "SVGNames.h" 46 50 #include "SVGSVGElement.h" 51 #include "XLinkNames.h" 47 52 48 53 namespace WebCore { … … 217 222 void MathMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 218 223 { 219 if (name == rowspanAttr) { 224 if (name == hrefAttr) { 225 bool wasLink = isLink(); 226 setIsLink(!value.isNull() && !shouldProhibitLinks(this)); 227 if (wasLink != isLink()) 228 setNeedsStyleRecalc(); 229 } else if (name == rowspanAttr) { 220 230 if (is<RenderTableCell>(renderer()) && hasTagName(mtdTag)) 221 231 downcast<RenderTableCell>(*renderer()).colSpanOrRowSpanChanged(); … … 306 316 } 307 317 318 bool MathMLElement::willRespondToMouseClickEvents() 319 { 320 return isLink() || StyledElement::willRespondToMouseClickEvents(); 321 } 322 323 void MathMLElement::defaultEventHandler(Event* event) 324 { 325 if (isLink()) { 326 if (focused() && isEnterKeyKeydownEvent(event)) { 327 event->setDefaultHandled(); 328 dispatchSimulatedClick(event); 329 return; 330 } 331 if (MouseEvent::canTriggerActivationBehavior(*event)) { 332 const AtomicString& href = fastGetAttribute(hrefAttr); 333 String url = stripLeadingAndTrailingHTMLSpaces(href); 334 event->setDefaultHandled(); 335 if (Frame* frame = document().frame()) 336 frame->loader().urlSelected(document().completeURL(url), "_self", event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate()); 337 return; 338 } 339 } 340 341 StyledElement::defaultEventHandler(event); 342 } 343 344 bool MathMLElement::canStartSelection() const 345 { 346 if (!isLink()) 347 return StyledElement::canStartSelection(); 348 349 return hasEditableStyle(); 350 } 351 352 bool MathMLElement::isFocusable() const 353 { 354 if (renderer() && renderer()->absoluteClippedOverflowRect().isEmpty()) 355 return false; 356 357 return StyledElement::isFocusable(); 358 } 359 360 bool MathMLElement::isKeyboardFocusable(KeyboardEvent* event) const 361 { 362 if (isFocusable() && StyledElement::supportsFocus()) 363 return StyledElement::isKeyboardFocusable(event); 364 365 if (isLink()) 366 return document().frame()->eventHandler().tabsToLinks(event); 367 368 return StyledElement::isKeyboardFocusable(event); 369 } 370 371 bool MathMLElement::isMouseFocusable() const 372 { 373 // Links are focusable by default, but only allow links with tabindex or contenteditable to be mouse focusable. 374 // https://bugs.webkit.org/show_bug.cgi?id=26856 375 if (isLink()) 376 return StyledElement::supportsFocus(); 377 378 return StyledElement::isMouseFocusable(); 379 } 380 381 bool MathMLElement::isURLAttribute(const Attribute& attribute) const 382 { 383 return attribute.name().localName() == hrefAttr || StyledElement::isURLAttribute(attribute); 384 } 385 386 bool MathMLElement::supportsFocus() const 387 { 388 if (hasEditableStyle()) 389 return StyledElement::supportsFocus(); 390 // If not a link we should still be able to focus the element if it has tabIndex. 391 return isLink() || StyledElement::supportsFocus(); 392 } 393 394 int MathMLElement::tabIndex() const 395 { 396 // Skip the supportsFocus check in StyledElement. 397 return Element::tabIndex(); 398 } 399 308 400 } 309 401 -
trunk/Source/WebCore/mathml/MathMLElement.h
r198129 r203104 70 70 bool isFlowContent(const Node&) const; 71 71 72 bool willRespondToMouseClickEvents() override; 73 void defaultEventHandler(Event*) override; 74 72 75 private: 73 76 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; 74 85 }; 75 86 -
trunk/Source/WebCore/mathml/MathMLSelectElement.cpp
r202441 r203104 225 225 bool MathMLSelectElement::willRespondToMouseClickEvents() 226 226 { 227 return fastGetAttribute(MathMLNames::actiontypeAttr) == "toggle" ;227 return fastGetAttribute(MathMLNames::actiontypeAttr) == "toggle" || MathMLInlineContainerElement::willRespondToMouseClickEvents(); 228 228 } 229 229 -
trunk/Source/WebCore/mathml/mathattrs.in
r203074 r203104 26 26 form 27 27 height 28 href 28 29 largeop 29 30 linethickness
Note: See TracChangeset
for help on using the changeset viewer.